A clean, automated setup for publishing simple Python packages to PyPI and Anaconda.
Project description
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
Settings
and activate your GitHub Pages using thegh-pages
branch
Edit Files
- Rename
simple_pypackage
folder to your package name - Replace all
simple-pypackage
,simple_pypackage
,ppeetteerrs
andPeter Yuen
with your package name, package slug, username and author name in these files:.devcontainer.json
mkdocs.yaml
README.md
setup.py
.github/workflows/build.yaml
conda-recipe/meta.yaml
{project_name}/__init__.py
- Change your minimum Python version in
setup.py
,.github/workflows/build.yaml
and.github/workflows/upload.yaml
GitHub Workflow
- On push / pull request to
main
branch:- Try to build PyPI and Conda packages
- Run
pytest
andcodecov
on 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.json
with my favourite setup is included <3. UseVSCode => Reopen in container
to use it if desired.
Usage
Important Gotchas
- Make sure all product dependencies are available on both
conda-forge
andpypi
- Repo version tags must be of the format
vX.Y.Z
with 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
dev
orfeature
branches. 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
docs
directory. - Improve setup.py: You can add
description
,package_data
,classifiers
andkeywords
to yoursetup.py
.
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
simple-pypackage-0.1.0.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for simple_pypackage-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b50b446a3570066b7023f21d260367772011ceb7241b7197bb32af9d8f86a199 |
|
MD5 | 86ddbd5987c0eab507a0ba5d4ddde935 |
|
BLAKE2b-256 | f7338d5e159be4296b1f3e151012fa700baf0a87edf4017ecbd3b5300e00c3bd |