Skip to content

Commit 119556c

Browse files
committed
Moved the metadata into setup.cfg
Added `pyproject.toml` Replaced fetching version from a file with fetching a version from version control system tags. Also fixed a bug with incorrect content of `__all__` in `__main__.py`
1 parent 1c97c6d commit 119556c

File tree

6 files changed

+55
-53
lines changed

6 files changed

+55
-53
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
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+
def convert_version_info(version: str) -> (int, ..., str):
8+
version_info = version.split(".")
9+
for i in range(len(version_info)):
10+
try:
11+
version_info[i] = int(version_info[i])
12+
except ValueError:
13+
version_info[i] = version_info[i].split("+")[0]
14+
version_info = version_info[:i + 1]
15+
break
16+
17+
return tuple(version_info)
18+
19+
_version.VERSION_INFO = convert_version_info(__version__)
20+
21+
__all__ = ("__version__",)

pylsp_jsonrpc/_version.py

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

pyproject.toml

Lines changed: 7 additions & 0 deletions
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

Lines changed: 29 additions & 0 deletions
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

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

0 commit comments

Comments
 (0)