A simple importable Python package
Project description
import-ready
This repository demonstrates steps needed to publish an importable Python package first to TestPyPI, and second to PyPI. If this demonstration deviates from best practice in any way, please submit an issue on GitHub.
Inside import-ready is a package called huntsville_havoc
that divulges a couple of bona fide secrets that most diehard SPHL Huntsville Havoc fans don't know.
Prepare the Package
- Prepare your environment before installing Python packages.
- Update version in setup.py per semantic versioning guidance.
Test in Development Environment
Run as follows from the top level directory in a clean venv with pip-tools installed:
python -m piptools compile --generate-hashes --allow-unsafe dev-requirements.in dos2unix dev-requirements.txt python -m pip install -r dev-requirements.txt python -m pytest -s tests
Publish to TestPyPI
- Git commit, tag, & push all desired edits for release.
- Create a new release in GitHub to mirror your new version.
- Generate distribution archives for your package.
- Upload your package to TestPyPI.
Test the TestPyPI Published Package
Run as follows from some random directory (to prove to yourself you're not "cheating" with some locally obtained import-ready) in another clean venv with pip-tools installed:
cp <path to import-ready>/tests/origins_test.py . cp <path to import-ready>/tests/pubtest-requirements.in . python -m piptools compile --generate-hashes pubtest-requirements.in dos2unix pubtest-requirements.txt python -m pip install -r pubtest-requirements.txt python -m pytest -s
Publish to PyPI
After completing the above steps, upload your package to PyPI.
Test the real deal
Post-publish test, importing import-ready itself back from PyPI. Run as follows from some other random directory (same reason as for TestPyPI testing above) in yet another clean venv with pip-tools installed:
cp <path to import-ready>/tests/origins_test.py . cp <path to import-ready>/setup.py . python -m piptools compile --generate-hashes dos2unix requirements.txt python -m pip install -r requirements.txt python -m pytest -s
Thanks
License
MIT.
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
Hashes for import_ready-0.10.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffb302d9ec5003da2eb22310fdf3e45f0654beb48014148b6ddcf1ebfaefea12 |
|
MD5 | 643171870604bfd2c4316aa535ffdb94 |
|
BLAKE2b-256 | b7e353c738428e247368979d46f893e613d2481eea28c4e1537fcc7b0e261f07 |