Skip to content

Commit

Permalink
Merge pull request #22 from GavinHuttley/develop
Browse files Browse the repository at this point in the history
Maintenance
  • Loading branch information
GavinHuttley authored Oct 7, 2024
2 parents daea69c + 669ec43 commit a290417
Show file tree
Hide file tree
Showing 8 changed files with 371 additions and 274 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
time: "19:00"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
time: "19:00"
open-pull-requests-limit: 10
118 changes: 118 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Release

on: [workflow_dispatch]

jobs:
test:
name: "Test on Python ${{ matrix.python-version }} (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0

- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"

- name: "Installs for ${{ matrix.python-version }}"
run: |
pip install --upgrade pip
pip install nox uv
- name: "Run nox for Python ${{ matrix.python-version }}"
run: "nox -db uv -s test-${{ matrix.python-version }}"

docbuild:
name: "Build docs"
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0

- uses: "actions/setup-python@v5"
with:
python-version: "3.12"

- name: "Installs for docs"
run: |
pip install --upgrade pip uv
python -m uv pip install ".[doc]"
- name: "making docs"
run: |
cd doc
make html
build:
name: Build wheel and sdist
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install build dependency
run: |
pip install build
pip install --upgrade pip
- name: Build sdist and wheel
run: python -m build --wheel --sdist

- name: Upload sdist and wheel
uses: actions/upload-artifact@v4
with:
name: scitrack-wheel-sdist
path: |
./dist/*.whl
./dist/*.tar.gz
release_test:
name: Release to Test PyPI
needs: [build, docbuild]
environment: release_test
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- name: Download sdist and wheel
uses: actions/download-artifact@v4
with:
name: scitrack-wheel-sdist
path: ./dist

- name: Publish package distributions to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

release:
name: Release to PyPI
needs: release_test
environment: release
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- name: Download sdist and wheel
uses: actions/download-artifact@v4
with:
name: scitrack-wheel-sdist
path: ./dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
43 changes: 25 additions & 18 deletions .github/workflows/testing_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,56 @@ name: CI

on:
push:
branches: [ "develop" ]
branches-ignore:
- master
pull_request:
branches: [ "develop" ]
branches-ignore:
- master

jobs:
tests:
name: "Python ${{ matrix.python-version }}"
name: "Python ${{ matrix.python-version }} (${{ matrix.os }})"
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
fetch-depth: 0

# Setup env
- uses: "actions/setup-python@v3"
with:
python-version: "${{ matrix.python-version }}"

- name: "Installs for ${{ matrix.python-version }}"
run: |
python -VV
python -m site
python -m pip install --upgrade pip setuptools wheel flit
python -m pip install --upgrade nox
python --version
pip install --upgrade pip wheel setuptools flit
pip install --upgrade nox
- name: "Run nox for ${{ matrix.python-version }}"
run: "nox -s test-${{ matrix.python-version }}"
run: "nox -s test-${{ matrix.python-version }} -- --cov-report lcov:lcov-${{matrix.os}}-${{matrix.python-version}}.lcov --cov-report term --cov-append --cov scitrack"

- name: Coveralls Parallel
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
parallel: true
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.test_number }}
path-to-lcov: "tests/lcov-${{ matrix.python-version }}.info"
flag-name: run-${{matrix.python-version}}-${{matrix.os}}
file: "tests/lcov-${{matrix.os}}-${{matrix.python-version}}.lcov"

finish:
name: "Finish Coveralls"
needs: tests
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
parallel-finished: true
11 changes: 6 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
|Build Status| |coverall| |Using Black Formatting| |Python 3.8+|
|Status| |coverall| |Using Ruff| |Python 3.9+|

.. |Build Status| image:: https://github.com/HuttleyLab/scitrack/workflows/CI/badge.svg?branch=develop
.. |Status| image:: https://github.com/HuttleyLab/scitrack/workflows/CI/badge.svg?branch=develop
:target: https://github.com/HuttleyLab/scitrack/actions?workflow=CI
:alt: CI Status

.. |coverall| image:: https://coveralls.io/repos/github/GavinHuttley/scitrack/badge.svg?branch=develop
:target: https://coveralls.io/github/GavinHuttley/scitrack?branch=develop

.. |Using Black Formatting| image:: https://img.shields.io/badge/code%20style-black-000000.svg
.. |Using Ruff| image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff

.. |Python 3.8+| image:: https://img.shields.io/badge/python-3.8+-blue.svg
:target: https://www.python.org/downloads/release/python-380/
.. |Python 3.9+| image:: https://img.shields.io/badge/python-3.9+-blue.svg
:target: https://www.python.org/downloads/release/python-390/


##################
Expand Down
14 changes: 4 additions & 10 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import nox


dependencies = "numpy", "click", "pytest", "pytest-cov"


@nox.session(python=[f"3.{v}" for v in range(8, 11)])
@nox.session(python=[f"3.{v}" for v in range(9, 13)])
def test(session):
session.install(*dependencies)
session.install(".")
session.install(".[test]")
session.chdir("tests")
session.run(
"pytest",
"-s",
"-x",
"--cov-report",
f"lcov:lcov-{session.python}.info",
"--cov",
"scitrack",
*session.posargs,
)
118 changes: 89 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ classifiers = [
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Software Development :: Libraries :: Python Modules",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
requires-python = ">=3.8"
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.9"

[tool.flit.sdist]
include = ["src/*", "pyproject.toml", "*.rst"]
Expand All @@ -35,34 +37,92 @@ Documentation = "https://github.com/HuttleyLab/scitrack"

[tool.flit.metadata.requires-extra]
test = [
"black",
"isort",
"numpy",
"pytest",
"pytest-cov",
"ruff==0.6.9",
"nox"]

[tool.black]
[tool.ruff]
exclude = [
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"build",
"dist",
"site-packages",
"venv",
]

# Same as Black.
line-length = 88
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.nox
| \.venv
| _build
| build
| dist
| tests/data
)/
'''

[tool.isort]
atomic=true
force_grid_wrap=0
include_trailing_comma=true
lines_after_imports=2
lines_between_types=1
multi_line_output=3
use_parentheses=true
indent-width = 4

target-version = "py39"

[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["ALL"]
ignore = ["EXE002", "FA100", "E501", "D"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"INP001", # __init__.py files are not required...
"ANN",
"N802",
"N803"
]
"noxfile.py" = [
"S101", # asserts allowed in tests...
"INP001", # __init__.py files are not required...
"ANN",
"N802",
"N803"
]

[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "lf"
docstring-code-format = true

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
Loading

0 comments on commit a290417

Please sign in to comment.