Skip to content

Commit e4d0819

Browse files
committed
Initialize pdm; move ruff config to ruff.toml
1 parent c2e1ff2 commit e4d0819

2 files changed

Lines changed: 140 additions & 109 deletions

File tree

pyproject.toml

Lines changed: 5 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -41,113 +41,9 @@ paths = ["docs/Configuration.md"]
4141
[[tool.pydantic_settings_export.generators.dotenv]]
4242
paths = [".env.example"]
4343

44-
#####################
45-
# Development Tools #
46-
#####################
44+
[tool.pdm]
45+
distribution = true
4746

48-
[tool.ruff]
49-
# https://docs.astral.sh/ruff/configuration/
50-
51-
# Exclude a variety of commonly ignored directories.
52-
exclude = [
53-
".bzr",
54-
".direnv",
55-
".eggs",
56-
".git",
57-
".git-rewrite",
58-
".hg",
59-
".mypy_cache",
60-
".nox",
61-
".pants.d",
62-
".pytype",
63-
".ruff_cache",
64-
".svn",
65-
".tox",
66-
".venv",
67-
"__pypackages__",
68-
"_build",
69-
"buck-out",
70-
"build",
71-
"dist",
72-
"node_modules",
73-
"venv",
74-
"docs",
75-
"tests", # ignore tests for now
76-
]
77-
78-
# Same as Black.
79-
line-length = 88
80-
indent-width = 4
81-
82-
# Assume Python 3.10
83-
target-version = "py310"
84-
85-
[tool.ruff.lint]
86-
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
87-
select = [
88-
# pycodestyle
89-
"E",
90-
# Pyflakes
91-
"F",
92-
# pyupgrade
93-
# "UP",
94-
# flake8-bugbear
95-
"B",
96-
# flake8-simplify
97-
# "SIM",
98-
# isort
99-
"I",
100-
# Warning
101-
"W",
102-
# pydocstyle
103-
"D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107",
104-
# ruff
105-
# "RUF"
106-
]
107-
ignore = [
108-
"E501", # Line too long
109-
"B006", # Do not use mutable data structures for argument defaults
110-
]
111-
112-
# Allow fix for all enabled rules (when `--fix`) is provided.
113-
fixable = ["ALL"]
114-
unfixable = []
115-
116-
# Allow unused variables when underscore-prefixed.
117-
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
118-
119-
[tool.ruff.format]
120-
# Like Black, use double quotes for strings.
121-
quote-style = "double"
122-
123-
# Like Black, indent with spaces, rather than tabs.
124-
indent-style = "space"
125-
126-
# Like Black, respect magic trailing commas.
127-
skip-magic-trailing-comma = false
128-
129-
# Like Black, automatically detect the appropriate line ending.
130-
line-ending = "auto"
131-
132-
[tool.pytest.ini_options]
133-
# https://docs.pytest.org/en/stable/customize.html
134-
addopts = "-x"
135-
junit_family="xunit1"
136-
filterwarnings = [
137-
"ignore::DeprecationWarning",
138-
"ignore::pottery.exceptions.InefficientAccessWarning",
139-
]
140-
markers = [
141-
"hardware: marks test as requiring hardware (deselect with '-m \"not hardware\"')",
142-
]
143-
144-
[tool.mypy]
145-
# https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml
146-
show_error_codes = true
147-
check_untyped_defs = true
148-
follow_imports = "normal"
149-
strict_optional = true
150-
plugins = ["pydantic.mypy"]
151-
strict = true
152-
disallow_untyped_defs = true
153-
implicit_reexport = true
47+
[build-system]
48+
requires = ["pdm-backend"]
49+
build-backend = "pdm.backend"

ruff.toml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# https://docs.astral.sh/ruff/configuration/
2+
3+
# Exclude a variety of commonly ignored directories.
4+
exclude = [
5+
".bzr",
6+
".direnv",
7+
".eggs",
8+
".git",
9+
".git-rewrite",
10+
".hg",
11+
".mypy_cache",
12+
".nox",
13+
".pants.d",
14+
".pytype",
15+
".ruff_cache",
16+
".svn",
17+
".tox",
18+
".venv",
19+
"__pypackages__",
20+
"_build",
21+
"buck-out",
22+
"build",
23+
"dist",
24+
"node_modules",
25+
"venv",
26+
".venv",
27+
"docs",
28+
"*.ipynb",
29+
"*.md",
30+
]
31+
32+
# Same as Black.
33+
line-length = 88
34+
indent-width = 4
35+
36+
# Assume Python 3.10
37+
target-version = "py310"
38+
39+
[lint]
40+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
41+
select = [
42+
# pycodestyle
43+
"E",
44+
# Pyflakes
45+
"F",
46+
# pyupgrade
47+
"UP",
48+
# flake8-bugbear
49+
"B",
50+
# flake8-simplify
51+
"SIM",
52+
# isort
53+
"I",
54+
# Warning
55+
"W",
56+
# pydocstyle
57+
"D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107",
58+
# ruff
59+
"RUF",
60+
# McCabe Complexity
61+
"C90",
62+
# pep8-naming (N)
63+
"N",
64+
# flake8-2020 (YTT)
65+
"YTT",
66+
# flake8-annotations (ANN)
67+
"ANN",
68+
# flake8-async
69+
"ASYNC",
70+
# flake8-bandit
71+
"S",
72+
# flake8-commas
73+
"COM",
74+
# flake8-use-pathlib
75+
"PTH",
76+
# FastAPI
77+
"FAST",
78+
# flake8-logging
79+
"LOG",
80+
# flake8-comprehensions
81+
"C4",
82+
# flake8-pie
83+
"PIE",
84+
# flake8-return
85+
"RET",
86+
# Pylint
87+
"PL",
88+
# eradicate
89+
"ERA",
90+
# refurb
91+
"FURB",
92+
# flake-8-unused-arguments
93+
"ARG",
94+
# flake-8-print
95+
"T20",
96+
]
97+
ignore = [
98+
"E501", # Line too long
99+
"B006", # Do not use mutable data structures for argument defaults
100+
"ANN401", # Don't flag Any types
101+
"COM812", # Don't fight over trailing commas
102+
"PLR0913", # Allow for a reasonable number of arguments
103+
"PLR2004", # Magic value used in comparison
104+
"UP006", # Ignoring errors for typing types such as Dict or List
105+
"UP045", # Ignoring errors for Unions
106+
"UP007", # Ignoring errors for Optional
107+
"UP035", # Ignoring errors for typing types such as Dict or List
108+
"S311", # Ignoring use of standard random number generators
109+
]
110+
111+
# Allow fix for all enabled rules (when `--fix`) is provided.
112+
fixable = ["ALL"]
113+
unfixable = []
114+
115+
# Allow unused variables when underscore-prefixed.
116+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
117+
118+
[lint.per-file-ignores]
119+
"**/tests/**/*.py" = ["S101", "ANN", "D", "ARG002"]
120+
"**/*.ipynb" = ["T20"]
121+
"scripts/**/*.py" = ["D", "T20", "S101", "C901", "SIM", "C401"]
122+
"**/cli/**/*.py" = ["PLC0415"] # Allow lazy imports in CLI for startup performance
123+
124+
[format]
125+
# Like Black, use double quotes for strings.
126+
quote-style = "double"
127+
128+
# Like Black, indent with spaces, rather than tabs.
129+
indent-style = "space"
130+
131+
# Like Black, respect magic trailing commas.
132+
skip-magic-trailing-comma = false
133+
134+
# Like Black, automatically detect the appropriate line ending.
135+
line-ending = "auto"

0 commit comments

Comments
 (0)