A template for a private Python package
Project description
Public Python Package Template
Using This Template for Your Own Package (e.g., "my_package")
To adapt this template for your new package (let's call it "my_package"):
-
Copy or Template the Repository:
- Click the "Use this template" button on GitHub to create a new repository from this template.
-
Rename the Package Directory:
- Rename the main package directory in src dir
-
Update
pyproject.toml:[project].name: Change from"public_package_template"to"my_package".[project].urls: UpdateHomepageandRepositoryURLs to point to your new repository.
-
Set up bump version:
- Install and authenticate GitHub CLI:
# Install GitHub CLI (if not already installed) # macOS: brew install gh # Linux: See https://cli.github.com/ # Authenticate gh auth login
- Create a Personal Access Token:
- Go to: https://github.com/settings/personal-access-tokens/new?type=beta
- Set permission "Contents" to Read & Write
- Copy the generated token
- Add the token to repository secrets:
gh secret set BUMPVERSION_TOKEN --body "your_generated_token_here"
- It is recommended to make the main branch protected as every push/merge/commit to it will trigger a bump version.
- Install and authenticate GitHub CLI:
-
Set up PyPI
- Create PyPI API token:
- Go to: https://pypi.org/manage/account/token/
- Click "Add API token", set the scope for your package
- Copy the generated token (starts with
pypi-)
- Add the token to repository secrets:
gh secret set PYPI_PUBLISH_TOKEN --body "pypi-your_token_here"
- Create PyPI API token:
-
Verify secrets setup:
# List all repository secrets gh secret list # Check authentication status gh auth status
-
Once you push anything to main, a new tag will be created, built, and published to PyPI
Managing Repository Secrets via CLI
Additional useful commands:
# Set multiple secrets from .env file
gh secret set -f .env
# Delete a secret
gh secret delete SECRET_NAME
# Set organization-level secret
gh secret set SECRET_NAME --org your-org
# Open repository settings in browser
gh browse --settings
Installing Your Published Public Package
Then you can just pip install your package.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yid_public_package_template-0.1.15.tar.gz.
File metadata
- Download URL: yid_public_package_template-0.1.15.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49ae8c466951fd4b0102f3625d90f6c0530d8eff750c10ebde2a6c7c299bac80
|
|
| MD5 |
8bb958d38e65571c7f80866094bf6868
|
|
| BLAKE2b-256 |
46ad7930bf057ca01735557e07c03b84b5bd0483381aa461d16284e6176fdb64
|
File details
Details for the file yid_public_package_template-0.1.15-py3-none-any.whl.
File metadata
- Download URL: yid_public_package_template-0.1.15-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a336b48ede4bb2e6ed90c3432fcaf6f147f77970dc4b749da9e6a323a37f811
|
|
| MD5 |
2e05b9c917444d0da4c7f33078278421
|
|
| BLAKE2b-256 |
912d451d9aeabe3e5ce198898905b0c4f412c876cd8ee9862fa60ae976d564a9
|