Skip to content

Commit 30c1de7

Browse files
committed
add python project configuration
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent e4f4619 commit 30c1de7

File tree

10 files changed

+591
-5
lines changed

10 files changed

+591
-5
lines changed

scripts/koji/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__

scripts/koji/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11.11

scripts/koji/pyproject.toml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
[project]
2+
name = "koji-utils"
3+
version = "0.1.0"
4+
description = "Koji utils"
5+
readme = "README.md"
6+
requires-python = "~=3.11"
7+
dependencies = [
8+
"koji",
9+
"specfile",
10+
]
11+
12+
[dependency-groups]
13+
dev = [
14+
"icecream",
15+
"mypy",
16+
"flake8",
17+
"pyright",
18+
"ruff",
19+
"typing-extensions",
20+
"flake8-pyproject",
21+
]
22+
23+
[tool.pyright]
24+
typeCheckingMode = "standard"
25+
26+
[tool.ruff]
27+
preview = true
28+
line-length = 120
29+
exclude = [".git"]
30+
31+
[tool.ruff.format]
32+
quote-style = "preserve"
33+
34+
[tool.ruff.lint]
35+
select = [
36+
"D", # pydocstyle
37+
"F", # Pyflakes
38+
"I", # isort
39+
"SLF", # flake8-self
40+
"SIM", # flake8-simplify
41+
]
42+
# don't use some of the default D and SIM rules
43+
ignore = [
44+
"D100", # undocumented-public-module
45+
"D101", # undocumented-public-class
46+
"D102", # undocumented-public-method
47+
"D103", # undocumented-public-function
48+
"D104", # undocumented-public-package
49+
"D105", # undocumented-magic-method
50+
"D106", # undocumented-public-nested-class
51+
"D107", # undocumented-public-init
52+
"D200", # unnecessary-multiline-docstring
53+
"D203", # incorrect-blank-line-before-class
54+
"D204", # incorrect-blank-line-after-class
55+
"D205", # missing-blank-line-after-summary
56+
"D210", # surrounding-whitespace
57+
"D212", # incorrect-blank-line-before-class
58+
"D400", # missing-trailing-period
59+
"D401", # non-imperative-mood
60+
"D403", # first-word-uncapitalized
61+
"SIM105", # suppressible-exception
62+
"SIM108", # if-else-block-instead-of-if-exp
63+
]
64+
65+
# restrict to the PEP 257 rules
66+
pydocstyle.convention = "pep257"
67+
68+
[tool.ruff.lint.isort.sections]
69+
testing = ["pytest*"]
70+
typing = ["typing"]
71+
72+
[tool.ruff.lint.isort]
73+
lines-after-imports = 1
74+
section-order = [
75+
"future",
76+
"testing",
77+
"standard-library",
78+
"third-party",
79+
"first-party",
80+
"local-folder",
81+
"typing",
82+
]
83+
84+
# ruff doesn't provide all the pycodestyle rules, and pycodestyle is not well
85+
# supported by some IDEs, so we use flake8 for that
86+
[tool.flake8]
87+
max-line-length = 120
88+
ignore = [
89+
"E261", # At least two spaces before inline comment
90+
"E302", # Expected 2 blank lines, found 0
91+
"E305", # Expected 2 blank lines after end of function or class
92+
"W503", # Line break occurred before a binary operator
93+
"F", # already done by ruff
94+
]
95+
exclude=[".git", ".venv"]

scripts/koji/requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/koji/requirements/base.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# generated with update_requirements.py, do not edit manually
2+
specfile

scripts/koji/requirements/dev.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# generated with update_requirements.py, do not edit manually
2+
icecream
3+
mypy
4+
flake8
5+
pyright
6+
ruff
7+
typing-extensions
8+
flake8-pyproject
9+
-r base.txt
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env python3
2+
3+
import argparse
4+
import tomllib
5+
from pathlib import Path
6+
7+
parser = argparse.ArgumentParser(description="Convert the dependencies from pyproject.toml in requirements.txt files")
8+
args = parser.parse_args()
9+
10+
PROJECT_DIR = Path(__file__).parent.parent
11+
HEADER = "# generated with update_requirements.py, do not edit manually"
12+
13+
with open(f'{PROJECT_DIR}/pyproject.toml', 'rb') as f:
14+
pyproject = tomllib.load(f)
15+
16+
17+
main_deps = pyproject['project']['dependencies']
18+
with open(f'{PROJECT_DIR}/requirements/base.txt', 'w') as f:
19+
print(HEADER, file=f)
20+
for dep in main_deps:
21+
print(dep, file=f)
22+
23+
dev_deps = pyproject['dependency-groups']['dev']
24+
with open(f'{PROJECT_DIR}/requirements/dev.txt', 'w') as f:
25+
print(HEADER, file=f)
26+
for dep in dev_deps:
27+
print(dep, file=f)
28+
print('-r base.txt', file=f)

scripts/koji/setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length=120
3+
ignore=E261,E302,E305,W503,F
4+
exclude=.git,.venv

scripts/koji/uv.lock

Lines changed: 451 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

setup.cfg

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)