Skip to content

Commit f7c8bc8

Browse files
authored
Merge pull request #17 from DanielAvdar/reno
Add Renovate config and update package version placeholder
2 parents e647ac1 + 4e3a082 commit f7c8bc8

7 files changed

Lines changed: 81 additions & 16 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repos:
77
- id: trailing-whitespace
88
- id: no-commit-to-branch
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.11.5
10+
rev: v0.11.6
1111
hooks:
1212
- id: ruff-format
1313
args: [ --preview, --config=pyproject.toml ]

my_pkg/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"""Demo init.""" # todo: change to package description.
2+
13
from importlib.metadata import version
24

3-
__version__ = version("my-pkg")
5+
__version__ = version("my-pkg") # todo: replace with your package name

pyproject.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name = "my-pkg" # todo: change to your package name
33
dynamic = ["version"]
44
description = ""
55
authors = [
6-
{name = "DanielAvdar", email = "66269169+DanielAvdar@users.noreply.github.com"}, # todo: change to your name and email
6+
{ name = "DanielAvdar", email = "66269169+DanielAvdar@users.noreply.github.com" }, # todo: change to your name and email
77
]
8-
license = {text = "MIT"}
8+
license = { text = "MIT" }
99
readme = "README.md"
1010
classifiers = [
1111
"Programming Language :: Python :: 3",
@@ -33,20 +33,19 @@ dev = [
3333
"mypy==1.13.0",
3434
"pytest-parametrization>=2022",
3535
"ruff>=0.8.2",
36-
36+
"sybil[pytest]",
3737
]
3838
docs = [
39-
"sybil[pytest]",
4039
"sphinx>=8.2.0; python_version >= '3.11'",
4140
"sphinx>=7.0.0; python_version < '3.11'",
4241
"sphinx-rtd-theme>=3.0.2",
4342
]
4443
[tool.hatch.build.targets.sdist]
45-
only-include = ["my_pkg",] # todo: change to your package name
44+
only-include = ["my_pkg", ] # todo: change to your package name
4645
source = "."
4746

4847
[tool.hatch.build.targets.wheel]
49-
only-include = ["my_pkg",] # todo: change to your package name
48+
only-include = ["my_pkg", ] # todo: change to your package name
5049
source = "."
5150

5251

@@ -62,13 +61,15 @@ source = "uv-dynamic-versioning"
6261

6362
[tool.ruff]
6463
line-length = 120
65-
include = ["pyproject.toml", "tests/**",]
64+
include = ["pyproject.toml", "tests/**", ]
6665

6766
[tool.ruff.lint]
68-
select = ["F", "B", "I", "F", "W", "E","A","N"]
67+
select = ["F", "B", "I", "F", "W", "E", "A", "N", "D"]
6968

7069
fixable = ["ALL"]
71-
70+
[tool.ruff.lint.per-file-ignores]
71+
"tests/*" = ["D"]
72+
"docs/*" = ["D"]
7273
[tool.ruff.lint.isort]
7374
combine-as-imports = true
7475
[tool.mypy]

renovate.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"config:recommended"
5+
],
6+
"python": {
7+
"lockFileMaintenance": {
8+
"enabled": true
9+
}
10+
},
11+
"schedule": [
12+
"every day"
13+
],
14+
"packageRules": [
15+
{
16+
"matchManagers": ["uv"],
17+
"groupName": false
18+
19+
}
20+
]
21+
}

tests/docs/__init__.py

Whitespace-only changes.

tests/docs/test_docs.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from pathlib import Path
2+
3+
import pytest
4+
from sybil import Sybil
5+
from sybil.parsers.codeblock import PythonCodeBlockParser
6+
from sybil.parsers.doctest import DocTestParser
7+
8+
9+
def collect_examples(folder_name):
10+
docs_folder_path = Path(__file__).parent.parent.parent / "docs" / "source"
11+
models_folder_path = docs_folder_path / folder_name
12+
assert docs_folder_path.exists(), f"Docs path doesn't exist: {docs_folder_path.resolve()}"
13+
14+
all_rst_files = list(docs_folder_path.glob("*.rst"))
15+
all_rst_files.extend(list(models_folder_path.glob("*.rst")))
16+
print(f"Found {len(all_rst_files)} .rst files in docs folder.")
17+
# Configure Sybil
18+
sybil = Sybil(
19+
parsers=[
20+
DocTestParser(),
21+
PythonCodeBlockParser(),
22+
],
23+
pattern="*.rst",
24+
path=docs_folder_path.as_posix(),
25+
)
26+
examples_list = []
27+
for f_path in all_rst_files:
28+
document_ = sybil.parse(f_path)
29+
30+
examples_ = list(document_)
31+
examples_files = [e.path for e in examples_]
32+
examples_start_lines = [e.start for e in examples_]
33+
34+
examples_list.extend(zip(examples_files, examples_start_lines, examples_))
35+
# examples_list=[example for example in examples_]
36+
return examples_list
37+
38+
39+
@pytest.mark.parametrize("file_path, line, example", collect_examples(""))
40+
def test_doc_examples(file_path, line, example):
41+
example.evaluate()

uv.lock

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

0 commit comments

Comments
 (0)