Skip to content

Commit 35f0196

Browse files
committed
chore(python): add ruff config and format
1 parent a684497 commit 35f0196

4 files changed

Lines changed: 39 additions & 12 deletions

File tree

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
from .TypeTreeGenerator import (
2-
TypeTreeGenerator as TypeTreeGenerator,
3-
TypeTreeNode as TypeTreeNode,
4-
TypeTreeNodeNative as TypeTreeNodeNative,
5-
)
1+
from .TypeTreeGenerator import TypeTreeBackend, TypeTreeGenerator, TypeTreeNode, TypeTreeNodeNative
62

73
version = __version__ = "0.0.5"
4+
5+
__all__ = [
6+
"__version__",
7+
"version",
8+
"TypeTreeBackend",
9+
"TypeTreeGenerator",
10+
"TypeTreeNode",
11+
"TypeTreeNodeNative",
12+
]

bindings/python/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ version = { attr = "TypeTreeGeneratorAPI.__version__" }
1717
[tool.setuptools.package-data]
1818
TypeTreeGeneratorAPI = ["*.dll", "*.so", "*.dylib"]
1919

20+
[project.optional-dependencies]
21+
dev = ["ruff"]
22+
2023
[tool.cibuildwheel.linux]
2124
archs = ["x86_64", "aarch64", "armv7l"]
2225

bindings/python/ruff.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
target-version = "py37"
2+
line-length = 120
3+
4+
[lint]
5+
select = [
6+
# pycodestyle
7+
"E",
8+
# Pyflakes
9+
"F",
10+
# flake8-bugbear
11+
"B",
12+
# isort
13+
"I",
14+
]
15+
16+
[lint.pydocstyle]
17+
# Enforce numpy-style docstrings
18+
convention = "numpy"
19+
20+
[lint.per-file-ignores]
21+
# Ignore docstring requirements for test files
22+
"tests/**/*.py" = ["D"]

bindings/python/setup.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import os
22
import shutil
3-
from setuptools import setup
43
from typing import Tuple
54

5+
from setuptools import setup
6+
67
try:
78
from setuptools.command.bdist_wheel import bdist_wheel
89
except ImportError:
@@ -56,13 +57,9 @@ def run(self):
5657
if platform_tag.startswith("win"):
5758
net_rid = BDIST_TAG_MAP_WIN[platform_tag]
5859
elif platform_tag.startswith("macosx"):
59-
net_rid = next(
60-
(v for k, v in BDIST_TAG_MAP_MAC.items() if platform_tag.endswith(k))
61-
)
60+
net_rid = next((v for k, v in BDIST_TAG_MAP_MAC.items() if platform_tag.endswith(k)))
6261
else:
63-
net_rid = next(
64-
(v for k, v in BDIST_TAG_MAP_LINUX.items() if platform_tag.endswith(k))
65-
)
62+
net_rid = next((v for k, v in BDIST_TAG_MAP_LINUX.items() if platform_tag.endswith(k)))
6663
if "musllinux" in platform_tag:
6764
net_rid = net_rid.replace("-", "-musl-")
6865
copy_binary_files(net_rid)

0 commit comments

Comments
 (0)