Skip to content

Commit 8648c94

Browse files
committed
Complete pyproject.toml and use hatch as the packaging tool
1 parent 9cbfd51 commit 8648c94

File tree

8 files changed

+123
-171
lines changed

8 files changed

+123
-171
lines changed

pyproject.toml

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,92 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
[build-system]
18+
requires = ["hatchling", "hatch-fancy-pypi-readme"]
19+
build-backend = "hatchling.build"
20+
21+
[project]
22+
name="dubbo-python"
23+
requires-python = ">=3.9"
24+
authors = [
25+
{name = "Apache Dubbo Community", email = "[email protected]"}
26+
]
27+
maintainers = [
28+
{name = "Apache Dubbo Community", email = "[email protected]"}
29+
]
30+
description = "Python Implementation For Apache Dubbo."
31+
license = "Apache-2.0"
32+
license-files = ["LICEN[CS]E.*"]
33+
keywords=["dubbo", "rpc","grpc", "dubbo-python", "http2", "network"]
34+
classifiers=[
35+
"Development Status :: 4 - Beta",
36+
"Intended Audience :: Developers",
37+
"License :: OSI Approved :: Apache Software License",
38+
"Operating System :: OS Independent",
39+
"Programming Language :: Python :: 3",
40+
"Programming Language :: Python :: 3 :: Only",
41+
"Programming Language :: Python :: 3.9",
42+
"Programming Language :: Python :: 3.10",
43+
"Programming Language :: Python :: 3.11",
44+
"Framework :: AsyncIO",
45+
"Topic :: Internet",
46+
"Topic :: Internet :: WWW/HTTP",
47+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
48+
"Topic :: Software Development :: Libraries",
49+
"Topic :: Software Development :: Libraries :: Python Modules",
50+
"Topic :: System :: Networking",
51+
]
52+
53+
dependencies = [
54+
"h2>=4.1.0",
55+
"uvloop>=0.19.0; platform_system!='Windows'",
56+
"psutil>=6.0.0",
57+
]
58+
dynamic = ["version", "readme"]
59+
60+
61+
[project.urls]
62+
Homepage = "https://cn.dubbo.apache.org"
63+
Documentation = "https://cn.dubbo.apache.org/en/overview/mannual/python-sdk/"
64+
Repository = "https://github.com/apache/dubbo-python"
65+
Issues = "https://github.com/apache/dubbo/issues"
66+
67+
[project.optional-dependencies]
68+
zookeeper = [
69+
"kazoo>=2.10.0",
70+
]
71+
72+
dev=[
73+
"hatch>=1.14.0",
74+
"ruff>=0.9.1",
75+
"mypy>=1.14.1",
76+
"pytest>=8.3.4",
77+
"coverage[toml]>=7.6.10",
78+
]
79+
80+
81+
### Hatch settings ###
82+
[tool.hatch.version]
83+
path = "src/dubbo/__about__.py"
84+
85+
[tool.hatch.build.targets.sdist]
86+
include = [
87+
"/src",
88+
"/tests",
89+
"/README.md",
90+
]
91+
92+
[tool.hatch.build.targets.wheel]
93+
packages = ["src/dubbo"]
94+
95+
96+
[tool.hatch.metadata.hooks.fancy-pypi-readme]
97+
content-type = "text/markdown"
98+
99+
[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]]
100+
path = "README.md"
101+
102+
17103

18104
### Ruff settings ###
19105

@@ -56,6 +142,39 @@ section-order = [
56142
"local-folder"
57143
]
58144

145+
### Coverage settings ###
146+
[tool.coverage.run]
147+
branch = true
148+
relative_files = true
149+
include = ["src/dubbo/*"]
150+
151+
[tool.coverage.report]
152+
# Skip coverage report for 100% covered files
153+
skip_covered = true
154+
exclude_also = [
155+
"def __repr__",
156+
"raise AssertionError",
157+
"raise NotImplementedError",
158+
"if __name__ == .__main__.:",
159+
"@(abc\\.)?abstractmethod",
160+
"@(typing(_extensions)?\\.)?overload",
161+
"if (typing(_extensions)?\\.)?TYPE_CHECKING:"
162+
]
163+
59164

165+
### Mypy settings ###
60166
[tool.mypy]
61-
files = "src"
167+
ignore_missing_imports = true
168+
169+
[[tool.mypy.overrides]]
170+
module = "tests.*"
171+
disallow_untyped_defs = false
172+
check_untyped_defs = true
173+
174+
### Pytest settings ###
175+
[tool.pytest]
176+
addopts = "-rxXs"
177+
testpaths = ["tests"]
178+
python_files = [
179+
"test_*.py"
180+
]

requirements.txt

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

setup.py

Lines changed: 0 additions & 64 deletions
This file was deleted.
File renamed without changes.

src/dubbo/cluster/_interfaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Directory(Node, abc.ABC):
2828
"""
2929

3030
@abc.abstractmethod
31-
def list(self, invocation: Invocation) -> list[Invoker]:
31+
def get_list(self, invocation: Invocation) -> list[Invoker]:
3232
"""
3333
List the directory.
3434
:param invocation: The invocation.

src/dubbo/cluster/directories.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __init__(self, registry: Registry, protocol: Protocol, url: URL):
3636
# subscribe
3737
self._registry.subscribe(url, self)
3838

39-
def list(self, invocation) -> list[Invoker]:
39+
def get_list(self, invocation) -> list[Invoker]:
4040
return list(self._invokers.values())
4141

4242
def notify(self, urls: list[URL]) -> None:

src/dubbo/cluster/failfast_cluster.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(self, directory, url: URL):
4040

4141
def invoke(self, invocation) -> Result:
4242
# get the invokers
43-
invokers = self._directory.list(invocation)
43+
invokers = self._directory.get_list(invocation)
4444
if not invokers:
4545
raise RpcError("No provider available for the service")
4646

tests/test_utils.py

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

0 commit comments

Comments
 (0)