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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
- id: detect-private-key

- repo: https://github.com/crate-ci/typos
rev: v1.43.1
rev: v1
hooks:
- id: typos
# empty to do not write fixes
Expand Down Expand Up @@ -55,7 +55,7 @@ repos:
args: ["--print-width=79"]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
rev: v0.15.9
hooks:
# use black formatting
- id: ruff-format
Expand All @@ -67,13 +67,13 @@ repos:

# it needs to be after formatting hooks because the lines might be changed
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
rev: v1.20.0
hooks:
- id: mypy
files: "src/.*"

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.12.1
rev: v2.21.0
hooks:
- id: pyproject-fmt
additional_dependencies: [tox]
Expand Down
83 changes: 34 additions & 49 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# === Metadata & Build System ===

[build-system]
requires = [
"setuptools",
Expand All @@ -22,7 +21,7 @@ keywords = [
]
license = { file = "LICENSE" }
authors = [
{ name = "Shay Palachy Affek", email = 'shay.palachy@gmail.com' },
{ name = "Shay Palachy Affek", email = "shay.palachy@gmail.com" },
]
requires-python = ">=3.10"
classifiers = [
Expand All @@ -49,7 +48,6 @@ dependencies = [
"pympler>=1",
"watchdog>=2.3.1",
]

optional-dependencies.all = [
"boto3>=1.26",
"pymongo>=4",
Expand All @@ -70,31 +68,24 @@ optional-dependencies.sql = [
]
urls.Source = "https://github.com/python-cachier/cachier"
# --- setuptools ---

scripts.cachier = "cachier.__main__:cli"

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
version = { attr = "cachier._version.__version__" }

[tool.setuptools.packages.find]
where = [
dynamic.version = { attr = "cachier._version.__version__" }
packages.find.where = [
"src",
] # list of folders that contain the packages (["."] by default)
include = [
] # list of folders that contain the packages (["."] by default)
packages.find.include = [
"cachier*",
] # package names should match these glob patterns (["*"] by default)
namespaces = false # to disable scanning PEP 420 namespaces (true by default)
] # package names should match these glob patterns (["*"] by default)
packages.find.namespaces = false # to disable scanning PEP 420 namespaces (true by default)

# === Linting & Formatting ===

[tool.black]
line-length = 120

# --- ruff ---

[tool.ruff]
target-version = "py310"
line-length = 120
Expand All @@ -113,12 +104,12 @@ lint.select = [
"D", # see: https://pypi.org/project/pydocstyle
"E",
"F", # see: https://pypi.org/project/pyflakes
"I", #see: https://pypi.org/project/isort/
"I", # see: https://pypi.org/project/isort/
"RUF100", # alternative to yesqa
#"N", # see: https://pypi.org/project/pep8-naming
"S", # see: https://pypi.org/project/flake8-bandit
# "N", # see: https://pypi.org/project/pep8-naming
"S", # see: https://pypi.org/project/flake8-bandit
"SIM",
"W", # see: https://pypi.org/project/pycodestyle
"W", # see: https://pypi.org/project/pycodestyle
]
lint.extend-select = [
"A", # see: https://pypi.org/project/flake8-builtins
Expand Down Expand Up @@ -156,13 +147,12 @@ lint.per-file-ignores."tests/**" = [
lint.unfixable = [
"F401",
]

# --- flake8 ---
#[tool.ruff.pydocstyle]
# [tool.ruff.pydocstyle]
## Use Google-style docstrings.
#convention = "google"
#[tool.ruff.pycodestyle]
#ignore-overlong-task-comments = true
# convention = "google"
# [tool.ruff.pycodestyle]
# ignore-overlong-task-comments = true
# Unlike Flake8, default to a complexity level of 10.
lint.mccabe.max-complexity = 10

Expand All @@ -173,28 +163,26 @@ wrap-summaries = 120
wrap-descriptions = 120
blank = true

[tool.pytest]
# === Testing ===

# --- pytest ---

[tool.pytest.ini_options]
testpaths = [
ini_options.testpaths = [
"cachier",
"tests",
]
norecursedirs = [
ini_options.norecursedirs = [
"dist",
"build",
]
addopts = [
ini_options.addopts = [
"--color=yes",
"-r a",
"-v",
"-s",
"-W error",
# Note: parallel execution is opt-in via -n/--numprocesses (pytest-xdist)
]
markers = [
ini_options.markers = [
"mongo: test the MongoDB core",
"memory: test the memory core",
"pickle: test the pickle core",
Expand All @@ -208,29 +196,26 @@ markers = [
"seriallocal: local core tests that should run serially",
]

[tool.coverage.report]
show_missing = true
# Regexes for lines to exclude from consideration
exclude_lines = [
"pragma: no cover", # Have to re-enable the standard pragma
"raise NotImplementedError", # Don't complain if tests don't hit defensive assertion code:
"if TYPE_CHECKING:", # Is only true when running mypy, not tests
]
[tool.coverage]
# Parallel test execution configuration
# Use: pytest -n auto (for automatic worker detection)
# Or: pytest -n 4 (for specific number of workers)
# Memory tests are safe to run in parallel by default
# Pickle tests require isolation (handled by conftest.py fixture)

# --- coverage ---

[tool.coverage.run]
branch = true
parallel = true
run.branch = true
# dynamic_context = "test_function"
omit = [
"tests/*",
"src/cachier/_version.py",
"src/cachier/__init__.py",
run.omit = [
"**/scripts/**",
"src/cachier/__init__.py",
"src/cachier/_version.py",
"tests/*",
]
run.parallel = true
# Regexes for lines to exclude from consideration
report.exclude_lines = [
"if TYPE_CHECKING:", # Is only true when running mypy, not tests
"pragma: no cover", # Have to re-enable the standard pragma
"raise NotImplementedError", # Don't complain if tests don't hit defensive assertion code:
]
report.show_missing = true