Simple Pypackage
A clean, automated setup for publishing simple Python packages to PyPI and Anaconda.
Setup
Prepare GitHub Repo
- Create new GitHub repository / fork this repository
- Setup PyPI and Anaconda Credentials in repository secrets
PYPI_USER: PyPI username (use__token__for API key authentication)PYPI_PASSWORD: PyPI password (use token including thepypi-prefix for API key authentication)ANACONDA_API_TOKEN: Anaconda API token
- After first release: Go to
Settingsand activate your GitHub Pages using thegh-pagesbranch
Edit Files
- Rename
simple_pypackagefolder to your package name - Replace all
simple-pypackage,simple_pypackage,ppeetteerrsandPeter Yuenwith your package name, package slug, username and author name in these files:.devcontainer.jsonmkdocs.yamlREADME.mdsetup.py.github/workflows/build.yamlconda-recipe/meta.yaml{project_name}/__init__.py
- Change your minimum Python version in
setup.py,.github/workflows/build.yamland.github/workflows/upload.yaml
GitHub Workflow
- On push / pull request to
mainbranch:- Try to build PyPI and Conda packages
- Run
pytestandcodecovon all OS types
- On release created:
- Build and publish package to PyPI and Anaconda (version is automatically inferred from repo tag)
- Update docs
Docker Dev Container
- A
.devcontainer.jsonwith my favourite setup is included <3. UseVSCode => Reopen in containerto use it if desired.
Usage
Important Gotchas
- Make sure all product dependencies are available on both
conda-forgeandpypi - Repo version tags must be of the format
vX.Y.Zwith lowercasev - If GitHub Actions are not triggering, check here to make sure it is not because of an outrage.
- Upload to Codecov might fail if you commit your repository too fast after creation / if you have not logged in to Codecov via GitHub. Just re-run the GitHub action in that case.
Things You Can Do
- Conda Description: Write a longer and better description for
conda-recipe/meta.yaml. - Extra Branches: Separate into
devorfeaturebranches. You might want to add GitHub Action triggers to push / pull requests to those branches. - Tests: Write tests in
pytest. Other testing framework would require minor changes. - Documentation: Write some nice documentation in the
docsdirectory. - Improve setup.py: You can add
description,package_data,classifiersandkeywordsto yoursetup.py.
Metadata
Release files for simple-pypackage 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simple-pypackage-0.1.0.tar.gz | 3.8 kB | Without provenance | Details for simple-pypackage-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simple_pypackage-0.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for simple_pypackage-0.1.0-py2.py3-none-any.whl |
Total release size: 7.6 kB
Release files / simple-pypackage-0.1.0.tar.gz
| Download URL | simple-pypackage-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd9842cd9b9c8c80dca577fba57a1e4a28ea13998dfec496eb04e35532bfc221
|
|
BLAKE2b-256 checksum How to use checksums |
2eea3f85f7becedd42d23ed197b2fcef1bfdeb597070e5bc50e991ed07374a28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
|
Release files / simple_pypackage-0.1.0-py2.py3-none-any.whl
| Download URL | simple_pypackage-0.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b50b446a3570066b7023f21d260367772011ceb7241b7197bb32af9d8f86a199
|
|
BLAKE2b-256 checksum How to use checksums |
f7338d5e159be4296b1f3e151012fa700baf0a87edf4017ecbd3b5300e00c3bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
|
Security for simple-pypackage 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.