Skip to content

Commit

Permalink
ENH: add action to collate fastp reports (#1)
Browse files Browse the repository at this point in the history
* ENH: add action to collate JSON reports

* Add tests

* Migrate to pyproject.toml

* Reformat with black

* Update black to 24.10

* Fix the ci.yaml workflow

* Assert calls in any order

* Black again

* Add visualization test

* More tests

* Black again

* Corrections to conda recipe
  • Loading branch information
misialq authored Feb 13, 2025
1 parent 001a55e commit 33780ad
Show file tree
Hide file tree
Showing 38 changed files with 2,522 additions and 3,203 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ omit =
**/__init__.py
**/_version.py
versioneer.py
**/_examples.py

[report]
fail_under = 90
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
q2_fastp/_version.py export-subst
pyproject.toml export-subst
17 changes: 17 additions & 0 deletions .github/workflows/black.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Black

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

jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
version: "24.10.0"
options: ". --check --extend-exclude '.*_version\\.py$' --verbose"
24 changes: 2 additions & 22 deletions .github/workflows/ci-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,5 @@ jobs:
ci:
uses: qiime2/distributions/.github/workflows/lib-ci-dev.yaml@dev
with:
distro: metagenome
additional-reports-path: ./coverage.xml
additional-reports-name: coverage

coverage:
needs: [ci]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v3
name: 'Fetch coverage from builds'
with:
name: ${{ needs.ci.outputs.additional-reports-name }}
path: ${{ needs.ci.outputs.additional-reports-path }}

- uses: codecov/codecov-action@v4
name: 'Upload coverage'
with:
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
distro: moshpit
recipe-path: 'conda-recipe'
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches: ["main"]
env:
DISTRO: metagenome
DISTRO: moshpit

jobs:
test:
Expand All @@ -28,8 +28,8 @@ jobs:
- name: Get last commit
id: get-commit-msg
run: |
echo "$(git log --pretty=%B -n 1 --skip 1)"
echo "commit-msg=$(git log --pretty=%B -n 1 --skip 1)" >> $GITHUB_OUTPUT
commit_msg=$(git log --pretty=%B -n 1 --skip 1 2>/dev/null)
echo "commit-msg=$commit_msg" >> $GITHUB_OUTPUT
- name: Install dependencies
run: python -m pip install requests yq
Expand Down Expand Up @@ -58,8 +58,8 @@ jobs:
- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
python-version: 3.9
mamba-version: 1.5.10
python-version: "3.10"
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
activate-environment: conda-env
Expand Down
42 changes: 0 additions & 42 deletions .github/workflows/q2-ci.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ dmypy.json

# PyCharm configuration
.idea/

_version.py
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test-cov: all
python -m coverage run -m pytest && coverage xml -o coverage.xml

install: all
$(PYTHON) setup.py install
$(PYTHON) -m pip install -v .

dev: all
pip install pre-commit
Expand Down
17 changes: 10 additions & 7 deletions ci/recipe/meta.yaml → conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
{% set data = load_setup_py_data() %}
{% set version = data.get('version') or 'placehold' %}

package:
name: q2-fastp
version: {{ version }}
version: {{ PLUGIN_VERSION }}

source:
path: ../..
path: ..

build:
script: make install
Expand All @@ -15,6 +12,13 @@ requirements:
host:
- python {{ python }}
- setuptools
- versioningit
- wheel

build:
- python {{ python }}
- setuptools
- versioningit

run:
- fastp
Expand All @@ -26,12 +30,11 @@ requirements:
test:
requires:
- coverage
- parameterized
imports:
- q2_fastp
- qiime2.plugins.fastp
commands:
- coverage run --rcfile ./repo/.coveragerc -m pytest && coverage xml -o coverage.xml
- pytest --pyargs q2_fastp

about:
home: https://github.com/bokulich-lab/q2-fastp
Expand Down
50 changes: 50 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[project]
name = "q2-fastp"
authors = [
{ name = "Michal Ziemski", email = "[email protected]" }
]
description = "QIIME 2 plugin for metagenome analysis."
readme = {file = "README.md", content-type = "text/markdown"}
license = {file = "LICENSE"}
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/bokulich-lab/q2-fastp"
Repository = "https://github.com/bokulich-lab/q2-fastp"

[project.entry-points.'qiime2.plugins']
"q2-fastp" = "q2_fastp.plugin_setup:plugin"

[build-system]
requires = [
"setuptools",
"versioningit",
"wheel"
]
build-backend = "setuptools.build_meta"

[tool.versioningit.vcs]
method = "git-archive"
describe-subst = "$Format:%(describe)$"
default-tag = "0.0.1"

[tool.versioningit.next-version]
method = "minor"

[tool.versioningit.format]
distance = "{base_version}+{distance}.{vcs}{rev}"
dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"
distance-dirty = "{base_version}+{distance}.{vcs}{rev}.dirty"

[tool.versioningit.write]
file = "q2_fastp/_version.py"

[tool.setuptools]
include-package-data = true

[tool.setuptools.packages.find]
where = ["."]
include = ["q2_fastp*"]

[tool.setuptools.package-data]
q2_fastp = ["**/*"]
10 changes: 7 additions & 3 deletions q2_fastp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
#
# The full license is in the file LICENSE, distributed with this software.
# ----------------------------------------------------------------------------
from . import _version
from .fastp import process_seqs
from .utils import collate_fastp_reports
from .visualization import visualize

__version__ = _version.get_versions()["version"]
__all__ = ["process_seqs", "visualize"]
try:
from ._version import __version__
except ModuleNotFoundError:
__version__ = "0.0.0+notfound"

__all__ = ["collate_fastp_reports", "process_seqs", "visualize"]
Loading

0 comments on commit 33780ad

Please sign in to comment.