Skip to content

Commit b49d7db

Browse files
author
roberto_esaclear
committed
chore: update Python version requirements, add flake8 to dev dependencies, and set up CI/CD workflows for testing and publishing
1 parent af45e7c commit b49d7db

5 files changed

Lines changed: 74 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# .github/workflows/ci.yml
2+
name: Python CI
3+
4+
on:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11"] # Specify Python versions to test against
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
25+
- name: Install PDM
26+
run: pip install pdm
27+
28+
- name: Install dependencies
29+
run: pdm install -G all # Install all dependencies including optional and dev
30+
31+
- name: Lint with flake8
32+
run: |
33+
# stop the build if there are Python syntax errors or undefined names
34+
pdm run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+
pdm run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+
38+
- name: Test with pytest
39+
run: |
40+
pdm run pytest

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Upload Python Package to PyPI when a Release is Created
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
pypi-publish:
9+
name: Publish release to PyPI
10+
runs-on: ubuntu-latest
11+
environment:
12+
name: pypi
13+
url: https://pypi.org/p/phidown
14+
permissions:
15+
id-token: write
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.x"
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install setuptools wheel
26+
- name: Build package
27+
run: |
28+
python setup.py sdist bdist_wheel # Could also be python -m build
29+
- name: Publish package distributions to PyPI
30+
uses: pypa/gh-action-pypi-publish@release/v1

pdm.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies = [
1313
"ipykernel>=6.29.5"
1414
]
1515

16-
requires-python = ">=3.8"
16+
requires-python = ">=3.9"
1717

1818
[project.optional-dependencies]
1919
viz = [
@@ -23,6 +23,7 @@ viz = [
2323
dev = [
2424
"pytest>=8.0.0",
2525
"pytest-mock>=3.10.0",
26+
"flake8>=7.0.0", # Add flake8
2627
]
2728

2829
[build-system]

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The following collections are currently available:
113113
---
114114

115115
## Prerequisites
116-
- Python 3.8 or higher
116+
- Python 3.9 or higher
117117

118118
---
119119

0 commit comments

Comments
 (0)