Set up Python project for PyPI publishing or private GitHub distribution with pyproject.toml, src layout, and optional build scripts. Use when creating a new Python package, setting up for PyPI distribution, initializing a Python library project, or setting up a private library distributed via GitHub.
npx claudepluginhub jmazzahacks/byteforge-claude-skills --plugin byteforge-skillsThis skill uses the workspace's default tool permissions.
This skill helps you set up a Python project for PyPI publishing following modern best practices with pyproject.toml, src layout, and standardized build/publish scripts.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
This skill helps you set up a Python project for PyPI publishing following modern best practices with pyproject.toml, src layout, and standardized build/publish scripts.
Use this skill when:
pyproject.toml - Modern Python project configurationsrc/{package_name}/ - Source layout with package structure.gitignore - Comprehensive Python gitignoredev-requirements.txt - Development dependencies (includes build/twine for PyPI only)build-publish.sh - Automated build and publish script (PyPI only)LICENSE - License file (Proprietary, MIT, or O'Saasy)README.md - Basic project documentationIMPORTANT: Before creating files, ask the user these questions:
"What is your project name?" (e.g., "pg-podcast-toolkit", "mypackage")
{project-name} (with hyphens, e.g., pg-podcast-toolkit){package_name} (with underscores, e.g., pg_podcast_toolkit)src/{package_name}/"What is the project description?" (brief one-line description for PyPI)
"What is your name?" (for author field)
"What is your email?" (for author field)
"What is your GitHub username?" (for project URLs)
"Will this package be published to PyPI or installed from GitHub?"
git+https:// URL. Skips PyPI-specific artifacts (build, twine, build-publish.sh)."What license do you want to use?" (options: Proprietary, MIT, O'Saasy)
"What Python version should be the minimum requirement?" (default: 3.8)
"What are your initial dependencies?" (optional - comma-separated list, can be empty)
"What keywords describe your project?" (optional - for PyPI searchability)
Create these directories if they don't exist:
{project_root}/
├── src/
│ └── {package_name}/
└── (other files at root)
Create pyproject.toml with the following structure, substituting project-specific values:
[project]
name = "{project-name}"
version = "0.0.1"
authors = [
{ name="{author_name}", email="{author_email}" },
]
description = "{project_description}"
keywords = [{keywords_list}]
readme = "README.md"
requires-python = ">={python_version}"
license = {text = "{license_name} License"}
classifiers = [
"Programming Language :: Python :: 3",
"{license_classifier}",
"Operating System :: OS Independent",
]
dependencies = [
{dependencies_list}
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/{package_name}"]
[project.urls]
Homepage = "https://github.com/{github_username}/{project-name}"
Issues = "https://github.com/{github_username}/{project-name}/issues"
CRITICAL Substitutions:
{project-name} → project name with hyphens (e.g., pg-podcast-toolkit){package_name} → package name with underscores (e.g., pg_podcast_toolkit){author_name} → author's name{author_email} → author's email{project_description} → one-line description{keywords_list} → comma-separated quoted keywords (e.g., "podcasting", "rss", "parser") or empty{python_version} → minimum Python version (e.g., 3.8){license_name} → license name (e.g., MIT, O'Saasy, Proprietary - All Rights Reserved){license_classifier} → Full classifier string:
License :: OSI Approved :: MIT LicenseLicense :: Other/Proprietary LicenseLicense :: Other/Proprietary License{dependencies_list} → comma-separated quoted dependencies (e.g., 'requests', 'beautifulsoup4') or empty{github_username} → GitHub usernameLicense Classifiers Mapping:
Other/Proprietary LicenseMIT LicenseOther/Proprietary License (modified MIT with SaaS restrictions)License Text Handling:
license = {text = "Proprietary - All Rights Reserved"}license = {text = "MIT License"}license = {text = "O'Saasy License"} and create LICENSE file from https://osaasy.dev/Create .gitignore with comprehensive Python patterns:
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
*.manifest
*.spec
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# pipenv
Pipfile.lock
# PEP 582
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
bin/
include/
pyvenv.cfg
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# IDEs
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
Create dev-requirements.txt with development dependencies.
If distribution is PyPI:
build
twine
pytest
black
mypy
If distribution is GitHub:
pytest
black
mypy
These are the tools needed to develop (and for PyPI, build/publish) the package. Add other dev tools as needed (isort, pytest-cov, etc.).
If distribution is GitHub, skip this step entirely.
If distribution is PyPI, create build-publish.sh with venv activation and build/publish commands:
#!/bin/bash
# Build and publish package to PyPI
# Activates virtual environment before running
# Activate virtual environment
source bin/activate
# Clean previous builds
rm -rf dist/*
# Build package
python -m build
# Upload to PyPI
python -m twine upload dist/*
Note: This script follows the convention that the virtual environment is in bin/ at the project root.
Create the basic package structure:
src/{package_name}/__init__.py - Package initialization file:
"""
{project_description}
"""
__version__ = "0.0.1"
If this is a library package, you can add:
# Export main classes/functions here for easier imports
# from .module import ClassName, function_name
# __all__ = ['ClassName', 'function_name']
Create the appropriate LICENSE file based on the user's license choice:
MIT License
Copyright (c) {year} {author_name}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Download the license text from https://osaasy.dev/ and replace <Year> and <Copyright Holder> with appropriate values:
O'Saasy License
Copyright (c) {year} {author_name}
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to use, copy,
modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to
the following conditions:
1. The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
2. The licensee may not use the Software to directly compete with the original
Licensor by offering it to third parties as a hosted, managed, or
Software-as-a-Service (SaaS) product or cloud service.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Proprietary License
Copyright (c) {year} {author_name}. All rights reserved.
This software and associated documentation files (the "Software") are proprietary
and confidential. Unauthorized copying, modification, distribution, or use of
this Software, via any medium, is strictly prohibited.
The Software is provided for use only by authorized licensees under the terms
of a separate written agreement with the copyright holder.
Create README.md with basic project documentation. The Installation and Development sections vary by distribution type.
If distribution is PyPI:
# {project-name}
{project_description}
## Installation
```bash
pip install {project-name}
import {package_name}
# Add usage examples here
# Create virtual environment
python -m venv .
# Activate virtual environment
source bin/activate # On Windows: bin\Scripts\activate
# Install dependencies
pip install -r dev-requirements.txt
pip install -e .
# Make sure you have PyPI credentials configured
# Build and publish to PyPI
./build-publish.sh
{license_name}
{author_name} ({author_email})
**If distribution is GitHub:**
```markdown
# {project-name}
{project_description}
## Installation
### Public repo
```bash
pip install git+https://github.com/{github_username}/{project-name}.git
CR_PAT environment variable)pip install git+https://${CR_PAT}@github.com/{github_username}/{project-name}.git
dependencies = [
"{project-name} @ git+https://{env:CR_PAT}@github.com/{github_username}/{project-name}.git",
]
{project-name} @ git+https://${CR_PAT}@github.com/{github_username}/{project-name}.git
import {package_name}
# Add usage examples here
# Create virtual environment
python -m venv .
# Activate virtual environment
source bin/activate # On Windows: bin\Scripts\activate
# Install dependencies
pip install -r dev-requirements.txt
pip install -e .
{license_name}
{author_name} ({author_email})
## Step 10: Make Script Executable (PyPI only)
**If distribution is GitHub, skip this step.**
**If distribution is PyPI**, run:
```bash
chmod +x build-publish.sh
If not already a git repository:
git init
git add .
git commit -m "Initial project structure for PyPI package"
Inform the user of the next steps.
If distribution is PyPI:
Install development dependencies:
source bin/activate
pip install -r dev-requirements.txt
Install package in development mode:
pip install -e .
Write your code in src/{package_name}/
Update version in pyproject.toml before publishing
Configure PyPI credentials (one-time setup):
# Create ~/.pypirc with your PyPI token
Build and publish:
./build-publish.sh
If distribution is GitHub:
Install development dependencies:
source bin/activate
pip install -r dev-requirements.txt
Install package in development mode:
pip install -e .
Write your code in src/{package_name}/
Update version in pyproject.toml before each release
Referencing this library from other projects:
pyproject.toml:
dependencies = [
"{project-name} @ git+https://{env:CR_PAT}@github.com/{github_username}/{project-name}.git",
]
requirements.txt:
{project-name} @ git+https://${CR_PAT}@github.com/{github_username}/{project-name}.git
This pattern follows these principles:
src/ directory for better separationbin/ at project rootUser: "Set up a Python package for PyPI" Claude: "What is your project name?" User: "awesome-lib" Claude: [Asks remaining questions, user selects PyPI for distribution] Claude:
User: "Set up a private Python library" Claude: "What is your project name?" User: "arcana-models" Claude: [Asks remaining questions, user selects GitHub for distribution] Claude: