8000 Re-introduce setuptools-scm with correct usage (#206) · arangodb/python-arango@21c9e5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 21c9e5d

Browse files
authored
Re-introduce setuptools-scm with correct usage (#206)
1 parent 097f661 commit 21c9e5d

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

.github/workflows/pypi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Install dependencies
1717
run: |
1818
python -m pip install --upgrade pip
19-
pip install setuptools wheel twine
19+
pip install setuptools wheel twine setuptools-scm[toml]
2020
- name: Build distribution
2121
run: python setup.py sdist bdist_wheel
2222
- name: Publish to PyPI Test
@@ -28,4 +28,4 @@ jobs:
2828
env:
2929
TWINE_USERNAME: __token__
3030
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
31-
run: twine upload --repository pypi dist/*
31+
run: twine upload --repository pypi dist/*

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ node_modules/
118118
# direnv
119119
.envrc
120120
.direnv/
121+
122+
# setuptools_scm
123+
arango/version.py

arango/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from json import dumps, loads
44
from typing import Any, Callable, Optional, Sequence, Union
55

6+
from pkg_resources import get_distribution
7+
68
from arango.connection import (
79
BasicConnection,
810
Connection,
@@ -18,7 +20,6 @@
1820
RoundRobinHostResolver,
1921
SingleHostResolver,
2022
)
21-
from arango.version import version
2223

2324

2425
class ArangoClient:
@@ -113,6 +114,7 @@ def version(self) -> str:
113114
:return: Client version.
114115
:rtype: str
115116
"""
117+
version: str = get_distribution("python-arango").version
116118
return version
117119

118120
def db(

arango/version.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[build-system]
22
requires = [
33
"setuptools>=42",
4+
"setuptools_scm[toml]>=6.2",
45
"wheel",
56
]
67
build-backend = "setuptools.build_meta"
@@ -25,3 +26,6 @@ warn_return_any = true
2526
warn_unused_configs = true
2627
ignore_missing_imports = true
2728
strict = true
29+
30+
[tool.setuptools_scm]
31+
write_to = "arango/version.py"

setup.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,11 @@
33
with open("./README.md") as fp:
44
long_description = fp.read()
55

6-
version = {}
7-
with open("./arango/version.py") as fp:
8-
exec(fp.read(), version)
9-
106
setup(
117
name="python-arango",
128
description="Python Driver for ArangoDB",
139
long_description=long_description,
1410
long_description_content_type="text/markdown",
15-
version=version["version"],
1611
author="Joohwan Oh",
1712
author_email="joohwan.oh@outlook.com",
1813
url="https://github.com/ArangoDB-Community/python-arango",
@@ -43,6 +38,7 @@
4338
"sphinx_rtd_theme",
4439
"types-pkg_resources",
4540
"types-requests",
41+
"types-setuptools",
4642
],
4743
},
4844
classifiers=[

0 commit comments

Comments
 (0)
0