首页
/ Eigency 项目教程

Eigency 项目教程

2024-09-01 19:02:43作者:袁立春Spencer

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

Eigency 项目的目录结构如下:

eigency/
├── CONTRIBUTING.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── pyproject.toml
├── setup.cfg
├── setup.py
├── eigency/
│   ├── __init__.py
│   ├── core.pyx
│   ├── eigency.pxd
│   ├── test/
│   │   ├── __init__.py
│   │   ├── test_eigency.py
│   │   └── ...
│   └── ...
└── ...

目录结构介绍

  • CONTRIBUTING.md: 贡献指南文件。
  • LICENSE: 项目许可证文件。
  • MANIFEST.in: 清单文件,用于指定在打包时包含的文件。
  • README.md: 项目说明文件。
  • pyproject.toml: 项目配置文件,用于构建工具。
  • setup.cfg: 安装配置文件。
  • setup.py: 安装脚本文件。
  • eigency/: 主代码目录。
    • __init__.py: 包初始化文件。
    • core.pyx: 核心代码文件,包含 Cython 接口。
    • eigency.pxd: Cython 声明文件。
    • test/: 测试代码目录。
      • __init__.py: 测试包初始化文件。
      • test_eigency.py: 测试脚本文件。

2. 项目的启动文件介绍

Eigency 项目的启动文件是 setup.py。这个文件用于配置和安装项目。以下是 setup.py 的主要内容:

from setuptools import setup, Extension
import eigency

extensions = [
    Extension(
        "eigency.core",
        ["eigency/core.pyx"],
        include_dirs=[".", "eigency"] + eigency.get_includes()
    )
]

setup(
    name="eigency",
    version="1.4",
    packages=["eigency"],
    ext_modules=extensions,
    install_requires=["numpy"],
    include_package_data=True,
)

启动文件介绍

  • setup.py: 使用 setuptools 进行项目配置和安装。
    • Extension: 定义 Cython 扩展模块。
    • eigency.get_includes(): 获取包含路径,包括 Eigen 库的路径。
    • setup: 配置项目名称、版本、包、扩展模块和依赖项。

3. 项目的配置文件介绍

Eigency 项目的配置文件包括 setup.cfgpyproject.toml

setup.cfg

setup.cfg 文件用于配置安装选项。以下是 setup.cfg 的主要内容:

[metadata]
name = eigency
version = 1.4
description = Cython interface between Numpy arrays and Eigen matrices
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/wouterboomsma/eigency
author = Wouter Boomsma
license = MIT

[options]
packages = find:
install_requires = numpy

[options.package_data]
* = *.pxd

[tool.setuptools.packages.find]
where = .

pyproject.toml

pyproject.toml 文件用于配置构建工具。以下是 pyproject.toml 的主要内容:

[build-system]
requires = ["setuptools", "wheel", "cython"]
build-backend = "setuptools.build_meta"

配置文件介绍

  • setup.cfg: 配置项目元数据、安装选项和包数据。
    • metadata: 项目名称、版本、描述、长描述、URL、作者和许可证。
    • options: 包查找、安装依赖项。
    • options.package_data: 包数据文件。
  • pyproject.toml: 配置构建系统所需工具和后端。
    • build-system: 构建系统所需工具
登录后查看全文
热门项目推荐