Skip to content

Commit d2c11a2

Browse files
btraven00btraven00
andauthored
feat: show compat and commit version (#25)
I was naively assuming that the major version of the plugin interface matches snakemake major version that is supported. johannes confirmed that in fact both `snakemake` and the plugin depend on a version of the interface. we can use the `pixi` resolution, but that'll give us the upper bound for snakemake. It'd be nice to also have the lower bound. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Plugin pages now show dynamic Snakemake compatibility per plugin and surface commit metadata (last commit, age, last updated) when available. * **Documentation** * Templates updated for conditional badges, dynamic version fallbacks, improved whitespace/formatting, and ensured trailing newlines. * **Tests** * Added unit tests covering docs conversion, compatibility resolution, and commit URL behavior. * **Chores** * Added CI unit-test job and test task, pinned pytest dep, ignored .envrc, and adjusted image-reference spacing. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: btraven00 <ben.uzh@pm.me>
1 parent cab5e2a commit d2c11a2

12 files changed

Lines changed: 978 additions & 588 deletions

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,21 @@ jobs:
2121
- name: QC
2222
run: pixi run qc
2323

24+
test-unit:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: prefix-dev/setup-pixi@v0.9.0
30+
with:
31+
cache: true
32+
33+
- name: Unit Tests
34+
run: pixi run test-unit
35+
2436
test-fast:
2537
runs-on: ubuntu-latest
38+
needs: test-unit
2639
steps:
2740
- uses: actions/checkout@v4
2841

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,5 @@ cython_debug/
165165
# pixi environments
166166
.pixi
167167
*.egg-info
168+
169+
.envrc

pixi.lock

Lines changed: 289 additions & 529 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ platforms = ["linux-64"]
66
version = "0.1.0"
77

88
[tasks]
9+
test-unit = "pytest source/test_collect_plugins.py -v"
910
build = "sphinx-build source build"
1011
apply-qc = [{ task = "style", environment = "style" }]
1112
qc = [{ task = "lint", environment = "style" }]
@@ -30,6 +31,7 @@ gcc_linux-64 = ">=15.1.0,<16"
3031
pkgconfig = ">=1.5.5,<2"
3132
gitpython = ">=3.1.46,<4"
3233
git = ">=2.53.0,<3"
34+
pytest = ">=8.0.0,<9"
3335

3436
[pypi-dependencies]
3537
sphinxawesome-theme = ">=5.3.2, <6"

source/_static/custom.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
.image-reference img {
22
display: inline;
3+
margin-right: 4px;
34
}
45

56
.image-reference {
67
border-bottom: none !important;
8+
font-size: 0;
79
}
810

911
table code.literal {

source/_templates/executor_plugin.rst.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block type %}executor{% endblock %}
44

55
{% block usage %}
6-
In order to use the plugin, run Snakemake (>=8.0) in the folder where your workflow code and config resides (containing either ``workflow/Snakefile`` or ``Snakefile``) with the corresponding value for the executor flag::
6+
In order to use the plugin, run Snakemake ({{ snakemake_version if snakemake_version else ">=8.0" }}) in the folder where your workflow code and config resides (containing either ``workflow/Snakefile`` or ``Snakefile``) with the corresponding value for the executor flag::
77

88
snakemake --executor {{ plugin_name }} --default-resources --jobs N ...
99

source/_templates/logger_plugin.rst.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{% block type %}logger{% endblock %}
44

55
{% block usage %}
6-
In order to use the plugin, run Snakemake (>=9.0) with the corresponding value for the logger flag::
6+
In order to use the plugin, run Snakemake ({{ snakemake_version if snakemake_version else ">=9.0" }}) with the corresponding value for the logger flag::
77

88
snakemake --logger {{ plugin_name }} ...
99

1010
with ``...`` being any additional arguments you want to use.
11-
{% endblock %}
11+
{% endblock %}

source/_templates/plugin_base.rst.j2

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,44 @@
44
Snakemake {% block type %}{% endblock %} plugin: {{ plugin_name }}
55
###########################################
66

7-
{% if repository is not none %}
7+
{% if repository is not none -%}
88
.. image:: https://img.shields.io/badge/repository-{{ repository_type }}-blue?color=%23022c22
99
:target: {{ repository }}
10-
{% else %}
10+
{% else -%}
1111
.. image:: https://img.shields.io/badge/repository-unknown-blue?color=%23022c22
1212
:target: #
13-
{% endif %}
14-
15-
{% if repository_type == "github" and repository is not none %}
16-
{% set repo = repository.replace("https://github.com/", "").replace(".git", "").rstrip("/") %}
17-
.. image:: https://img.shields.io/github/last-commit/{{ repo }}
13+
{% endif -%}
14+
{% if repository_type == "github" and repository is not none -%}
15+
.. image:: https://img.shields.io/github/last-commit/{{ repo_shortname }}
1816
:alt: GitHub - Last commit
1917
:target: {{ repository }}
20-
{% elif repository_type == "gitlab" and repository is not none %}
21-
{% set repo = repository.replace("https://gitlab.com/", "").replace(".git", "").rstrip("/") %}
22-
.. image:: https://img.shields.io/gitlab/last-commit/{{ repo }}
18+
{% elif repository_type == "gitlab" and repository is not none -%}
19+
.. image:: https://img.shields.io/gitlab/last-commit/{{ repo_shortname }}
2320
:alt: GitLab - Last commit
2421
:target: {{ repository }}
25-
{% endif %}
26-
27-
{% for author in authors %}
22+
{% elif commit_info is not none -%}
23+
.. image:: https://img.shields.io/badge/last_commit-{{ commit_info["sha"] }}-green?color={{ commit_age_color }}
24+
:alt: Last commit
25+
:target: {{ commit_url }}
26+
.. image:: https://img.shields.io/badge/last_updated-{{ commit_date_label }}-green?color={{ commit_age_color }}
27+
:alt: Last updated
28+
:target: {{ commit_url }}
29+
{% endif -%}
30+
{% for author in authors -%}
2831
.. image:: https://img.shields.io/badge/author-{{author|replace("-","--")|urlencode}}-purple?color=%23064e3b
2932
:target: https://pypi.org/project/{{ package_name }}
30-
{% endfor %}
31-
33+
{% endfor -%}
3234
.. image:: https://img.shields.io/pypi/v/{{ package_name }}?color=%23047857
3335
:alt: PyPI - Version
3436
:target: https://pypi.org/project/{{ package_name }}
35-
3637
.. image:: https://img.shields.io/pypi/l/{{ package_name }}?color=%2310b981
3738
:alt: PyPI - License
3839
:target: https://pypi.org/project/{{ package_name }}
40+
{% if snakemake_version is not none %}
41+
.. image:: https://img.shields.io/badge/snakemake-{{ snakemake_version|replace("-", "--") }}-blue?color=%230ea5e9
42+
:alt: Snakemake
43+
:target: https://snakemake.readthedocs.io
44+
{% endif %}
3945

4046
{% if repository is not none and not repository.startswith("https://github.com/snakemake/") %}
4147
.. warning::

source/_templates/report_plugin.rst.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
{% block type %}report{% endblock %}
44

55
{% block usage %}
6-
In order to use the plugin, run Snakemake (>=8.5) with the corresponding value for the reporter flag::
6+
In order to use the plugin, run Snakemake ({{ snakemake_version if snakemake_version else ">=8.5" }}) with the corresponding value for the reporter flag::
77

88
snakemake --reporter {{ plugin_name }} ...
99

1010
with ``...`` being any additional arguments you want to use.
11-
{% endblock %}
11+
{% endblock %}

source/_templates/scheduler_plugin.rst.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block type %}scheduler{% endblock %}
44

55
{% block usage %}
6-
In order to use the plugin, run Snakemake (>=9.0) with the corresponding value for the scheduler flag::
6+
In order to use the plugin, run Snakemake ({{ snakemake_version if snakemake_version else ">=9.0" }}) with the corresponding value for the scheduler flag::
77

88
snakemake --scheduler {{ plugin_name }} ...
99

0 commit comments

Comments
 (0)