-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modernize Codebase and Enhance CI Workflow (#67)
Updated Type Hints: Used pyupgrade with --py39-plus and --py310-plus flags to upgrade type hints to Python 3.9+ and 3.10+ syntax. Enforced Double Quotes: Removed skip-string-normalization = true from the black configuration in pyproject.toml. Reran black via pre-commit hooks to enforce double quotes in the codebase. Refactored Dependency Management: Split requirements.txt into requirements.txt (runtime dependencies) and requirements-dev.txt (development dependencies). Enhanced CI Workflow: Integrated pre-commit hooks into the CI pipeline to enforce code quality checks automatically. Added pip caching to the CI workflow to speed up dependency installation. Automated Package Publishing: Added a publish.yml GitHub Actions workflow to automate publishing to PyPI. The workflow triggers on release creation or manual dispatch, builds the package, and publishes it to PyPI using twine.
- Loading branch information
1 parent
3c5e7e9
commit 848b9dc
Showing
21 changed files
with
398 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ["3.10", "3.11", "3.12", "3.13"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Cache pip | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements*.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
pip install --upgrade pip | ||
pip install -r requirements-dev.txt | ||
- name: Run tests | ||
run: | | ||
pytest | ||
# Run pre-commit only on Python 3.13 + ubuntu. | ||
- name: Run pre-commit hooks | ||
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
pre-commit run --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: [created] # Trigger only when a release is created | ||
workflow_dispatch: # Allows manual triggering of the workflow | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Check out the code | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up Python | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.13 | ||
|
||
# Step 3: Install dependencies for building and publishing | ||
- name: Install build tools | ||
run: | | ||
pip install --upgrade pip | ||
pip install build twine | ||
# Step 4: Build the package | ||
- name: Build the package | ||
run: | | ||
python -m build | ||
# Step 5: Publish to PyPI | ||
- name: Publish to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
python -m twine check dist/* | ||
python -m twine upload --skip-existing dist/* |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,3 @@ filter_files = true | |
|
||
[tool.black] | ||
line-length = 119 | ||
skip-string-normalization = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
-r requirements.txt | ||
black | ||
djlint | ||
pre-commit | ||
pylint | ||
pytest | ||
pytest-asyncio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.