Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: trailing-whitespace
- id: no-commit-to-branch
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.5
rev: v0.11.6
hooks:
- id: ruff-format
args: [ --preview, --config=pyproject.toml ]
Expand Down
4 changes: 3 additions & 1 deletion my_pkg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Demo init.""" # todo: change to package description.

from importlib.metadata import version

__version__ = version("my-pkg")
__version__ = version("my-pkg") # todo: replace with your package name
19 changes: 10 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name = "my-pkg" # todo: change to your package name
dynamic = ["version"]
description = ""
authors = [
{name = "DanielAvdar", email = "66269169+DanielAvdar@users.noreply.github.com"}, # todo: change to your name and email
{ name = "DanielAvdar", email = "66269169+DanielAvdar@users.noreply.github.com" }, # todo: change to your name and email
]
license = {text = "MIT"}
license = { text = "MIT" }
readme = "README.md"
classifiers = [
"Programming Language :: Python :: 3",
Expand Down Expand Up @@ -33,20 +33,19 @@ dev = [
"mypy==1.13.0",
"pytest-parametrization>=2022",
"ruff>=0.8.2",

"sybil[pytest]",
]
docs = [
"sybil[pytest]",
"sphinx>=8.2.0; python_version >= '3.11'",
"sphinx>=7.0.0; python_version < '3.11'",
"sphinx-rtd-theme>=3.0.2",
]
[tool.hatch.build.targets.sdist]
only-include = ["my_pkg",] # todo: change to your package name
only-include = ["my_pkg", ] # todo: change to your package name
source = "."

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


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

[tool.ruff]
line-length = 120
include = ["pyproject.toml", "tests/**",]
include = ["pyproject.toml", "tests/**", ]

[tool.ruff.lint]
select = ["F", "B", "I", "F", "W", "E","A","N"]
select = ["F", "B", "I", "F", "W", "E", "A", "N", "D"]

fixable = ["ALL"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D"]
"docs/*" = ["D"]
[tool.ruff.lint.isort]
combine-as-imports = true
[tool.mypy]
Expand Down
21 changes: 21 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
],
"python": {
"lockFileMaintenance": {
"enabled": true
}
},
"schedule": [
"every day"
],
"packageRules": [
{
"matchManagers": ["uv"],
"groupName": false

}
]
}
Empty file added tests/docs/__init__.py
Empty file.
41 changes: 41 additions & 0 deletions tests/docs/test_docs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from pathlib import Path

import pytest
from sybil import Sybil
from sybil.parsers.codeblock import PythonCodeBlockParser
from sybil.parsers.doctest import DocTestParser


def collect_examples(folder_name):
docs_folder_path = Path(__file__).parent.parent.parent / "docs" / "source"
models_folder_path = docs_folder_path / folder_name
assert docs_folder_path.exists(), f"Docs path doesn't exist: {docs_folder_path.resolve()}"

all_rst_files = list(docs_folder_path.glob("*.rst"))
all_rst_files.extend(list(models_folder_path.glob("*.rst")))
print(f"Found {len(all_rst_files)} .rst files in docs folder.")
# Configure Sybil
sybil = Sybil(
parsers=[
DocTestParser(),
PythonCodeBlockParser(),
],
pattern="*.rst",
path=docs_folder_path.as_posix(),
)
examples_list = []
for f_path in all_rst_files:
document_ = sybil.parse(f_path)

examples_ = list(document_)
examples_files = [e.path for e in examples_]
examples_start_lines = [e.start for e in examples_]

examples_list.extend(zip(examples_files, examples_start_lines, examples_))
# examples_list=[example for example in examples_]
return examples_list


@pytest.mark.parametrize("file_path, line, example", collect_examples(""))
def test_doc_examples(file_path, line, example):
example.evaluate()
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading