Skip to content

Commit 63bac57

Browse files
Tim020claude
andauthored
feat(tooling): Add pyproject.toml for consolidated Python tool configuration (#741)
Consolidate Python tool configurations into a single pyproject.toml file while preserving existing code formatting standards. Key improvements: - Single source of truth for tool configurations - Dynamic dependency loading from requirements.txt files - Pytest pythonpath configuration enables running `pytest` directly - No code reformatting required - matches existing standards Technical changes: - Created pyproject.toml with: - Black: line-length=88 (default, matches existing formatting) - isort: profile=black, line-length=88 - Pylint: migrated all settings from .pylintrc (max-line-length=120) - Pytest: pythonpath=["."] fixes import resolution - Removed .pylintrc (configuration moved to pyproject.toml) Benefits: - Run `pytest` directly without `python -m pytest` workaround - All tool configs in one standardized location - Modern Python packaging standards (PEP 517/518) - No configuration duplication 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent 36f135c commit 63bac57

2 files changed

Lines changed: 127 additions & 35 deletions

File tree

server/.pylintrc

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

server/pyproject.toml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# ============================================================================
2+
# DigiScript Server - Python Project Configuration
3+
# ============================================================================
4+
# This file consolidates configuration for all Python development tools.
5+
# Dependencies are dynamically read from requirements.txt files.
6+
# ============================================================================
7+
8+
[build-system]
9+
requires = ["setuptools>=61.0"]
10+
build-backend = "setuptools.build_meta"
11+
12+
[project]
13+
name = "digiscript-server"
14+
version = "0.1.0"
15+
description = "DigiScript server - Digital script management for theatrical shows"
16+
readme = "../README.md"
17+
requires-python = ">=3.13"
18+
# Dependencies are dynamically loaded from requirements.txt
19+
dynamic = ["dependencies", "optional-dependencies"]
20+
21+
[tool.setuptools.dynamic]
22+
dependencies = {file = ["requirements.txt"]}
23+
optional-dependencies.test = {file = ["test_requirements.txt"]}
24+
25+
# ============================================================================
26+
# PYTEST CONFIGURATION
27+
# ============================================================================
28+
[tool.pytest.ini_options]
29+
# Add the server directory to Python path so imports work correctly
30+
# This allows running `pytest` directly instead of `python -m pytest`
31+
pythonpath = ["."]
32+
33+
# Test discovery patterns
34+
testpaths = ["test"]
35+
python_files = ["test_*.py"]
36+
python_classes = ["Test*"]
37+
python_functions = ["test_*"]
38+
39+
# Asyncio configuration for pytest-asyncio
40+
asyncio_mode = "auto"
41+
asyncio_default_fixture_loop_scope = "function"
42+
43+
# Output options
44+
addopts = [
45+
"-v", # Verbose output
46+
"--tb=short", # Shorter traceback format
47+
"--strict-markers", # Ensure all markers are defined
48+
]
49+
50+
# Markers
51+
markers = [
52+
"asyncio: mark test as async",
53+
]
54+
55+
# ============================================================================
56+
# BLACK CONFIGURATION
57+
# ============================================================================
58+
[tool.black]
59+
# Use Black's default line-length of 88 to match existing codebase formatting
60+
line-length = 88
61+
target-version = ['py313']
62+
include = '\.pyi?$'
63+
extend-exclude = '''
64+
/(
65+
# Exclude alembic migrations
66+
| alembic_config/versions
67+
)/
68+
'''
69+
70+
# ============================================================================
71+
# ISORT CONFIGURATION
72+
# ============================================================================
73+
[tool.isort]
74+
profile = "black"
75+
# Match Black's line length of 88
76+
line_length = 88
77+
skip_gitignore = true
78+
extend_skip = ["alembic_config/versions"]
79+
known_first_party = ["digi_server", "models", "controllers", "utils", "schemas", "rbac", "registry"]
80+
81+
# ============================================================================
82+
# PYLINT CONFIGURATION
83+
# ============================================================================
84+
[tool.pylint.main]
85+
# Add current directory to path for imports
86+
init-hook = "from pylint.config import find_default_config_files; import sys; sys.path.append(next(find_default_config_files()).parent.as_posix())"
87+
88+
# Ignore patterns
89+
ignore-paths = [
90+
"^alembic_config/.*$",
91+
"^test/.*$",
92+
]
93+
94+
[tool.pylint."messages control"]
95+
disable = [
96+
"logging-fstring-interpolation",
97+
"missing-module-docstring",
98+
"missing-class-docstring",
99+
"missing-function-docstring",
100+
"too-few-public-methods",
101+
"duplicate-code",
102+
"too-many-return-statements",
103+
"too-many-branches",
104+
"too-many-statements",
105+
"unnecessary-lambda",
106+
"too-many-locals",
107+
"too-many-nested-blocks",
108+
"too-many-arguments",
109+
"unnecessary-dunder-call",
110+
"broad-exception-raised",
111+
"broad-exception-caught",
112+
"fixme",
113+
]
114+
115+
[tool.pylint.format]
116+
# Note: Pylint's max-line-length is 120 but Black enforces 88
117+
# This is intentional - Pylint checks logic, Black formats code
118+
max-line-length = 120
119+
120+
[tool.pylint.design]
121+
max-args = 15
122+
max-locals = 20
123+
max-returns = 20
124+
max-branches = 20
125+
max-statements = 50
126+
max-attributes = 20
127+
max-positional-arguments = 15

0 commit comments

Comments
 (0)