Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
eb95903
chore: ruff format
SebastianoTaddei Apr 10, 2026
79ebee4
test: disabled docs and visualisers tests
SebastianoTaddei Apr 10, 2026
6a123cb
chore: change project structure to `src` based
SebastianoTaddei Apr 10, 2026
e43c14f
feat: modernised pyproject.toml
SebastianoTaddei Apr 10, 2026
c7a88dd
chore: ruff
SebastianoTaddei Apr 13, 2026
a7482ea
feat: started adding `uv` and `pre-commit`
SebastianoTaddei Apr 13, 2026
d68fbe4
chore: added basic pre-commit hooks
SebastianoTaddei Apr 14, 2026
3bf9d52
feat: updated codecov action
SebastianoTaddei Apr 14, 2026
c70ebfa
feat: removed pin on `uv` version
SebastianoTaddei Apr 14, 2026
40b152b
feat: updated run tests action
SebastianoTaddei Apr 14, 2026
f33d9d7
feat: added linting via ruff
SebastianoTaddei Apr 14, 2026
e1801cf
chore: ruff check --fix
SebastianoTaddei Apr 14, 2026
6f23f44
feat: added vscode config
SebastianoTaddei Apr 14, 2026
baafd1d
feat: cleanup .gitignore
SebastianoTaddei Apr 14, 2026
5d11934
docs: contributing
SebastianoTaddei Apr 14, 2026
b3c7ef0
docs: updated contributing file
SebastianoTaddei Apr 15, 2026
e649180
feat: avoid running tests if no python file was changed
SebastianoTaddei Apr 15, 2026
72f1548
feat: added patch testing
SebastianoTaddei Apr 15, 2026
24fbb76
feat: added back ruff check
SebastianoTaddei Apr 15, 2026
b9323f6
feat: updated publish workflow
SebastianoTaddei Apr 15, 2026
19079f0
chore: renamed for pypi/testpypi compatibility
SebastianoTaddei Apr 16, 2026
856710e
feat: added publish job name
SebastianoTaddei Apr 16, 2026
c5442ff
feat: added testpypi index
SebastianoTaddei Apr 16, 2026
bb87dc3
chore: improved step names
SebastianoTaddei Apr 16, 2026
27c39d9
feat: detect prerelase
SebastianoTaddei Apr 16, 2026
a66a0e8
feat: bumped version
SebastianoTaddei Apr 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 13 additions & 25 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,29 @@
name: Coverage (Codecov)

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop" ]
branches: ["main", "develop"]

jobs:
test:
name: Run tests and upload coverage
coverage:
name: Compute coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up Python 3.10
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.10"
enable-cache: true

- name: Install pandoc
uses: pandoc/actions/setup@v1

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install coverage
python -m pip install sphinx myst_parser sphinx-rtd-theme nbsphinx pandoc jupyter jupyterlab
pip install -e .
- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Tests with coverage
run: |
coverage run --omit='./results/*','./docs/*','./examples/*' -m unittest discover tests
coverage xml -o coverage.xml
run: uv run pytest --cov=nnodely --cov-branch --cov-report=xml tests

- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
uses: codecov/codecov-action@v6
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
189 changes: 80 additions & 109 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -1,130 +1,101 @@
name: Publish New nnodely Release
name: Publish

on:
push:
tags:
- "v*" # Push events to matching v*, i.e., v1.0, v20.15.10
- "v*"

jobs:
check-tag-version:
name: Check tag version equal to file version
publish:
name: Build and publish to both TestPyPi and PyPi
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Extract tag version
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Validate tag matches project version
run: |
TAG_NAME="${{ github.ref_name }}"
TAG_VERSION=$(echo $TAG_NAME | sed 's/v//')
TAG_VERSION="${GITHUB_REF_NAME#v}"
PROJ_VERSION=$(uv version --short)

echo "Tag version: $TAG_VERSION"
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV
- name: Extract file version
run: |
FILE_VERSION=$(awk -F"'" '/^__version__/ {print $2}' nnodely/__init__.py)
echo "File version: $FILE_VERSION"
echo "FILE_VERSION=$FILE_VERSION" >> $GITHUB_ENV
- name: Show tag and file versions
run: |
echo "The tag version: ${{ env.TAG_VERSION }}"
echo "The file version: ${{ env.FILE_VERSION }}"
- name: Check if tag and file versions match
if: ${{ env.TAG_VERSION != env.FILE_VERSION }}
run: |
echo "The tag version ${{ env.TAG_VERSION }} does not match file version ${{ env.FILE_VERSION }}"
exit 1
echo "Project version: $PROJ_VERSION"

build:
name: Build distribution of tagged version
needs:
- check-tag-version
runs-on: ubuntu-latest
if [ "$TAG_VERSION" != "$PROJ_VERSION" ]; then
echo "Mismatch: tag=$TAG_VERSION project=$PROJ_VERSION"
exit 1
fi

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish to PyPI
needs:
- build
- name: Build
run: uv build

runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/nnodely # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
# Check that basic features work and we didn't miss to include crucial files
- name: Basic test (wheel)
run: uv run --isolated --no-project --with dist/*.whl python -c "import nnodely"

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish nnodely to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Basic test (source distribution)
run: uv run --isolated --no-project --with dist/*.tar.gz python -c "import nnodely"

- name: TestPyPi publish
run: uv publish --index testpypi

- name: PyPI publish
run: uv publish

- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/

github-release:
name: >-
Sign the Python with Sigstore and upload them to GitHub Release
needs:
- publish-to-pypi
name: Sign the Python with Sigstore and upload them to GitHub Release
runs-on: ubuntu-latest
needs:
- publish

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
contents: write
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Get the branch version
run: |
TAG_NAME="${{ github.ref_name }}"
TAG_MESSAGE=${{ github.event.workflow_run.head_commit.message }}
echo "Tag message: $TAG_MESSAGE"
echo "TAG_MESSAGE=$TAG_MESSAGE" >> $GITHUB_ENV
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ github.token }}
tag: ${{ github.ref_name }}
run: |
echo "The branch version: $tag"
gh release create $tag --title "$tag" --repo ${{ github.repository }} --notes "${{ env.TAG_MESSAGE }}"
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
tag: ${{ github.ref_name }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload $tag dist/** --repo ${{ github.repository }}
- uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/

- name: Sign artifacts
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: |
./dist/*.tar.gz
./dist/*.whl
- name: Detect prerelease
id: version
run: |
VERSION="${GITHUB_REF_NAME#v}"

if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PRERELEASE=false" >> "$GITHUB_OUTPUT"
else
echo "PRERELEASE=true" >> "$GITHUB_OUTPUT"
fi

- name: Release
uses: softprops/action-gh-release@v3
if: github.ref_type == 'tag'
with:
files: |
dist/*.tar.gz
dist/*.whl
generate_release_notes: true
prerelease: ${{ steps.version.outputs.PRERELEASE }}
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on:
pull_request:
branches: ["main", "develop"]

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Lint
run: uv run ruff check
50 changes: 14 additions & 36 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,29 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Run Tests

on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main", "develop"]
branches: ["main", "develop"]

jobs:
build:

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [ "3.10", "3.11", "3.12"]
architecture: ['x64', 'x86']
python-version: ["3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install pandoc
uses: pandoc/actions/setup@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
python -m pip install sphinx myst_parser sphinx-rtd-theme nbsphinx pandoc jupyter jupyterlab
pip install -e .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest



- uses: actions/checkout@v6

- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run tests
run: uv run pytest tests
Loading
Loading