badgerp_get_edition 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,15 @@
1
+ /target
2
+ /dist
3
+ /.venv
4
+ __pycache__/
5
+ *.pyc
6
+ plugins/**/.packages/
7
+ test.svg
8
+ badges/
9
+ /plugins/repology-badge/.site-packages
10
+ plugins/**/dist/
11
+ plugins/**/*.egg-info/
12
+ .pytest_cache/
13
+ mutants.out*
14
+ /mutants.out*
15
+ /xz2-0.1.7
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.5
2
+ Name: badgerp_get_edition
3
+ Version: 0.1.0
4
+ Summary: Get the Rust edition from Cargo.toml
5
+ Author-email: 𝑷𝒉𝒊𝒍𝒐𝒄𝒂𝒍𝒚𝒔𝒕 <regime_skylark.0y@icloud.com>
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.11
8
+ Description-Content-Type: text/markdown
9
+
10
+ # get-edition
11
+
12
+ A [badger](https://github.com/) plugin that reads the Rust edition out of a
13
+ `Cargo.toml` file and returns it as an `edition: <edition>` badge entry.
14
+
15
+ This is a static read of the `[package].edition` field — it doesn't verify
16
+ that the code actually builds under that edition.
17
+
18
+ This package is not meant to be used as a standalone library — badger loads
19
+ `plugin.py`'s `run()` function directly as its entrypoint.
@@ -0,0 +1,10 @@
1
+ # get-edition
2
+
3
+ A [badger](https://github.com/) plugin that reads the Rust edition out of a
4
+ `Cargo.toml` file and returns it as an `edition: <edition>` badge entry.
5
+
6
+ This is a static read of the `[package].edition` field — it doesn't verify
7
+ that the code actually builds under that edition.
8
+
9
+ This package is not meant to be used as a standalone library — badger loads
10
+ `plugin.py`'s `run()` function directly as its entrypoint.
@@ -0,0 +1,17 @@
1
+ # This gets the edition of the code in the repository.
2
+ # This of course isn't FOR SURE (you could totally get away with having a non-compling code with this, it doesn't care)
3
+ # But when I add -CI integration, the intention behind most of these plugins is it's updated after CI is finished running!
4
+
5
+ import tomllib
6
+ from badger import entry
7
+
8
+ def run(cargo_toml: str = "Cargo.toml") -> entry:
9
+ """Read the Rust edition declared by a Cargo manifest.
10
+
11
+ Args:
12
+ cargo_toml: path to the Cargo.toml file to inspect.
13
+ """
14
+ with open(cargo_toml, "rb") as f:
15
+ data = tomllib.load(f)
16
+ edition = str(data["package"]["edition"])
17
+ return entry(label="edition", status=edition)
@@ -0,0 +1,15 @@
1
+ [project]
2
+ name = "badgerp_get_edition"
3
+ version = "0.1.0"
4
+ description = "Get the Rust edition from Cargo.toml"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [{ name = "𝑷𝒉𝒊𝒍𝒐𝒄𝒂𝒍𝒚𝒔𝒕", email = "regime_skylark.0y@icloud.com" }]
8
+ requires-python = ">=3.11"
9
+
10
+ [build-system]
11
+ requires = ["hatchling"]
12
+ build-backend = "hatchling.build"
13
+
14
+ [tool.hatch.build.targets.wheel]
15
+ include = ["plugin.py"]
@@ -0,0 +1,18 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.fixture(autouse=True)
5
+ def chdir_project_root(monkeypatch, project_root):
6
+ monkeypatch.chdir(project_root)
7
+
8
+
9
+ def test_label(plugin):
10
+ assert plugin.run().label == "edition"
11
+
12
+
13
+ def test_status_is_valid_rust_edition(plugin):
14
+ assert plugin.run().status in {"2015", "2018", "2021", "2024"}
15
+
16
+
17
+ def test_icon_is_none(plugin):
18
+ assert plugin.run().icon is None
@@ -0,0 +1,8 @@
1
+ version = 1
2
+ revision = 3
3
+ requires-python = ">=3.11"
4
+
5
+ [[package]]
6
+ name = "badgerp-get-edition"
7
+ version = "0.1.0"
8
+ source = { editable = "." }