gdstk 开源项目教程

gdstk 开源项目教程

gdstkGdstk (GDSII Tool Kit) is a C++/Python library for creation and manipulation of GDSII and OASIS files.项目地址:https://gitcode.com/gh_mirrors/gd/gdstk

1. 项目的目录结构及介绍

gdstk 是一个用于处理 GDSII 文件的 Python 库。以下是该项目的目录结构及其简要介绍:

gdstk/
├── docs/
│   ├── conf.py
│   ├── index.rst
│   └── ...
├── examples/
│   ├── example1.py
│   ├── example2.py
│   └── ...
├── gdstk/
│   ├── __init__.py
│   ├── lib/
│   │   └── ...
│   ├── polygon.py
│   ├── cell.py
│   └── ...
├── tests/
│   ├── test_polygon.py
│   ├── test_cell.py
│   └── ...
├── .gitignore
├── LICENSE
├── README.md
├── setup.py
└── ...
  • docs/: 包含项目文档的配置文件和源文件。
  • examples/: 包含示例代码,展示如何使用 gdstk 库。
  • gdstk/: 核心代码目录,包含库的主要实现文件。
  • tests/: 包含测试代码,用于验证库的功能。
  • .gitignore: Git 忽略文件列表。
  • LICENSE: 项目许可证。
  • README.md: 项目介绍和使用说明。
  • setup.py: 用于安装和分发项目的脚本。

2. 项目的启动文件介绍

gdstk 项目的启动文件是 gdstk/__init__.py。这个文件初始化库并导入必要的模块,使得用户可以通过 import gdstk 来使用库。

# gdstk/__init__.py

from .polygon import *
from .cell import *
from .library import *
from .rawcell import *
from .flexpath import *
from .robustpath import *
from .curve import *
from .utils import *

__version__ = "0.8.2"

3. 项目的配置文件介绍

gdstk 项目的配置文件主要用于文档生成和项目安装。以下是两个重要的配置文件:

setup.py

setup.py 文件用于安装和分发项目。它定义了项目的元数据和依赖项。

# setup.py

from setuptools import setup, Extension
from pathlib import Path

def get_version():
    with open(Path(__file__).parent / "gdstk" / "__init__.py") as f:
        for line in f:
            if line.startswith("__version__"):
                return line.split('"')[1]

setup(
    name="gdstk",
    version=get_version(),
    author="Lucas Heitzmann Gabrielli",
    author_email="heitzmann@gmail.com",
    description="GDSII manipulation toolkit",
    long_description=Path("README.md").read_text(),
    long_description_content_type="text/markdown",
    url="https://github.com/heitzmann/gdstk",
    packages=["gdstk"],
    ext_modules=[Extension("gdstk._gdstk", ["gdstk/gdstk.c"], include_dirs=["gdstk"])],
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires='>=3.6',
)

docs/conf.py

docs/conf.py 文件用于配置 Sphinx 文档生成工具。它定义了文档的构建选项和扩展。

# docs/conf.py

import os
import sys
sys.path.insert(0, os.path.abspath('..'))

project = 'gdstk'
copyright = '2021, Lucas Heitzmann Gabrielli'
author = 'Lucas Heitzmann Gabrielli'

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.viewcode',
    'sphinx.ext.napoleon'
]

templates_path = ['_templates']

exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

html_theme = 'alabaster'

html_static_path = ['

gdstkGdstk (GDSII Tool Kit) is a C++/Python library for creation and manipulation of GDSII and OASIS files.项目地址:https://gitcode.com/gh_mirrors/gd/gdstk

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黎情卉Desired

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值