Say Hello now
Project description
Publish to PyPI Demo
- PyPI - The Python Package Index
- https://packaging.python.org/tutorials/packaging-projects/#classifiers
-
Extract the reusable code into seperate modules.
-
Put it into 'project/src'
-
Create a new 'project/setup.py'
-
$ python setup.py bdist_wheel
... creating build creating build/lib copying src/helloworld.py -> build/lib ... creating build/bdist.macosx-10.9-x86_64/wheel/helloworld-0.0.1.dist-info/WHEEL creating 'dist/helloworld-0.0.1-py3-none-any.whl' and adding 'build/bdist.macosx-10.9-x86_64/wheel' to it removing build/bdist.macosx-10.9-x86_64/wheel $ tree . . ├── README.md ├── build │ ├── bdist.macosx-10.9-x86_64 │ └── lib │ └── helloworld.py ├── dist │ └── helloworld-0.0.1-py3-none-any.whl ├── setup.py └── src ├── helloworld.egg-info │ ├── PKG-INFO │ ├── SOURCES.txt │ ├── dependency_links.txt │ └── top_level.txt └── helloworld.py
-
Test install it locally
- 每次更新package, 都跑一遍:
$ pip install -e .
: '-e' flag links to the code rather than copy the code to install.
$ pip install -e . Obtaining file:///Users/boyang/Documents/Dev/Python%20Demo%20Projects/publish-your-first-package-on-PyPI Installing collected packages: helloworld Running setup.py develop for helloworld Successfully installed helloworld
-
git ignore (gitignore.io)
-
Licence (choosealicense.com)
-
Add classifiers in 'setup.py' (https://pypi.org/classifiers/)
-
Documentation (ReStructured Text (python doc, can use
**Sphinx**
) or Markdown (simpler, less powerful) version) -
Testing (with
pytest
...) -
Update Read setup.py for
install_requires
and extraextras_require
.- then update README for developers
-
Source Distribution
$ python setup.py sdist
-
Add manifest for srce dis??....
-
Publish it!
- python setup.py bdist_wheel sdist
$ pip install twine
$ twine upload dist/*
-
USE tox for testing different python environments
?. + 个test?
Usage
from helloworld import say_hello
Developent
$ pip install -e .[dev]
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
File details
Details for the file helloworld-boyan-20210805-0.0.2.tar.gz
.
File metadata
- Download URL: helloworld-boyan-20210805-0.0.2.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6412aea2c9ecab0664d1949636e0bda7ec20471562b3ed83dc6aec3756a55202
|
|
MD5 |
5f939cfc4468021e0b272f31ad83e76a
|
|
BLAKE2b-256 |
b998f7f44f0281170f24acbd0836443cf39d00f4d224011468c5367e60bbf432
|
File details
Details for the file helloworld_boyan_20210805-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: helloworld_boyan_20210805-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
3e6c35e6032296cb26812da6a590d6e0de7ed0101577581277c34c56e1de745a
|
|
MD5 |
40c534480f2cd452415e78d9013f7f09
|
|
BLAKE2b-256 |
720c03e51d5efdc3f479b1d67b0fe5767f70e5689dc230843a6512b531577e64
|