{"id":22779677,"url":"https://github.com/zgsla/packaging_tutorial","last_synced_at":"2025-03-30T14:15:00.987Z","repository":{"id":230884077,"uuid":"533196617","full_name":"zgsla/packaging_tutorial","owner":"zgsla","description":"PyPi 制作包tutorial","archived":false,"fork":false,"pushed_at":"2022-09-06T10:26:42.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T15:52:16.588Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zgsla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-09-06T06:48:31.000Z","updated_at":"2022-09-06T08:03:18.000Z","dependencies_parsed_at":"2024-04-01T11:43:37.880Z","dependency_job_id":null,"html_url":"https://github.com/zgsla/packaging_tutorial","commit_stats":null,"previous_names":["real1m8/packaging_tutorial","zhanglaiya/packaging_tutorial","zgsla/packaging_tutorial"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgsla%2Fpackaging_tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgsla%2Fpackaging_tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgsla%2Fpackaging_tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zgsla%2Fpackaging_tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zgsla","download_url":"https://codeload.github.com/zgsla/packaging_tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246326783,"owners_count":20759439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-11T20:09:29.046Z","updated_at":"2025-03-30T14:15:00.968Z","avatar_url":"https://github.com/zgsla.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# packaging_tutorial\nPyPi 制作包tutorial\n\n## 创建包文件夹\n创建一个文件夹packaging_tutorial，结构如下\n```\npackaging_tutorial/\n├── LICENSE\n├── pyproject.toml\n├── README.md\n├── src/\n│   └── example_package_YOUR_USERNAME_HERE/\n│       ├── __init__.py\n│       └── example.py\n└── tests/\n```\n### pyproject.toml\n```\n[build-system]\nrequires = [\"hatchling\"]\nbuild-backend = \"hatchling.build\"\n```\n包基本信息\n```\n[project]\nname = \"example_package_YOUR_USERNAME_HERE\"\nversion = \"0.0.1\"\nauthors = [\n  { name=\"Example Author\", email=\"author@example.com\" },\n]\ndescription = \"A small example package\"\nreadme = \"README.md\"\nlicense = { file=\"LICENSE\" }\nrequires-python = \"\u003e=3.7\"\nclassifiers = [\n    \"Programming Language :: Python :: 3\",\n    \"License :: OSI Approved :: MIT License\",\n    \"Operating System :: OS Independent\",\n]\n\n[project.urls]\n\"Homepage\" = \"https://github.com/pypa/sampleproject\"\n\"Bug Tracker\" = \"https://github.com/pypa/sampleproject/issues\"\n```\n构建\n```\npy -m pip install --upgrade build\npy -m build\n```\n这一步做完生产 dist文件夹  \n上传到[https://test.pypi.org](https://test.pypi.org)\n```\npy -m pip install --upgrade twine\npy -m twine upload --repository testpypi dist/*\n```\n\n安装\n```\npy -m pip install --index-url https://test.pypi.org/simple/ --no-deps example-package-YOUR-USERNAME-HERE\n```\n\n使用\n```\n\u003e\u003e\u003e from example_package_YOUR_USERNAME_HERE import example\n\u003e\u003e\u003e example.add_one(2)\n3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgsla%2Fpackaging_tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzgsla%2Fpackaging_tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzgsla%2Fpackaging_tutorial/lists"}