个人python工具集
Project description
My python util collections
我的个人python工具集,模块构建流程:
项目结构
├── README.md
├── pyproject.toml
├── src
│ └── pyutils
│ ├── __init__.py
│ ├── base_sqlite_db.py
│ ├── my_log.py
│ ├── utils.py
│ └── zip.py
└── tests
└── test.py
Module模块构建
-
1、示例(使用 setuptools):
#在pyproject.toml文件 [build-system] requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] name = "your-package-name" version = "0.1.0" description = "简短描述" readme = "README.md" requires-python = ">=3.7" license = {text = "MIT"} authors = [ {name = "你的名字", email = "你@邮箱.com"} ] dependencies = [ "requests>=2.0", # 依赖示例 ] [project.urls] Homepage = "https://github.com/yourname/yourproject"
-
2、构建包
- 先安装打包工具(一次性操作):
pip install build
- 然后在项目根目录运行:
python -m build
- 会生成:
dist/ ├── your_package_name-0.1.0.tar.gz └── your_package_name-0.1.0-py3-none-any.whl
上传到 PyPI
安装上传工具:
pip install twine
注册并获取 PyPI 账号
上传:
twine upload dist/*
输入你的 PyPI 用户名和密码即可。
💡 最新版本twine可能是OIDC 的API token,在pypi的个人账号下创建 API token,
并在~/.pypirc本地保存配置,可以长期免输入token使用:
[distutils]
index-servers =
pypi
[pypi]
repository= https://upload.pypi.org/legacy/ #上传地址
username = __token__ #验证类型
password = #输入你的token pypi-AgEIcHlwaS5.....
💡 建议先上传到测试环境 Test PyPI:
💡 Because TestPyPI has a separate database from the live PyPI, you’ll need a separate user account specifically for TestPyPI. Go to https://test.pypi.org/account/register/ to register your account.
twine upload --repository testpypi dist/*
在其他项目中安装
pip install your-package-name
或者从 Test PyPI:
pip install --index-url https://test.pypi.org/simple/ your-package-name
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pripy_utils-0.1.2.tar.gz.
File metadata
- Download URL: pripy_utils-0.1.2.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e399c311958211284e16e02fb194f607a25f9a4e1e6641f75633cc3cc1cbf1be
|
|
| MD5 |
c9d470070d2e968527f8c58beecb2848
|
|
| BLAKE2b-256 |
68200eb90022a148a4eb83c0bb109d39cc2888e675860febe7a42b495bfa35a1
|
File details
Details for the file pripy_utils-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pripy_utils-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2eb1cfdd7ebda77a8dd01878638fa2a798c93df7f837797a68b99ae07f44808
|
|
| MD5 |
f1d614159fee85059d8aa9d5bf63e786
|
|
| BLAKE2b-256 |
15bc69757184d83b6718ef9b21d5221dd7c5f299d7f6e84681fe3c72d407bfa5
|