Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
209 lines (170 loc) · 6.25 KB
/
Copy pathpyproject.toml
File metadata and controls
209 lines (170 loc) · 6.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
[build-system]
requires = ["setuptools>=84.2.1"]
build-backend = "setuptools.build_meta"
[project]
name = "bhexpress"
# Versions should comply with PEP440
version = "3.0.0"
description = "Client to integrate with the BHExpress web services from Python."
readme = "README.rst"
license = "LGPL-3.0-or-later"
license-files = ["COPYING"]
authors = [{name = "BHExpress", email = "dev@bhexpress.cl"}]
keywords = ["sii", "chile", "bhe", "bhexpress", "boleta", "electronica"]
# Minimum Python version supported (the CI checks from 3.11 to 3.15)
requires-python = ">=3.11"
# See https://pypi.org/classifiers/
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
"Typing :: Typed",
]
# Run-time dependencies, installed with the package. Only the packages that
# bhexpress imports, with minimum versions (not exact ones), so the projects
# that use it can keep their own versions.
# - requests 2.32.4 fixes CVE-2024-47081 (credentials leaked through .netrc).
dependencies = [
"requests>=2.32.4",
]
[project.urls]
Homepage = "https://github.com/bhexpress/bhexpress-api-client-python"
[dependency-groups]
# Development tools, not installed with the package: `pip install --group dev`
dev = [
# Lint and type checking
"mypy==2.4.1",
"pyright==1.1.414",
"ruff==0.17.6",
"types-requests==2.32.4.20250913",
# Tests
"python-dotenv==1.0.1",
# Documentation (Sphinx)
"Sphinx==7.4.6",
"sphinx-rtd-theme==2.0.0",
# Build and upload to PyPI
"build==1.6.1",
"twine==7.0.0",
]
[tool.setuptools.packages.find]
exclude = ["tests", "tests.*", "docs", "docs.*"]
namespaces = false
[tool.setuptools.package-data]
# py.typed: marks the package as typed (PEP 561), so the projects that use
# it see its types
bhexpress = ["py.typed"]
[tool.ruff]
# Files to include in linting (Python source and stub files)
include = ["**/*.py", "**/*.pyi"]
# Folders to exclude from linting (e.g., virtual environments, build folders)
exclude = [
".git",
"__pycache__",
"build",
"dist",
".venv",
"venv",
]
# Maximum allowed characters per line
line-length = 79
# No target-version: Ruff takes the minimum version from requires-python
# (3.11), so it never suggests syntax that the oldest supported Python
# cannot run
# Respect `.gitignore` files (e.g., to skip __init__.py or ignored files)
respect-gitignore = true
# Apply fixes only with `ruff check --fix` (avoid rewriting the tree on `ruff check .`)
fix = false
[tool.ruff.lint]
# List of enabled rule categories
select = [
"D", # pydocstyle: docstring conventions
"F", # Pyflakes: code correctness errors
"E", # pycodestyle: style errors
"W", # pycodestyle: warnings
"I", # isort: import order checks
"UP", # Python upgrades: modern language features
"N", # pep8-naming: naming conventions
"B", # bugbear: common bug patterns
"A", # flake8-builtins: avoid shadowing built-in names
"C90", # mccabe: cyclomatic complexity
"ANN", # flake8-annotations: type annotations
"ARG", # flake8-unused-arguments: unused arguments detection
"DTZ", # datetimez: best practices with datetime usage
"TRY", # tryceratops: exception handling best practices
"SLF", # flake8-self: discourage private attribute access
"ERA", # eradicate: detect commented-out/dead code
"PL", # pylint: extra validations
"SIM", # flake8-simplify: simplifications
"RET", # flake8-return: return statements
"C4", # flake8-comprehensions: comprehensions
"PTH", # flake8-use-pathlib: pathlib instead of os.path
"PIE", # flake8-pie: miscellaneous
"RSE", # flake8-raise: raise statements
"PERF", # Perflint: performance
"FURB", # refurb: modern idioms
"PGH", # pygrep-hooks: forbids blanket ignores
"RUF", # Ruff-specific rules
]
# Rules to ignore (useful for relaxing or customizing enforcement)
ignore = [
# Docstring style: these rules are the opposite of D203 and D213, which
# the project follows (both enabled). Ruff cannot enforce both rules of a
# pair, so one of each pair must be disabled.
"D211", # Opposite of D203 (blank line before class docstring)
"D212", # Opposite of D213 (summary on the docstring's second line)
]
[tool.ruff.lint.mccabe]
# Maximum cyclomatic complexity allowed before a warning is raised
max-complexity = 25
[tool.ruff.lint.pylint]
max-args = 20 # Maximum number of arguments for a function
max-branches = 25 # Maximum number of branches for a function
max-statements = 60 # Maximum number of statements for a function
[tool.ruff.format]
quote-style = "single"
[tool.mypy]
# No python_version: mypy checks against the running interpreter, so each
# CI job (3.11 to 3.15) checks its own version
# Folders checked when running `mypy` without arguments
files = ["bhexpress", "tests", "docs"]
# Folders to exclude from type checking
exclude = ["build/", "dist/", "venv/"]
# Strict mode: every function with type annotations, no implicit Any and
# no untyped calls (it includes check_untyped_defs)
strict = true
# Checks outside strict mode: variables that may be unassigned, iterables
# (always truthy) used as conditions and use of deprecated functions
enable_error_code = ["possibly-undefined", "truthy-iterable", "deprecated"]
# The type of a variable created empty (None, [], {}) is inferred only in
# the scope where it is created, not from other functions
local_partial_types = true
[tool.pyright]
# Folders checked
include = ["bhexpress", "tests", "docs"]
# Folders to exclude from type checking
exclude = [
"**/node_modules",
"**/__pycache__",
"build",
"dist",
".git",
"venv",
".venv",
]
# No pythonVersion: `make typecheck` passes the venv interpreter
# (--pythonpath), so pyright checks against its version
# Type checking mode: strict (no unknown types, unnecessary checks are
# errors)
typeCheckingMode = "strict"
# Code that can never run (outside strict mode)
reportUnreachable = "error"
# Virtual environment with the dependencies: ./venv
venvPath = "."
venv = "venv"