Skip to content

Commit 323421c

Browse files
committed
add python project configuration
Signed-off-by: Gaëtan Lehmann <gaetan.lehmann@vates.tech>
1 parent 9945fe7 commit 323421c

File tree

9 files changed

+371
-1
lines changed

9 files changed

+371
-1
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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
"specfile",
9+
]
10+
11+
[dependency-groups]
12+
dev = [
13+
"icecream",
14+
"mypy",
15+
"flake8",
16+
"pydocstyle",
17+
"pyright",
18+
"ruff",
19+
"typing-extensions",
20+
]
21+
22+
[tool.pyright]
23+
typeCheckingMode = "standard"
24+
25+
[tool.ruff]
26+
preview = true
27+
line-length = 120
28+
exclude = [".git"]
29+
30+
[tool.ruff.format]
31+
quote-style = "preserve"
32+
33+
[tool.ruff.lint]
34+
select = [
35+
"F", # Pyflakes
36+
"I", # isort
37+
"SLF", # flake8-self
38+
"SIM", # flake8-simplify
39+
]
40+
# don't use some of the SIM rules
41+
ignore = [
42+
"SIM105", # suppressible-exception
43+
"SIM108", # if-else-block-instead-of-if-exp
44+
]
45+
46+
[tool.ruff.lint.isort]
47+
lines-after-imports = 1

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+
pydocstyle
6+
pyright
7+
ruff
8+
typing-extensions
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
max-line-length=120
3+
ignore=E261,E302,E305,W503,F
4+
exclude=.git,.venv
5+
6+
[pydocstyle]
7+
ignore=D100,D101,D102,D103,D104,D105,D106,D107,D203,D210,D212,D401,D403

scripts/koji/uv.lock

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

0 commit comments

Comments
 (0)