Skip to content

Commit 46b2bb7

Browse files
authored
Move the package metadata from setup.py to setup.cfg (#8)
1 parent a45c165 commit 46b2bb7

File tree

6 files changed

+57
-53
lines changed

6 files changed

+57
-53
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# autogenerated version file
2+
/pylsp_jsonrpc/_version.py
3+
14
# Byte-compiled / optimized / DLL files
25
__pycache__/
36
*.py[cod]

pylsp_jsonrpc/__init__.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# Copyright 2017-2020 Palantir Technologies, Inc.
22
# Copyright 2021- Python Language Server Contributors.
33

4+
from . import _version
45
from ._version import __version__
56

6-
__all__ = [__version__]
7+
8+
def convert_version_info(version: str) -> (int, ..., str):
9+
version_info = version.split(".")
10+
for i in range(len(version_info)): # pylint:disable=consider-using-enumerate
11+
try:
12+
version_info[i] = int(version_info[i])
13+
except ValueError:
14+
version_info[i] = version_info[i].split("+")[0]
15+
version_info = version_info[: i + 1]
16+
break
17+
18+
return tuple(version_info)
19+
20+
21+
_version.VERSION_INFO = convert_version_info(__version__)
22+
23+
__all__ = ("__version__",)

pylsp_jsonrpc/_version.py

-5
This file was deleted.

pyproject.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
requires = ["setuptools>=44", "wheel", "setuptools_scm[toml]>=3.4.3"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
write_to = "pylsp_jsonrpc/_version.py"
7+
write_to_template = "__version__ = \"{version}\"\n" # VERSION_INFO is populated in __main__

setup.cfg

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
[metadata]
2+
name = python-lsp-jsonrpc
3+
author = Python Language Server Contributors
4+
description = JSON RPC 2.0 server library
5+
url = https://github.com/python-lsp/python-lsp-jsonrpc
6+
long_description = file: README.md
7+
long_description_content_type = text/markdown
8+
9+
10+
[options]
11+
packages = find:
12+
setup_requires = setuptools>=44; wheel; setuptools_scm[toml]>=3.4.3
13+
install_requires = ujson>=3.0.0
14+
15+
[options.packages.find]
16+
exclude =
17+
contrib
18+
docs
19+
test
20+
test.*
21+
22+
[options.extras_require]
23+
test =
24+
pylint
25+
pycodestyle
26+
pyflakes
27+
pytest
28+
pytest-cov
29+
coverage
130

231
[pycodestyle]
332
ignore = E226, E722, W504

setup.py

-47
This file was deleted.

0 commit comments

Comments
 (0)