1+ [build-system ]
2+ requires = [" setuptools>=42" , " wheel" , " setuptools_scm[toml]>=3.4" , " pkgconfig>=1.5.1" , " lxml>=3.8, !=4.7.0" ]
3+
14[tool .mypy ]
25files = [' src' ]
36ignore_missing_imports = false
@@ -19,32 +22,69 @@ warn_no_return = true
1922no_implicit_reexport = true
2023show_error_codes = true
2124
22- [tool .black ]
23- line_length = 130
24- skip-string-normalization = true
25- target_version = [' py39' ]
26- include = ' \.pyi?$'
27- exclude = '''
25+ [tool .ruff ]
26+ # Maximum line length, same as your original Black + Flake8 config
27+ line-length = 130
2828
29- (
30- /(
31- \.eggs # exclude a few common directories in the
32- | \.git # root of the project
33- | \.mypy_cache
34- | \.tox
35- | build
36- | dist
37- )/
38- )
39- '''
29+ # Target Python version (used for autofixes and style rules)
30+ target-version = " py39"
4031
41- [tool .isort ]
42- profile = ' black'
43- known_first_party = [' xmlsec' ]
44- known_third_party = [' lxml' , ' pytest' , ' _pytest' , ' hypothesis' ]
32+ # Enable rule categories:
33+ # E = pycodestyle (style issues, like indentation, whitespace, etc.)
34+ # F = pyflakes (unused imports, undefined names)
35+ # D = pydocstyle (docstring format/style issues)
36+ # I = isort (import sorting)
37+ # B = flake8-bugbear (common bugs & anti-patterns)
38+ # UP = pyupgrade (auto-upgrade syntax for newer Python)
39+ # SIM = flake8-simplify (simplifiable code patterns)
40+ # RUF = Ruff-native rules (extra, performance-optimized checks)
41+ select = [" E" , " F" , " D" , " I" , " B" , " UP" , " SIM" , " RUF" ]
4542
46- [build-system ]
47- requires = [' setuptools>=42' , ' wheel' , ' setuptools_scm[toml]>=3.4' , " pkgconfig>=1.5.1" , " lxml>=3.8, !=4.7.0" ]
43+ # Directories and files to exclude from linting and formatting
44+ exclude = [
45+ " .venv*" , # virtual environments
46+ " .git" , # git directory
47+ " build" , # build output
48+ " dist" , # distribution packages
49+ " libs" , # vendor libraries
50+ " .eggs" , # setuptools egg folders
51+ " .direnv*" , # direnv environments
52+ " *_pb2.pyi" # protobuf-generated type stubs
53+ ]
54+
55+ # File-specific rule ignores (equivalent to flake8's `per-file-ignores`)
56+ [tool .ruff .per-file-ignores ]
57+ "*.pyi" = [
58+ # Ignore formatting and import errors in stub files
59+ " E301" , # expected 1 blank line, found 0
60+ " E302" , # expected 2 blank lines, found 1
61+ " E305" , # expected 2 blank lines after class or function
62+ " E501" , # line too long
63+ " E701" , # multiple statements on one line
64+ " F401" , # unused import
65+ " F822" # undefined name in `__all__`
66+ ]
67+ "doc/source/conf.py" = [
68+ " D1" # missing docstring in public module/class/function
69+ ]
70+ "doc/source/examples/*.py" = [
71+ " D1" , # allow missing docstrings in examples
72+ " E501" # allow long lines in code examples
73+ ]
74+ "tests/*.py" = [
75+ " D1" # allow missing docstrings in test files
76+ ]
77+
78+ [tool .ruff .format ]
79+ # Always use single quotes (e.g., 'text' instead of "text")
80+ quote-style = " single"
81+
82+ # Format code with or without trailing commas
83+ # true = prefer trailing commas where valid
84+ skip-magic-trailing-comma = false
85+
86+ # Enforce Unix-style line endings (LF)
87+ line-ending = " lf"
4888
4989[tool .cibuildwheel ]
5090build = [
0 commit comments