Skip to content

Commit a6b5699

Browse files
committed
add python project configuration
Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent 269ebd0 commit a6b5699

File tree

9 files changed

+357
-1
lines changed

9 files changed

+357
-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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
"pyright",
17+
"ruff",
18+
"typing-extensions",
19+
]
20+
21+
[tool.pyright]
22+
typeCheckingMode = "standard"
23+
24+
[tool.ruff]
25+
preview = true
26+
line-length = 120
27+
exclude = [".git"]
28+
29+
[tool.ruff.format]
30+
quote-style = "preserve"
31+
32+
[tool.ruff.lint]
33+
select = [
34+
"D", # pydocstyle
35+
"F", # Pyflakes
36+
"I", # isort
37+
"SLF", # flake8-self
38+
"SIM", # flake8-simplify
39+
]
40+
# don't use some of the default D and SIM rules
41+
ignore = [
42+
"D100", # undocumented-public-module
43+
"D101", # undocumented-public-class
44+
"D102", # undocumented-public-method
45+
"D103", # undocumented-public-function
46+
"D104", # undocumented-public-package
47+
"D105", # undocumented-magic-method
48+
"D106", # undocumented-public-nested-class
49+
"D107", # undocumented-public-init
50+
"D203", # incorrect-blank-line-before-class
51+
"D210", # surrounding-whitespace
52+
"D212", # incorrect-blank-line-before-class
53+
"D401", # non-imperative-mood
54+
"D403", # first-word-uncapitalized
55+
"SIM105", # suppressible-exception
56+
"SIM108", # if-else-block-instead-of-if-exp
57+
]
58+
59+
[tool.ruff.lint.isort]
60+
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# generated with update_requirements.py, do not edit manually
2+
icecream
3+
mypy
4+
flake8
5+
pyright
6+
ruff
7+
typing-extensions
8+
-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: 253 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)