Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 7 additions & 10 deletions .github/workflows/ci-cogent3-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@ jobs:
with:
fetch-depth: 0

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

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

- name: Install the cogent3 dev branch
- name: Install project + test group
run: |
uv pip install "cogent3 @ git+https://github.com/cogent3/cogent3.git@develop" --system
uv venv
uv pip install -e . --group test

- name: Install the project
run: |
uv pip install ".[test]" --system
- name: Override cogent3 with dev branch
run: uv pip install --refresh "cogent3 @ git+https://github.com/cogent3/cogent3.git@develop"

- name: Run tests
run: uv run pytest tests
24 changes: 9 additions & 15 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
name: Lint code using ruff
# modified from https://towardsdatascience.com/black-with-git-hub-actions-4ffc5c61b5fe
# caching https://stackoverflow.com/questions/59127258/how-can-i-use-pip-cache-in-github-actions
# black integration https://black.readthedocs.io/en/stable/integrations/github_actions.html
# isort integration https://pycqa.github.io/isort/docs/configuration/github_action.html

on:
push:
Expand All @@ -15,19 +11,17 @@ jobs:
if: github.repository == 'HuttleyLab/MutationMotif'
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tomli
export ruff_version=$(python -c 'import tomli; print([line for line in tomli.load(open("pyproject.toml","rb"))["project"]["optional-dependencies"]["dev"] if "ruff" in line][0])')
echo "Click version: ruff_version"
python -m pip install $ruff_version
enable-cache: true
cache-dependency-glob: "pyproject.toml"
python-version: "3.14"

- name: Format code using ruff
run: ruff check --fix-only . && ruff format .
run: uv run --group dev nox -s fmt

- name: Commit changes
uses: EndBug/add-and-commit@v10
with:
Expand Down
34 changes: 10 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,15 @@ jobs:
with:
fetch-depth: 0

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

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
python-version: "${{ matrix.python-version }}"

- name: "Installs for ${{ matrix.python-version }}"
run: |
uv venv venv -p python${{ matrix.python-version }}
uv tool install -p venv nox

- name: "Run nox for Python ${{ matrix.python-version }}"
run: "nox -db uv -s test-${{ matrix.python-version }}"
- name: "Run tests via nox for Python ${{ matrix.python-version }}"
run: uv run --group test nox -db uv -s test-${{ matrix.python-version }}

build:
name: Build wheel and sdist
Expand All @@ -41,18 +33,12 @@ jobs:
- uses: actions/checkout@v6
with:
fetch-depth: 0

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

- name: Install build dependency
run: |
pip install build
pip install --upgrade pip

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Build sdist and wheel
run: python -m build --wheel --sdist
run: uv build

- name: Upload sdist and wheel
uses: actions/upload-artifact@v7
Expand All @@ -61,7 +47,7 @@ jobs:
path: |
./dist/*.whl
./dist/*.tar.gz

release_test:
name: Release to Test PyPI
needs: [build]
Expand All @@ -81,7 +67,7 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

release:
name: Release to PyPI
needs: release_test
Expand All @@ -98,4 +84,4 @@ jobs:
path: ./dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
uses: pypa/gh-action-pypi-publish@release/v1
14 changes: 3 additions & 11 deletions .github/workflows/testing_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,15 @@ jobs:
with:
fetch-depth: 0

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

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
python-version: "${{ matrix.python-version }}"

- name: "Installs for ${{ matrix.python-version }}"
run: |
uv venv venv -p python${{ matrix.python-version }}
uv tool install -p venv nox

- name: "Run nox for ${{ matrix.python-version }}"
run: "nox -db uv -s test-${{ matrix.python-version }} -- --cov-report lcov:lcov-${{matrix.os}}-${{matrix.python-version}}.lcov --cov-report term --cov-append --cov mutation_motif"
- name: "Run tests via nox for ${{ matrix.python-version }}"
run: uv run --group test nox -db uv -s test-${{ matrix.python-version }} -- --cov-report lcov:lcov-${{matrix.os}}-${{matrix.python-version}}.lcov --cov-report term --cov-append --cov mutation_motif

- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ tests/draw_results
.*.swp

# project specific
working/*
working/*

#Ignore vscode AI rules
.github/instructions/codacy.instructions.md

uv.lock
13 changes: 10 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@nox.session(python=[f"3.{v}" for v in _py_versions])
def test(session):
session.install("-e.[test]")
session.install("-e", ".", "--group", "test")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Using --group in session.install is likely incompatible with the underlying installer.

session.install delegates directly to pip (or uv pip install), which don’t understand --group in this context, so this call is very likely to fail when the session runs.

To keep group-based CI usage while avoiding breakage in nox, consider either retaining the extras install (session.install("-e.[test]")) or calling uv explicitly via session.run("uv", "run", "--group", "test", "pytest", ...) instead of using session.install for this.

As written, local nox runs are very likely to error when session.install is executed.

session.chdir("tests")
session.run(
"pytest",
Expand All @@ -15,9 +15,9 @@ def test(session):
)


@nox.session(python=["3.12"])
@nox.session(python=["3.14"])
def testcov(session):
session.install("-e.[test]")
session.install("-e", ".", "--group", "test")
session.chdir("tests")
session.run(
"pytest",
Expand All @@ -26,3 +26,10 @@ def testcov(session):
"--cov",
"mutation_motif",
)


@nox.session(python=["3.14"])
def fmt(session):
session.install("ruff")
session.run("ruff", "check", "--fix-only", ".")
session.run("ruff", "format", ".")
113 changes: 12 additions & 101 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["flit_core >=3.12.0,<4"]
build-backend = "flit_core.buildapi"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "mutation_motif"
Expand All @@ -16,7 +16,7 @@ keywords = [
]
readme = "README.md"
license = { file = "license.txt" }
requires-python = ">=3.11,<=3.14"
requires-python = ">=3.11,<3.15"
dependencies = [
"click",
"cogent3>=2026.4.13a0",
Expand All @@ -42,119 +42,30 @@ classifiers = [
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
dynamic = ["version", "description"]
description = "Analyses of point mutation counts data using log-linear models"
dynamic = ["version"]

[project.urls]
Documentation = "https://github.com/HuttleyLab/MutationMotif"
"Bug Tracker" = "https://github.com/HuttleyLab/MutationMotif/issues"
"Source Code" = "https://github.com/HuttleyLab/MutationMotif"

[tool.flit.sdist]
include = ["requirements.txt", "src/*", "pyproject.toml"]
exclude = ["doc/*.html"]

[project.scripts]
mm = "mutation_motif.cli:main"

[project.optional-dependencies]
[dependency-groups]
test = ["pytest", "pytest-cov", "nox"]
dev = ["click", "cog", "flit", "pytest", "pytest-cov", "nox", "ruff"]
dev = ["click", "cog", "pytest", "pytest-cov", "nox", "ruff"]

[tool.pytest.ini_options]
addopts = ["--strict-config", "-ra"]
testpaths = "tests"
markers = ["draws: tests that draw images (deselect with '-m \"not draws\"')"]

[tool.hatch.version]
path = "src/mutation_motif/__init__.py"

[tool.uv]
reinstall-package = ["mutation_motif"]

[tool.ruff]
exclude = [
".bzr",
".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",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 88
indent-width = 4

target-version = "py310"

[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", "ICN001", "T201"]

# 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"

[tool.ruff.lint.isort]
# group cogent3 imports last
known-first-party = ["mutation_motif"]
# Minimize the risk of supply chain attacks
exclude-newer = "7 days"
Loading