Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
18 changes: 0 additions & 18 deletions .coveragerc

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

3 changes: 0 additions & 3 deletions .gitconfig

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# GitHub Actions configuration **EXAMPLE**,
# MODIFY IT ACCORDING TO YOUR NEEDS!
# Reference: https://docs.github.com/en/actions

name: ci

on:
release:
types: [published]
push:
# Avoid using all the resources/limits available by checking only
# relevant branches and tags. Other branches can be checked via PRs.
branches: [main]
tags: ['v?[0-9]+.[0-9]+.?[0-9]?*'] # Match tags that resemble a version
pull_request: # Run in every PR
workflow_dispatch: # Allow manually triggering the workflow
schedule:
# Run roughly every 15 days at 00:00 UTC
# (useful to check if updates on dependencies break the package)
- cron: '0 0 1,16 * *'

permissions:
contents: read

concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
wheel-distribution: ${{ steps.wheel-distribution.outputs.path }}
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0} # deep clone for setuptools-scm
- uses: actions/setup-python@v4
id: setup-python
with: {python-version: "3.11"}
- name: Run static analysis and format checkers
run: pipx run pre-commit run --all-files --show-diff-on-failure
- name: Build package distribution files
run: >-
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
tox -e clean,build
- name: Record the path of wheel distribution
id: wheel-distribution
run: echo "path=$(ls dist/*.whl)" >> $GITHUB_OUTPUT
- name: Store the distribution files for use in other stages
# `tests` and `publish` will use the same pre-built distributions,
# so we make sure to release the exact same package that was tested
uses: actions/upload-artifact@v4
with:
name: python-distribution-files
path: dist/
retention-days: 1

test:
needs: prepare
strategy:
matrix:
python:
- "3.9" # oldest Python supported by PSF
- "3.11" # newest Python that is stable
platform:
- ubuntu-latest
# - macos-latest
- windows-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
id: setup-python
with:
python-version: ${{ matrix.python }}
- name: Retrieve pre-built distribution files
uses: actions/download-artifact@v4
with: {name: python-distribution-files, path: dist/}
- name: Run tests
run: >-
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
tox --installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
-- -rFEx --durations 10 --color yes # pytest args
- name: Generate coverage report
run: pipx run coverage[toml] lcov -o coverage.lcov
- name: Upload partial coverage report
uses: coverallsapp/github-action@master
with:
path-to-lcov: coverage.lcov
github-token: ${{ secrets.github_token }}
flag-name: ${{ matrix.platform }} - py${{ matrix.python }}
parallel: true

finalize:
needs: test
runs-on: ubuntu-latest
steps:
- name: Finalize coverage report
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

publish:
needs: finalize
if: ${{ (github.event_name == 'push' && contains(github.ref, 'refs/tags/')) || (github.event_name == 'release' && github.event.action == 'published') }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with: {python-version: "3.11"}
- name: Retrieve pre-built distribution files
uses: actions/download-artifact@v4
with: {name: python-distribution-files, path: dist/}
# - name: Publish Package (TEST)
# env:
# # TODO: Set your PYPI_TOKEN as a secret using GitHub UI
# # - https://pypi.org/help/#apitoken
# # - https://docs.github.com/en/actions/security-guides/encrypted-secrets
# TWINE_REPOSITORY: pypi
# TWINE_USERNAME: __token__
# TWINE_PASSWORD: ${{ secrets.PYPI_TEST_TOKEN }}
# run: pipx run tox -e publish
- name: Publish Package
env:
# TODO: Set your PYPI_TOKEN as a secret using GitHub UI
# - https://pypi.org/help/#apitoken
# - https://docs.github.com/en/actions/security-guides/encrypted-secrets
TWINE_REPOSITORY: pypi
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: pipx run tox -e publish
44 changes: 0 additions & 44 deletions .github/workflows/pythonapp.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/release_to_pypi.yml

This file was deleted.

5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,7 @@ scripts/datasets_path.txt
env
nestmodel.egginfo
Untitled.ipynb
Untitled1.ipynb
Untitled*.ipynb
csvs
demo/images
experiments
68 changes: 68 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
exclude: '^docs/conf.py'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-ast
- id: check-json
- id: check-merge-conflict
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: mixed-line-ending
args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows

## If you want to automatically "modernize" your Python code:
# - repo: https://github.com/asottile/pyupgrade
# rev: v3.7.0
# hooks:
# - id: pyupgrade
# args: ['--py37-plus']

## If you want to avoid flake8 errors due to unused vars or imports:
# - repo: https://github.com/PyCQA/autoflake
# rev: v2.1.1
# hooks:
# - id: autoflake
# args: [
# --in-place,
# --remove-all-unused-imports,
# --remove-unused-variables,
# ]

# - repo: https://github.com/PyCQA/isort
# rev: 5.13.2
# hooks:
# - id: isort

- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
language_version: python3

## If like to embrace black styles even in the docs:
# - repo: https://github.com/asottile/blacken-docs
# rev: v1.13.0
# hooks:
# - id: blacken-docs
# additional_dependencies: [black]

- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject]
## You can add flake8 plugins via `additional_dependencies`:
# additional_dependencies: [flake8-bugbear]

## Check for misspells in documentation files:
# - repo: https://github.com/codespell-project/codespell
# rev: v2.2.5
# hooks:
# - id: codespell
8 changes: 0 additions & 8 deletions .pylintrc

This file was deleted.

Loading