MyGrad 开源项目教程
MyGradDrop-in autodiff for NumPy.项目地址:https://gitcode.com/gh_mirrors/my/MyGrad
1. 项目的目录结构及介绍
MyGrad 项目的目录结构如下:
MyGrad/
├── docs/
│ └── ...
├── src/
│ └── mygrad/
│ └── ...
├── tests/
│ └── ...
├── .gitattributes
├── .gitignore
├── .pre-commit-config.yaml
├── CONTRIBUTING.md
├── LICENSE.txt
├── MANIFEST.in
├── README.md
├── readthedocs.yml
├── setup.cfg
├── setup.py
├── versioneer.py
└── ...
目录介绍
docs/
: 包含项目的文档文件。src/mygrad/
: 包含 MyGrad 库的核心代码。tests/
: 包含项目的测试代码。.gitattributes
: Git 属性配置文件。.gitignore
: Git 忽略配置文件。.pre-commit-config.yaml
: 预提交钩子配置文件。CONTRIBUTING.md
: 贡献指南。LICENSE.txt
: 项目许可证。MANIFEST.in
: 打包清单文件。README.md
: 项目说明文件。readthedocs.yml
: Read the Docs 配置文件。setup.cfg
: 安装配置文件。setup.py
: 安装脚本。versioneer.py
: 版本管理脚本。
2. 项目的启动文件介绍
MyGrad 项目的启动文件主要是 setup.py
。这个文件负责项目的安装和分发。通过运行 python setup.py install
可以安装 MyGrad 库。
setup.py
文件内容概览
from setuptools import setup, find_packages
import versioneer
setup(
name='mygrad',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
description='A lightweight library that adds automatic differentiation to NumPy',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
author='Ryan Soklaski',
author_email='ryan.soklaski@gmail.com',
url='https://github.com/rsokl/MyGrad',
packages=find_packages(where='src'),
package_dir={'': 'src'},
install_requires=[
'numpy>=1.17',
],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
)
3. 项目的配置文件介绍
MyGrad 项目的主要配置文件包括:
setup.cfg
: 包含安装和打包的配置信息。readthedocs.yml
: 用于配置 Read the Docs 文档托管服务。.pre-commit-config.yaml
: 用于配置预提交钩子。
setup.cfg
文件内容概览
[metadata]
name = mygrad
version = attr: mygrad.__version__
description = A lightweight library that adds automatic differentiation to NumPy
long_description = file: README.md
long_description_content_type = text/markdown
author = Ryan Soklaski
author_email = ryan.soklaski@gmail.com
url = https://github.com/rsokl/MyGrad
license = MIT
[options]
packages = find:
package_dir =
=src
install_requires =
numpy>=1.17
[options.packages.find]
where = src
[versioneer]
VCS = git
style = pep440
versionfile_source = src/mygrad/_version.py
versionfile_build = mygrad/_version.py
tag_prefix = v
readthedocs.yml
文件内容概览
version: 2
build:
image: latest
python
MyGradDrop-in autodiff for NumPy.项目地址:https://gitcode.com/gh_mirrors/my/MyGrad