Skip to content

Commit 61dc0fa

Browse files
author
btraven00
committed
feat: show compat and commit version
we display 3 additional badges: - last commit in git repo, with link. as a fallback if repo is not github/gitlab - last updated for the git repo (color-coded for freshness) - lower snakemake version that depends on the same version of the interface that the plugin depends on
1 parent cab5e2a commit 61dc0fa

12 files changed

Lines changed: 904 additions & 586 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 & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,46 @@
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("/") %}
13+
{% endif -%}
14+
{% if repository_type == "github" and repository is not none -%}
15+
{% set repo = repository.replace("https://github.com/", "").replace(".git", "").rstrip("/") -%}
1716
.. image:: https://img.shields.io/github/last-commit/{{ repo }}
1817
:alt: GitHub - Last commit
1918
:target: {{ repository }}
20-
{% elif repository_type == "gitlab" and repository is not none %}
21-
{% set repo = repository.replace("https://gitlab.com/", "").replace(".git", "").rstrip("/") %}
19+
{% elif repository_type == "gitlab" and repository is not none -%}
20+
{% set repo = repository.replace("https://gitlab.com/", "").replace(".git", "").rstrip("/") -%}
2221
.. image:: https://img.shields.io/gitlab/last-commit/{{ repo }}
2322
:alt: GitLab - Last commit
2423
:target: {{ repository }}
25-
{% endif %}
26-
27-
{% for author in authors %}
24+
{% elif commit_info is not none -%}
25+
.. image:: https://img.shields.io/badge/last_commit-{{ commit_info["sha"] }}-green?color={{ commit_age_color }}
26+
:alt: Last commit
27+
:target: {{ commit_url }}
28+
.. image:: https://img.shields.io/badge/last_updated-{{ commit_date_label }}-green?color={{ commit_age_color }}
29+
:alt: Last updated
30+
:target: {{ commit_url }}
31+
{% endif -%}
32+
{% for author in authors -%}
2833
.. image:: https://img.shields.io/badge/author-{{author|replace("-","--")|urlencode}}-purple?color=%23064e3b
2934
:target: https://pypi.org/project/{{ package_name }}
30-
{% endfor %}
31-
35+
{% endfor -%}
3236
.. image:: https://img.shields.io/pypi/v/{{ package_name }}?color=%23047857
3337
:alt: PyPI - Version
3438
:target: https://pypi.org/project/{{ package_name }}
35-
3639
.. image:: https://img.shields.io/pypi/l/{{ package_name }}?color=%2310b981
3740
:alt: PyPI - License
3841
:target: https://pypi.org/project/{{ package_name }}
42+
{% if snakemake_version is not none %}
43+
.. image:: https://img.shields.io/badge/snakemake-{{ snakemake_version|replace("-", "--") }}-blue?color=%230ea5e9
44+
:alt: Snakemake
45+
:target: https://snakemake.readthedocs.io
46+
{% endif %}
3947

4048
{% if repository is not none and not repository.startswith("https://github.com/snakemake/") %}
4149
.. 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)