Skip to content

Commit a319dea

Browse files
committed
Initial commit: pyhatch v0.1.0
0 parents  commit a319dea

42 files changed

Lines changed: 11829 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# =============================================================================
2+
# pyinit - GitHub Actions CI Workflow
3+
# =============================================================================
4+
# Generated by pyinit v0.1.0
5+
#
6+
# This workflow runs on every push and pull request to ensure code quality.
7+
# It performs the following checks:
8+
# - Linting with ruff
9+
# - Formatting with ruff
10+
# - Type checking with basedpyright
11+
# - Testing with pytest across multiple Python versions
12+
# =============================================================================
13+
14+
name: CI
15+
16+
on:
17+
push:
18+
branches: [main, master]
19+
pull_request:
20+
branches: [main, master]
21+
# Allow manual triggering
22+
workflow_dispatch:
23+
24+
# Cancel in-progress runs on new commits to same branch
25+
concurrency:
26+
group: ${{ github.workflow }}-${{ github.ref }}
27+
cancel-in-progress: true
28+
29+
env:
30+
# Force color output in CI
31+
FORCE_COLOR: "1"
32+
# uv settings
33+
UV_SYSTEM_PYTHON: "1"
34+
35+
jobs:
36+
# ===========================================================================
37+
# Quality Checks (fast, single Python version)
38+
# ===========================================================================
39+
quality:
40+
name: Code Quality
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Checkout repository
45+
uses: actions/checkout@v4
46+
47+
- name: Set up uv
48+
uses: astral-sh/setup-uv@v4
49+
with:
50+
version: "latest"
51+
enable-cache: true
52+
53+
- name: Install Python 3.11
54+
run: uv python install 3.11
55+
56+
- name: Install dependencies
57+
run: uv sync --dev
58+
59+
- name: Run ruff linter
60+
run: uv run ruff check . --output-format=github
61+
62+
- name: Run ruff formatter
63+
run: uv run ruff format --check .
64+
65+
- name: Run type checker
66+
run: uv run basedpyright
67+
68+
# ===========================================================================
69+
# Tests (multiple Python versions)
70+
# ===========================================================================
71+
test:
72+
name: Test (Python ${{ matrix.python-version }})
73+
runs-on: ubuntu-latest
74+
needs: quality # Only run tests if quality checks pass
75+
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
python-version:
80+
- "3.11"
81+
- "3.12"
82+
- "3.13"
83+
84+
steps:
85+
- name: Checkout repository
86+
uses: actions/checkout@v4
87+
88+
- name: Set up uv
89+
uses: astral-sh/setup-uv@v4
90+
with:
91+
version: "latest"
92+
enable-cache: true
93+
94+
- name: Install Python ${{ matrix.python-version }}
95+
run: uv python install ${{ matrix.python-version }}
96+
97+
- name: Install dependencies
98+
run: uv sync --dev
99+
100+
- name: Run tests
101+
run: uv run pytest --cov-report=xml
102+
103+
- name: Upload coverage to Codecov
104+
if: matrix.python-version == '3.11'
105+
uses: codecov/codecov-action@v4
106+
with:
107+
file: ./coverage.xml
108+
fail_ci_if_error: false
109+
env:
110+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
111+
112+
# ===========================================================================
113+
# All Checks Passed
114+
# ===========================================================================
115+
# This job is used as a required status check in branch protection rules.
116+
# It only succeeds if all other jobs pass.
117+
all-checks:
118+
name: All Checks Passed
119+
runs-on: ubuntu-latest
120+
needs: [quality, test]
121+
if: always()
122+
123+
steps:
124+
- name: Check all jobs passed
125+
run: |
126+
if [[ "${{ needs.quality.result }}" != "success" ]] || \
127+
[[ "${{ needs.test.result }}" != "success" ]]; then
128+
echo "One or more jobs failed"
129+
exit 1
130+
fi
131+
echo "All checks passed! ✅"

.github/workflows/publish.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# =============================================================================
2+
# pyinit - PyPI Publishing Workflow
3+
# =============================================================================
4+
# This workflow automatically publishes to PyPI when a GitHub release is created.
5+
# It uses trusted publishing (OIDC) - no API tokens needed!
6+
#
7+
# Setup required:
8+
# 1. Go to PyPI → Your Projects → pyinit → Settings → Publishing
9+
# 2. Add GitHub as a trusted publisher with:
10+
# - Owner: Technical-1
11+
# - Repository: pyinit
12+
# - Workflow: publish.yml
13+
# =============================================================================
14+
15+
name: Publish to PyPI
16+
17+
on:
18+
release:
19+
types: [published]
20+
# Allow manual triggering for testing
21+
workflow_dispatch:
22+
23+
jobs:
24+
# ===========================================================================
25+
# Build Package
26+
# ===========================================================================
27+
build:
28+
name: Build Distribution
29+
runs-on: ubuntu-latest
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: "3.12"
39+
40+
- name: Install build tools
41+
run: pip install build
42+
43+
- name: Build package
44+
run: python -m build
45+
46+
- name: Upload distribution artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: python-package-distributions
50+
path: dist/
51+
52+
# ===========================================================================
53+
# Publish to TestPyPI (for testing)
54+
# ===========================================================================
55+
publish-testpypi:
56+
name: Publish to TestPyPI
57+
needs: build
58+
runs-on: ubuntu-latest
59+
if: github.event_name == 'workflow_dispatch'
60+
61+
environment:
62+
name: testpypi
63+
url: https://test.pypi.org/p/pyinit
64+
65+
permissions:
66+
id-token: write
67+
68+
steps:
69+
- name: Download distribution artifacts
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: python-package-distributions
73+
path: dist/
74+
75+
- name: Publish to TestPyPI
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
with:
78+
repository-url: https://test.pypi.org/legacy/
79+
80+
# ===========================================================================
81+
# Publish to PyPI (production)
82+
# ===========================================================================
83+
publish-pypi:
84+
name: Publish to PyPI
85+
needs: build
86+
runs-on: ubuntu-latest
87+
if: github.event_name == 'release'
88+
89+
environment:
90+
name: pypi
91+
url: https://pypi.org/p/pyinit
92+
93+
permissions:
94+
id-token: write
95+
96+
steps:
97+
- name: Download distribution artifacts
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: python-package-distributions
101+
path: dist/
102+
103+
- name: Publish to PyPI
104+
uses: pypa/gh-action-pypi-publish@release/v1
105+
106+
# ===========================================================================
107+
# Create GitHub Release Assets
108+
# ===========================================================================
109+
github-release:
110+
name: Upload Release Assets
111+
needs: [build, publish-pypi]
112+
runs-on: ubuntu-latest
113+
if: github.event_name == 'release'
114+
115+
permissions:
116+
contents: write
117+
118+
steps:
119+
- name: Download distribution artifacts
120+
uses: actions/download-artifact@v4
121+
with:
122+
name: python-package-distributions
123+
path: dist/
124+
125+
- name: Upload to GitHub Release
126+
uses: softprops/action-gh-release@v1
127+
with:
128+
files: dist/*

.gitignore

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# =============================================================================
2+
# pyinit - Git Ignore File
3+
# =============================================================================
4+
5+
# -----------------------------------------------------------------------------
6+
# Python
7+
# -----------------------------------------------------------------------------
8+
__pycache__/
9+
*.py[cod]
10+
*$py.class
11+
*.so
12+
.Python
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
29+
# -----------------------------------------------------------------------------
30+
# Virtual Environments
31+
# -----------------------------------------------------------------------------
32+
.venv/
33+
venv/
34+
ENV/
35+
env/
36+
.uv/
37+
38+
# -----------------------------------------------------------------------------
39+
# Testing
40+
# -----------------------------------------------------------------------------
41+
.pytest_cache/
42+
.coverage
43+
.coverage.*
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
51+
# -----------------------------------------------------------------------------
52+
# Type Checking
53+
# -----------------------------------------------------------------------------
54+
.mypy_cache/
55+
.pytype/
56+
.pyre/
57+
.basedpyright/
58+
59+
# -----------------------------------------------------------------------------
60+
# Linting
61+
# -----------------------------------------------------------------------------
62+
.ruff_cache/
63+
64+
# -----------------------------------------------------------------------------
65+
# IDEs and Editors
66+
# -----------------------------------------------------------------------------
67+
.idea/
68+
.vscode/
69+
*.swp
70+
*.swo
71+
*~
72+
.project
73+
.pydevproject
74+
.settings/
75+
76+
# -----------------------------------------------------------------------------
77+
# OS Files
78+
# -----------------------------------------------------------------------------
79+
.DS_Store
80+
.DS_Store?
81+
._*
82+
.Spotlight-V100
83+
.Trashes
84+
ehthumbs.db
85+
Thumbs.db
86+
87+
# -----------------------------------------------------------------------------
88+
# Build Artifacts
89+
# -----------------------------------------------------------------------------
90+
*.manifest
91+
*.spec
92+
93+
# -----------------------------------------------------------------------------
94+
# Installer logs
95+
# -----------------------------------------------------------------------------
96+
pip-log.txt
97+
pip-delete-this-directory.txt
98+
99+
# -----------------------------------------------------------------------------
100+
# Distribution
101+
# -----------------------------------------------------------------------------
102+
MANIFEST
103+
104+
# -----------------------------------------------------------------------------
105+
# Jupyter Notebook
106+
# -----------------------------------------------------------------------------
107+
.ipynb_checkpoints
108+
109+
# -----------------------------------------------------------------------------
110+
# pyenv
111+
# -----------------------------------------------------------------------------
112+
.python-version
113+
114+
# -----------------------------------------------------------------------------
115+
# Environments
116+
# -----------------------------------------------------------------------------
117+
.env
118+
.env.local
119+
*.local
120+
121+
# -----------------------------------------------------------------------------
122+
# Backup Files
123+
# -----------------------------------------------------------------------------
124+
.pyinit_backup_*/

0 commit comments

Comments
 (0)