ramplint 0.2.0__tar.gz → 0.2.1__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.
Files changed (41) hide show
  1. {ramplint-0.2.0 → ramplint-0.2.1}/CHANGELOG.md +10 -1
  2. {ramplint-0.2.0 → ramplint-0.2.1}/PKG-INFO +8 -8
  3. {ramplint-0.2.0 → ramplint-0.2.1}/README.md +7 -7
  4. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/__init__.py +1 -1
  5. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/cli.py +20 -6
  6. {ramplint-0.2.0 → ramplint-0.2.1}/tests/test_cli.py +21 -0
  7. {ramplint-0.2.0 → ramplint-0.2.1}/tests/test_docs.py +11 -0
  8. {ramplint-0.2.0 → ramplint-0.2.1}/.gitignore +0 -0
  9. {ramplint-0.2.0 → ramplint-0.2.1}/LICENSE +0 -0
  10. {ramplint-0.2.0 → ramplint-0.2.1}/docs/demo.svg +0 -0
  11. {ramplint-0.2.0 → ramplint-0.2.1}/examples/README.md +0 -0
  12. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/accounts/login.html +0 -0
  13. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/base.html +0 -0
  14. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/clean/tricky_but_valid.html +0 -0
  15. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/orders/list.html +0 -0
  16. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/orders/list_fixed.html +0 -0
  17. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/partials/footer.html +0 -0
  18. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/partials/navbar.html +0 -0
  19. {ramplint-0.2.0 → ramplint-0.2.1}/examples/templates/products/detail.html +0 -0
  20. {ramplint-0.2.0 → ramplint-0.2.1}/pyproject.toml +0 -0
  21. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/__main__.py +0 -0
  22. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/config.py +0 -0
  23. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/dom.py +0 -0
  24. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/linter.py +0 -0
  25. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/py.typed +0 -0
  26. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/reporters.py +0 -0
  27. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/__init__.py +0 -0
  28. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/base.py +0 -0
  29. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/controls.py +0 -0
  30. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/document.py +0 -0
  31. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/embeds.py +0 -0
  32. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/forms.py +0 -0
  33. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/headings.py +0 -0
  34. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/ids.py +0 -0
  35. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/images.py +0 -0
  36. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/names.py +0 -0
  37. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/rules/tables.py +0 -0
  38. {ramplint-0.2.0 → ramplint-0.2.1}/src/ramplint/template.py +0 -0
  39. {ramplint-0.2.0 → ramplint-0.2.1}/tests/conftest.py +0 -0
  40. {ramplint-0.2.0 → ramplint-0.2.1}/tests/test_rules.py +0 -0
  41. {ramplint-0.2.0 → ramplint-0.2.1}/tests/test_template.py +0 -0
@@ -6,6 +6,14 @@ and the project uses [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.2.1] - 2026-10-21
10
+
11
+ ### Fixed
12
+
13
+ - Images and links in the project description on PyPI (the README used
14
+ relative paths that only work on GitHub).
15
+ - `ramplint ... | head` no longer prints a `BrokenPipeError` traceback.
16
+
9
17
  ## [0.2.0] - 2026-10-21
10
18
 
11
19
  ### Added
@@ -44,6 +52,7 @@ and the project uses [Semantic Versioning](https://semver.org/).
44
52
  - Configuration via `[tool.ramplint]` in `pyproject.toml`.
45
53
  - pre-commit hook.
46
54
 
47
- [Unreleased]: https://github.com/iLLcruS/ramplint/compare/0.2.0...HEAD
55
+ [Unreleased]: https://github.com/iLLcruS/ramplint/compare/0.2.1...HEAD
56
+ [0.2.1]: https://github.com/iLLcruS/ramplint/compare/0.2.0...0.2.1
48
57
  [0.2.0]: https://github.com/iLLcruS/ramplint/compare/0.1.0...0.2.0
49
58
  [0.1.0]: https://github.com/iLLcruS/ramplint/releases/tag/0.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: ramplint
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Accessibility (WCAG) linter for Django and Jinja2 templates
5
5
  Project-URL: Homepage, https://github.com/iLLcruS/ramplint
6
6
  Project-URL: Issues, https://github.com/iLLcruS/ramplint/issues
@@ -43,7 +43,7 @@ Description-Content-Type: text/markdown
43
43
  <a href="https://github.com/iLLcruS/ramplint/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/iLLcruS/ramplint/actions/workflows/ci.yml/badge.svg"></a>
44
44
  <a href="https://pypi.org/project/ramplint/"><img alt="PyPI" src="https://img.shields.io/pypi/v/ramplint.svg"></a>
45
45
  <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-blue.svg">
46
- <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-green.svg"></a>
46
+ <a href="https://github.com/iLLcruS/ramplint/blob/main/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-green.svg"></a>
47
47
  <a href="https://ko-fi.com/innerexcept"><img alt="Support on Ko-fi" src="https://img.shields.io/badge/Ko--fi-support-72a4f2?logo=ko-fi&logoColor=white"></a>
48
48
  </p>
49
49
 
@@ -55,12 +55,12 @@ and browser-based checkers only see the pages you remember to open.
55
55
  and reports problems with the exact line and column in the template source:
56
56
 
57
57
  <p align="center">
58
- <img src="docs/demo.svg" alt="Terminal output of ramplint reporting six accessibility problems in a Django product page template">
58
+ <img src="https://raw.githubusercontent.com/iLLcruS/ramplint/main/docs/demo.svg" alt="Terminal output of ramplint reporting six accessibility problems in a Django product page template">
59
59
  </p>
60
60
 
61
61
  ## Try it in 30 seconds
62
62
 
63
- The repository ships with a small demo shop in [`examples/`](examples/): a
63
+ The repository ships with a small demo shop in [`examples/`](https://github.com/iLLcruS/ramplint/tree/main/examples): a
64
64
  deliberately inaccessible set of Django templates that triggers every rule,
65
65
  plus a file full of tricky-but-valid template patterns that must stay silent.
66
66
 
@@ -83,7 +83,7 @@ examples/templates/products/detail.html:28:3: RL101 <input type="image"> needs a
83
83
  Found 32 problems in 6 of 8 files.
84
84
  ```
85
85
 
86
- See [`examples/README.md`](examples/README.md) for what each demo template contains.
86
+ See [`examples/README.md`](https://github.com/iLLcruS/ramplint/blob/main/examples/README.md) for what each demo template contains.
87
87
 
88
88
  ## Highlights
89
89
 
@@ -331,7 +331,7 @@ extensions = [".html", ".txt"]
331
331
  # .pre-commit-config.yaml
332
332
  repos:
333
333
  - repo: https://github.com/iLLcruS/ramplint
334
- rev: 0.2.0
334
+ rev: 0.2.1
335
335
  hooks:
336
336
  - id: ramplint
337
337
  ```
@@ -373,7 +373,7 @@ tool such as axe.
373
373
  ## Contributing
374
374
 
375
375
  Bug reports, especially about false positives, are very welcome.
376
- See [CONTRIBUTING.md](CONTRIBUTING.md).
376
+ See [CONTRIBUTING.md](https://github.com/iLLcruS/ramplint/blob/main/CONTRIBUTING.md).
377
377
 
378
378
  ## Feedback and support
379
379
 
@@ -388,4 +388,4 @@ buy me a coffee:
388
388
 
389
389
  ## License
390
390
 
391
- [MIT](LICENSE) © Vladyslav Rostovskyi
391
+ [MIT](https://github.com/iLLcruS/ramplint/blob/main/LICENSE) © Vladyslav Rostovskyi
@@ -9,7 +9,7 @@
9
9
  <a href="https://github.com/iLLcruS/ramplint/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/iLLcruS/ramplint/actions/workflows/ci.yml/badge.svg"></a>
10
10
  <a href="https://pypi.org/project/ramplint/"><img alt="PyPI" src="https://img.shields.io/pypi/v/ramplint.svg"></a>
11
11
  <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-blue.svg">
12
- <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-green.svg"></a>
12
+ <a href="https://github.com/iLLcruS/ramplint/blob/main/LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-green.svg"></a>
13
13
  <a href="https://ko-fi.com/innerexcept"><img alt="Support on Ko-fi" src="https://img.shields.io/badge/Ko--fi-support-72a4f2?logo=ko-fi&logoColor=white"></a>
14
14
  </p>
15
15
 
@@ -21,12 +21,12 @@ and browser-based checkers only see the pages you remember to open.
21
21
  and reports problems with the exact line and column in the template source:
22
22
 
23
23
  <p align="center">
24
- <img src="docs/demo.svg" alt="Terminal output of ramplint reporting six accessibility problems in a Django product page template">
24
+ <img src="https://raw.githubusercontent.com/iLLcruS/ramplint/main/docs/demo.svg" alt="Terminal output of ramplint reporting six accessibility problems in a Django product page template">
25
25
  </p>
26
26
 
27
27
  ## Try it in 30 seconds
28
28
 
29
- The repository ships with a small demo shop in [`examples/`](examples/): a
29
+ The repository ships with a small demo shop in [`examples/`](https://github.com/iLLcruS/ramplint/tree/main/examples): a
30
30
  deliberately inaccessible set of Django templates that triggers every rule,
31
31
  plus a file full of tricky-but-valid template patterns that must stay silent.
32
32
 
@@ -49,7 +49,7 @@ examples/templates/products/detail.html:28:3: RL101 <input type="image"> needs a
49
49
  Found 32 problems in 6 of 8 files.
50
50
  ```
51
51
 
52
- See [`examples/README.md`](examples/README.md) for what each demo template contains.
52
+ See [`examples/README.md`](https://github.com/iLLcruS/ramplint/blob/main/examples/README.md) for what each demo template contains.
53
53
 
54
54
  ## Highlights
55
55
 
@@ -297,7 +297,7 @@ extensions = [".html", ".txt"]
297
297
  # .pre-commit-config.yaml
298
298
  repos:
299
299
  - repo: https://github.com/iLLcruS/ramplint
300
- rev: 0.2.0
300
+ rev: 0.2.1
301
301
  hooks:
302
302
  - id: ramplint
303
303
  ```
@@ -339,7 +339,7 @@ tool such as axe.
339
339
  ## Contributing
340
340
 
341
341
  Bug reports, especially about false positives, are very welcome.
342
- See [CONTRIBUTING.md](CONTRIBUTING.md).
342
+ See [CONTRIBUTING.md](https://github.com/iLLcruS/ramplint/blob/main/CONTRIBUTING.md).
343
343
 
344
344
  ## Feedback and support
345
345
 
@@ -354,4 +354,4 @@ buy me a coffee:
354
354
 
355
355
  ## License
356
356
 
357
- [MIT](LICENSE) © Vladyslav Rostovskyi
357
+ [MIT](https://github.com/iLLcruS/ramplint/blob/main/LICENSE) © Vladyslav Rostovskyi
@@ -1,6 +1,6 @@
1
1
  """ramplint - accessibility linter for Django and Jinja2 templates."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.2.1"
4
4
 
5
5
  from ramplint.linter import Violation, iter_template_files, lint_file, lint_source # noqa: E402
6
6
  from ramplint.rules import all_rules, select_rules # noqa: E402
@@ -80,6 +80,14 @@ def _use_color(no_color: bool) -> bool:
80
80
  return sys.stdout.isatty()
81
81
 
82
82
 
83
+ def _silence_stdout() -> None:
84
+ try:
85
+ devnull = os.open(os.devnull, os.O_WRONLY)
86
+ os.dup2(devnull, sys.stdout.fileno())
87
+ except (OSError, ValueError):
88
+ pass
89
+
90
+
83
91
  def main(argv: Sequence[str] | None = None) -> int:
84
92
  parser = build_parser()
85
93
  args = parser.parse_args(argv)
@@ -118,12 +126,18 @@ def main(argv: Sequence[str] | None = None) -> int:
118
126
  output_format = args.format or (
119
127
  "github" if os.environ.get("GITHUB_ACTIONS") == "true" else "text"
120
128
  )
121
- if output_format == "json":
122
- report_json(violations, files_checked, sys.stdout)
123
- elif output_format == "github":
124
- report_github(violations, files_checked, sys.stdout)
125
- else:
126
- report_text(violations, files_checked, sys.stdout, color=_use_color(args.no_color))
129
+ try:
130
+ if output_format == "json":
131
+ report_json(violations, files_checked, sys.stdout)
132
+ elif output_format == "github":
133
+ report_github(violations, files_checked, sys.stdout)
134
+ else:
135
+ report_text(violations, files_checked, sys.stdout, color=_use_color(args.no_color))
136
+ sys.stdout.flush()
137
+ except BrokenPipeError:
138
+ # The reader went away (e.g. `ramplint | head`). Silence the error that
139
+ # Python would print while flushing stdout on exit.
140
+ _silence_stdout()
127
141
 
128
142
  if violations and not args.exit_zero:
129
143
  return EXIT_VIOLATIONS
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import json
4
+ import sys
4
5
  from pathlib import Path
5
6
 
6
7
  import pytest
@@ -127,3 +128,23 @@ def test_examples_directory(capsys, monkeypatch):
127
128
  # The demo covers every rule.
128
129
  all_codes = {code for codes in by_file.values() for code in codes}
129
130
  assert all_codes == {rule.code for rule in all_rules()}
131
+
132
+
133
+ @pytest.mark.skipif(sys.platform == "win32", reason="POSIX pipe semantics")
134
+ def test_closed_pipe_does_not_print_traceback(tmp_path):
135
+ import subprocess
136
+
137
+ template = tmp_path / "many.html"
138
+ template.write_text('<img src="a.png">\n' * 5000)
139
+ proc = subprocess.Popen(
140
+ [sys.executable, "-m", "ramplint", str(template), "--no-color"],
141
+ stdout=subprocess.PIPE,
142
+ stderr=subprocess.PIPE,
143
+ )
144
+ assert proc.stdout is not None and proc.stderr is not None
145
+ proc.stdout.readline()
146
+ proc.stdout.close() # like `| head -1`
147
+ stderr = proc.stderr.read().decode()
148
+ proc.wait(timeout=30)
149
+ assert "Traceback" not in stderr
150
+ assert "BrokenPipeError" not in stderr
@@ -58,3 +58,14 @@ def test_readme_pre_commit_rev_matches_version():
58
58
  from ramplint import __version__
59
59
 
60
60
  assert f"rev: {__version__}\n" in README
61
+
62
+
63
+ def test_readme_links_are_absolute():
64
+ """PyPI renders the README without the repository files, so relative
65
+ links and images break there."""
66
+ prose = re.sub(r"```.*?```", "", README, flags=re.DOTALL)
67
+ targets = re.findall(r"\]\(([^)\s]+)\)|(?:src|href)=\"([^\"]+)\"", prose)
68
+ relative = [
69
+ url for pair in targets for url in pair if url and not re.match(r"(https?:|mailto:|#)", url)
70
+ ]
71
+ assert not relative, f"use absolute GitHub URLs in README: {relative}"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes