Skip to content

Commit 805e234

Browse files
committed
Add ruff directives in pyproject.toml
1 parent 8163f32 commit 805e234

2 files changed

Lines changed: 112 additions & 0 deletions

File tree

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,27 @@ MANIFEST
2929
# VS code workspace
3030
.vscode/
3131

32+
# Notebooks
33+
notebooks/
34+
3235
# Saved checkpoints
36+
*/ConditionalMAF/
37+
*/MixtureDensityNetwork/
3338
*/NDE_w_Standardization/
3439
*/checkpoints*/
3540
*/sbi-logs/
41+
42+
# hidden files
43+
.coverage
44+
.ruff_cache/
45+
.pytest_cache/
46+
47+
48+
# NodeJS
49+
node_modules/
50+
51+
# logs
52+
logs/
53+
54+
# Image
55+
*.png

pyproject.toml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,95 @@ testpaths = ["jaxili"]
7474
where = ["."]
7575
include = ["jaxili*"]
7676
exclude = ["jaxili.tests*", "jaxili.notebooks*"]
77+
78+
[tool.ruff]
79+
# We use ruff to lint and auto-format code
80+
81+
# Exclude a variety of commonly ignored directories.
82+
exclude = [
83+
".bzr",
84+
".direnv",
85+
".eggs",
86+
".git",
87+
".git-rewrite",
88+
".hg",
89+
".ipynb_checkpoints",
90+
".mypy_cache",
91+
".nox",
92+
".pants.d",
93+
".pyenv",
94+
".pytest_cache",
95+
".pytype",
96+
".ruff_cache",
97+
".svn",
98+
".tox",
99+
".venv",
100+
".vscode",
101+
"__pypackages__",
102+
"_build",
103+
"buck-out",
104+
"build",
105+
"dist",
106+
"node_modules",
107+
"site-packages",
108+
"venv",
109+
"*.ipynb", # ignore jupyter notebooks completely for now
110+
]
111+
112+
# more lenient line width than Black
113+
line-length = 120
114+
indent-width = 4
115+
116+
# minimum target python version
117+
target-version = "py311"
118+
119+
[tool.ruff.lint]
120+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
121+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
122+
# McCabe complexity (`C901`) by default.
123+
select = ["E", "F"]
124+
ignore = []
125+
126+
# Allow fix for all enabled rules (when `--fix`) is provided.
127+
fixable = ["ALL"]
128+
unfixable = []
129+
130+
# Allow unused variables when underscore-prefixed.
131+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
132+
133+
[tool.ruff.lint.per-file-ignores]
134+
135+
"__init__.py" = [
136+
"F401", # unused imports
137+
]
138+
139+
"tests/**/__init__.py" = [
140+
"F403", # * imports
141+
]
142+
143+
[tool.ruff.format]
144+
# Like Black, use double quotes for strings.
145+
quote-style = "double"
146+
147+
# Like Black, indent with spaces, rather than tabs.
148+
indent-style = "space"
149+
150+
# Like Black, respect magic trailing commas.
151+
skip-magic-trailing-comma = false
152+
153+
# Like Black, automatically detect the appropriate line ending.
154+
line-ending = "auto"
155+
156+
# Enable auto-formatting of code examples in docstrings. Markdown,
157+
# reStructuredText code/literal blocks and doctests are all supported.
158+
#
159+
# This is currently disabled by default, but it is planned for this
160+
# to be opt-out in the future.
161+
docstring-code-format = true
162+
163+
# Set the line length limit used when formatting code snippets in
164+
# docstrings.
165+
#
166+
# This only has an effect when the `docstring-code-format` setting is
167+
# enabled.
168+
docstring-code-line-length = "dynamic"

0 commit comments

Comments
 (0)