Python sample package with data
How to distribute a Python package with data.
Tested on Ubuntu 19.10, Python 3.7.5, wheel==0.32.3, setuptools==41.1.0, twine==3.1.1.
How end users use the package from https://pypi.org/project/python-sample-package-with-data/:
python3 -m pip install --user python-sample-package-with-data
python-sample-package-with-data
Expected output:
hello data
which are the contents of our test data file python_sample_package_with_data/mydata.txt that was distributed with pip.
How maintainers publish it:
# One time setup.
python3 -m pip install --user setuptools wheel twine
# Every time you want to publish.
python setup.py sdist bdist_wheel
twine upload dist/*
rm -rf build dist *.egg-info
Bibliography:
- https://stackoverflow.com/questions/47577762/how-do-i-distribute-my-pip-package-with-data-files-correctly
- https://stackoverflow.com/questions/47817944/python-pkg-resources-and-file-access-in-packages
- https://stackoverflow.com/questions/39104/finding-a-file-in-a-python-module-distribution
- https://stackoverflow.com/questions/14211575/any-python-function-to-get-data-files-root-directory
- https://stackoverflow.com/questions/14422340/manifest-in-package-data-and-data-files-clarification
- https://stackoverflow.com/questions/11235820/setup-py-not-installing-data-files
Release files for python-sample-package-with-data-aitirga 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-sample-package-with-data-aitirga-0.0.3.tar.gz | 1.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_sample_package_with_data_aitirga-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.2 kB
Release files / python-sample-package-with-data-aitirga-0.0.3.tar.gz
| Download URL | python-sample-package-with-data-aitirga-0.0.3.tar.gz |
|---|---|
| Size | 1.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a18945e002dfe8438e912cdeea61ce76323f5802201fc3c3e50d8dd35c15ad8a
|
|
BLAKE2b-256 checksum How to use checksums |
a7f5a1675084837d7ca3400f7a2c72b1767b24a7ce5d9c5912c780d92bd58794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.12
|
Release files / python_sample_package_with_data_aitirga-0.0.3-py3-none-any.whl
| Download URL | python_sample_package_with_data_aitirga-0.0.3-py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76cfecec23664e1eaf3ceb53bd40af7b3ecf64fe6c2a8bfd9eb6b0f955f256de
|
|
BLAKE2b-256 checksum How to use checksums |
708f48fb0df95fddfd18273bf8ba9ed5c7f62521c48c0fc3566005cffaa21c9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.63.0 CPython/3.8.12
|