livery-extensions-ruff 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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Willem Kokke
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.4
2
+ Name: livery-extensions-ruff
3
+ Version: 0.1.0
4
+ Summary: Ruff as a check of the livery workshop: the formatter and the linter, configured by the root ruff.toml.
5
+ Author: Willem Kokke
6
+ Author-email: Willem Kokke <mail@willem.net>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Typing :: Typed
13
+ Requires-Dist: livery-toolroom>=0.11.0
14
+ Requires-Dist: livery-workshop>=0.7.0
15
+ Requires-Python: >=3.11
16
+ Project-URL: Repository, https://github.com/willemkokke/livery
17
+ Description-Content-Type: text/markdown
18
+
19
+ <!-- Seeded from the package-python seeds at
20
+ birth; this file is the workspace's own. Edit it directly:
21
+ nothing rewrites it.
22
+ -->
23
+ # livery-extensions-ruff
24
+
25
+ Ruff as a check of the livery workshop. Listed as `ruff` in a workspace's
26
+ `[workspace] extensions`, it registers `format.ruff` and `lint.ruff` and
27
+ writes the root `ruff.toml` both read.
@@ -0,0 +1,9 @@
1
+ <!-- Seeded from the package-python seeds at
2
+ birth; this file is the workspace's own. Edit it directly:
3
+ nothing rewrites it.
4
+ -->
5
+ # livery-extensions-ruff
6
+
7
+ Ruff as a check of the livery workshop. Listed as `ruff` in a workspace's
8
+ `[workspace] extensions`, it registers `format.ruff` and `lint.ruff` and
9
+ writes the root `ruff.toml` both read.
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.11,<0.13"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "livery-extensions-ruff"
7
+ version = "0.1.0"
8
+ description = "Ruff as a check of the livery workshop: the formatter and the linter, configured by the root ruff.toml."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.11"
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3 :: Only",
17
+ "Typing :: Typed",
18
+ ]
19
+ dependencies = [
20
+ "livery-toolroom>=0.11.0",
21
+ "livery-workshop>=0.7.0",
22
+ ]
23
+
24
+ [[project.authors]]
25
+ name = "Willem Kokke"
26
+ email = "mail@willem.net"
27
+
28
+ [project.urls]
29
+ Repository = "https://github.com/willemkokke/livery"
30
+
31
+ [project.entry-points."workshop.extensions"]
32
+ ruff = "livery.extensions.ruff"
33
+
34
+ [tool.uv.build-backend]
35
+ module-name = "livery.extensions.ruff"
36
+ namespace = true
@@ -0,0 +1,42 @@
1
+ # Seeded from the package-python seeds at
2
+ # birth; this file is the workspace's own. Edit it directly:
3
+ # nothing rewrites it.
4
+ [build-system]
5
+ requires = ["uv_build>=0.11,<0.13"]
6
+ build-backend = "uv_build"
7
+
8
+ [project]
9
+ name = "livery-extensions-ruff"
10
+ version = "0.1.0"
11
+ description = "Ruff as a check of the livery workshop: the formatter and the linter, configured by the root ruff.toml."
12
+ readme = "README.md"
13
+ license = "MIT"
14
+ license-files = ["LICENSE"]
15
+ requires-python = ">=3.11"
16
+ authors = [{ name = "Willem Kokke", email = "mail@willem.net" }]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Typing :: Typed",
22
+ ]
23
+ dependencies = [
24
+ "livery-toolroom>=0.11.0",
25
+ "livery-workshop>=0.7.0",
26
+ ]
27
+
28
+ [project.urls]
29
+ Repository = "https://github.com/willemkokke/livery"
30
+
31
+ # The name a workspace lists in [workspace] extensions, and the package
32
+ # whose extension.toml the workshop mounts it from. Nothing else: the
33
+ # extension adds no verb of its own, and nothing activates by being
34
+ # installed.
35
+ [project.entry-points."workshop.extensions"]
36
+ ruff = "livery.extensions.ruff"
37
+
38
+ [tool.uv.build-backend]
39
+ # PEP 420 namespace: the importable package is livery.extensions.ruff and
40
+ # there is no livery/__init__.py anywhere in this repository.
41
+ module-name = "livery.extensions.ruff"
42
+ namespace = true
@@ -0,0 +1,51 @@
1
+ <!-- Seeded from the package-base seeds at
2
+ birth; this file is the workspace's own. Edit it directly:
3
+ nothing rewrites it.
4
+ -->
5
+ # livery-extensions-ruff
6
+
7
+ Ruff as a check of the workshop: `format.ruff` formats the python files a
8
+ run reaches and `lint.ruff` lints them. A workspace turns them on by
9
+ listing the extension:
10
+
11
+ ```toml
12
+ [workspace]
13
+ extensions = ["ruff"]
14
+ ```
15
+
16
+ `fm format` and `fm lint` then run them, and `fm check` runs them with the
17
+ rest of the gate: the formatter, then the linter, after the workshop's own
18
+ rewriters and before every judge. Each reads the python files its claims
19
+ reach: a python package's sources, tests and test support, its
20
+ configuration, and a native package's `conanfile.py`. An example file is
21
+ judged for its names alone, and a test needs no docstrings.
22
+ `fm lint.ruff -- --statistics` hands `ruff check` the words after `--`, and
23
+ `fm format.ruff -- --diff` hands them to `ruff format`.
24
+
25
+ ## The configuration
26
+
27
+ `fm sync` writes the root `ruff.toml`, and a bare `ruff` in the repository
28
+ reads the same file the checks do. It sets the line length, the python
29
+ version the workspace supports, the rules, and the per-file ignores the
30
+ checks' claims render. Ruff's cache is `.workshop/.cache/ruff/`.
31
+
32
+ The file is the extension's: an edit outside its region is drift, which
33
+ `fm check --fix` puts back. The repository's own settings go inside the
34
+ region, as whole tables or through a key's `extend-` spelling:
35
+
36
+ ```toml
37
+ # -- workshop: region tables, yours to edit; the render keeps it --
38
+ [lint.extend-per-file-ignores]
39
+ "**/generated.py" = ["E501"]
40
+ # -- workshop: end tables --
41
+ ```
42
+
43
+ A package that needs settings of its own carries a `ruff.toml` that
44
+ extends the root's, with `extend = "../../ruff.toml"`, one `../` per
45
+ directory level.
46
+
47
+ ## Fixing
48
+
49
+ `fm check --fix` and `fm format --fix` rewrite what ruff can rewrite.
50
+ `--safe-fix` removes no code: it applies every fix except deleting an
51
+ unused import, which an edit in flight adds before the code that uses it.
@@ -0,0 +1,12 @@
1
+ # This package's section of the workspace site, hand-authored.
2
+ # Labels map to pages relative to this docs/ tree, or to nested
3
+ # lists. Every authored page must appear here, and every entry must
4
+ # name a real page. A generator owns a block between `# nav:begin
5
+ # <name>` and `# nav:end <name>` markers (tasks, tools); the emitter's
6
+ # own sections, changelog, coverage and api, are blocks too: place a
7
+ # pair where one belongs, and a section without one lands after the
8
+ # authored entries, changelog and coverage ahead of the tasks block,
9
+ # api last.
10
+ nav = [
11
+ { "Index" = "index.md" },
12
+ ]
@@ -0,0 +1,34 @@
1
+ # Written by `{{ prog }} sync` from the ruff extension; the gate keeps
2
+ # it matching. Edit inside the region below, which is the repository's
3
+ # own; an edit anywhere else is drift.
4
+ line-length = 88
5
+ target-version = "py{{ python_floor | replace('.', '') }}"
6
+ src = [{% for package in py %}"packages/{{ package.dir }}/src", "packages/{{ package.dir }}/tests", {% endfor %}{% for path in root_tests %}"{{ path }}"{% if not loop.last %}, {% endif %}{% endfor %}]
7
+ # The cache lives with the workshop's state, never in the root.
8
+ cache-dir = ".workshop/.cache/ruff"
9
+
10
+ [format]
11
+ # A markdown page is prose: a python fence may hold a snippet directive
12
+ # or code shown as it is, and a documentation example file keeps the
13
+ # layout its page shows, so the formatter leaves both alone.
14
+ exclude = ["*.md", "packages/**/docs/examples/**", "docs/examples/**"]
15
+
16
+ [lint]
17
+ select = ["E", "F", "I", "UP", "B", "SIM", "C4", "RUF", "D"]
18
+
19
+ [lint.pydocstyle]
20
+ convention = "google"
21
+
22
+ [lint.per-file-ignores]
23
+ # The claims: each line is a category's patterns for a present kind,
24
+ # with the rules a check withholds there.
25
+ {% for pattern, codes in per_file_ignores %}"{{ pattern }}" = [{% for code in codes %}"{{ code }}"{% if not loop.last %}, {% endif %}{% endfor %}]
26
+ {% endfor %}# The composed tasks.py opens with the header the fragment engine
27
+ # writes, whose lines it does not wrap.
28
+ "tasks.py" = ["E501"]
29
+
30
+ # The repository's own tables: a whole table of its own, or a key the
31
+ # render writes through its `extend-` spelling, as
32
+ # `[lint.extend-per-file-ignores]`.
33
+ # -- workshop: region tables, yours to edit; the render keeps it --
34
+ # -- workshop: end tables --
@@ -0,0 +1,59 @@
1
+ # The ruff extension: the formatter, then the linter, over the python
2
+ # files they claim. Both checks are ruff's words: the workshop selects
3
+ # the paths a run reaches, appends the words after -- on the check's
4
+ # verb and then the paths, and ruff's exit code is the verdict. A file
5
+ # named to ruff follows the configured excludes under --force-exclude,
6
+ # as a file ruff finds itself does.
7
+
8
+ [extension]
9
+ api-version = 1
10
+ # Listed in the workspace's list alone: one configuration for every member.
11
+ levels = ["workspace"]
12
+
13
+ # The kinds whose python files ruff judges are a python package's, and a
14
+ # native package's conanfile.py beside clang-format over its sources.
15
+ [checks.ruff.format]
16
+ judge = ["ruff", "format", "--check", "--force-exclude"]
17
+ # Formatting removes no code, so --safe-fix rewrites as --fix does.
18
+ fix = ["ruff", "format", "--force-exclude"]
19
+ narrowing = "paths"
20
+ kinds = ["python", "cpp-conan"]
21
+ tools = ["ruff"]
22
+ arguments = true
23
+ editor-extension = "charliermarsh.ruff"
24
+ claims = [
25
+ { category = "source", suffixes = [".py", ".pyi"] },
26
+ { category = "test", suffixes = [".py", ".pyi"] },
27
+ { category = "test-support", suffixes = [".py", ".pyi"] },
28
+ { category = "configuration", suffixes = [".py", ".pyi"] },
29
+ ]
30
+
31
+ # The editor formats python with ruff, as the gate does.
32
+ [checks.ruff.format.fragments]
33
+ ".vscode/settings.json" = '''
34
+ {"[python]": {"editor.defaultFormatter": "charliermarsh.ruff"}}
35
+ '''
36
+
37
+ # Test bodies explain themselves by name and assertion, so the docstring
38
+ # rules stop at the tests. An example keeps the layout its page shows:
39
+ # ruff judges its names, and nothing of its style.
40
+ [checks.ruff.lint]
41
+ judge = ["ruff", "check", "--force-exclude"]
42
+ fix = ["ruff", "check", "--fix", "--force-exclude"]
43
+ # --safe-fix withholds the rule that deletes code an edit in flight has
44
+ # not finished writing: an import added before the code that uses it.
45
+ safe-fix = ["ruff", "check", "--fix", "--unfixable=F401", "--force-exclude"]
46
+ narrowing = "paths"
47
+ kinds = ["python", "cpp-conan"]
48
+ tools = ["ruff"]
49
+ arguments = true
50
+ editor-extension = "charliermarsh.ruff"
51
+ claims = [
52
+ { category = "source", suffixes = [".py", ".pyi"] },
53
+ { category = "test", ignore = ["D1"], suffixes = [".py", ".pyi"] },
54
+ { category = "example", suffixes = [".py", ".pyi"], ignore = [
55
+ "D", "E", "I", "UP", "B", "SIM", "C4", "RUF", "F401", "F811", "F841",
56
+ ] },
57
+ { category = "test-support", ignore = ["D1"], suffixes = [".py", ".pyi"] },
58
+ { category = "configuration", suffixes = [".py", ".pyi"] },
59
+ ]