Skip to main content

Python Package Template

📦 一个快速上传到 PyPI 的 Python Package 模版。

上传到 PyPI 后可以使用 pip install 安装。

1 使用方法

  1. 点击本项目右上角的绿色按钮 Use this template(使用此模板),输入名称和说明,完成创建;

  2. 将项目克隆到本地,这里以本项目为例,实际操作时这里需要替换你自己的项目;

    git clone https://github.com/Ailln/python-package-template.git --depth 1
    
  3. 修改配置,文件中有提示;

    cd python-package-template
    
    # 1. 将下文中的 your_package_name 改成你的实际项目名称
    mv package_name your_package_name
    
    # 2. 接下来修改 `setup.py MANIFEST.in /package_name/shell/usage.py scripts/local_install.sh` 中的参数,里面有提示。
    
    # 3. 最后 `README.md` 修改为你的项目介绍,也就是你当前在读的这个文本。
    
  4. 编写你的 Package 代码,并进行测试。

    # 本地充分测试
    bash scripts/local_test.sh
    
  5. 上传到 PyPi(需要注册),参考如何发布自己的包到 pypi;

    bash scripts/upload_pypi.sh
    
  6. 更新到 Github。

    git push
    

2 项目结构

.
├── README.md # 项目文档
├── package_name # 你需要手动修改为你的项目名称
│    ├── shell # 在命令行中执行的代码
│    │    ├── __init__.py
│    │    └── usage.py
│    ├── src # 静态资源
│    │    └── temp.txt
│    └── version.py # 版本号
├── scripts
│    ├── local_install.sh # 需要替换里面的 package_name
│    ├── local_test.sh
│    └── upload_pypi.sh
├── requirements.txt # 包依赖
├── .gitignore # git 忽略项
├── MANIFEST.in # 要包含在 sdist 命令构建的分发中的文件列表。
├── LICENSE # 这里面的内容为本项目的 License,你需要手动替换它。
└── setup.py # 安装配置

3 TODO

  • 增加自动修改 package name 的脚本。
  • 增加 test 相关代码。

4 许可

5 参考

Metadata

Release files for dov 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dov 0.0.1
File Size Uploaded Provenance Actions
dov-0.0.1.tar.gz 4.2 kB Without provenance Details for dov-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dov 0.0.1
File Interpreter ABI Platform Actions
dov-0.0.1-py3-none-any.whl Python 3 none any Details for dov-0.0.1-py3-none-any.whl

Total release size: 9.0 kB

Release files / dov-0.0.1.tar.gz

Download URL dov-0.0.1.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ce5c386619ca4639ef5bcb8a5df2906a06470b5d9968f023fb758402b8bd27c5
BLAKE2b-256 checksum
How to use checksums
30106124182f7d155c9291eaef6707a663ccd856df4b8b7d289436a8c830c6a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.59.0 importlib-metadata/3.10.0 keyring/22.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.8

Release files / dov-0.0.1-py3-none-any.whl

Download URL dov-0.0.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1b182f3223309570c661d9f7289ea1f40461f555b0080371983dff079155a55
BLAKE2b-256 checksum
How to use checksums
33a191f5a0f5f91cd3d2d30a6c0745502fc6af0945d673f40d1df2985246be8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.4 tqdm/4.59.0 importlib-metadata/3.10.0 keyring/22.3.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.8.8

Security for dov 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page