Skip to content

Commit bbf573c

Browse files
author
jitsuineccles
authored
use setuptools git versioning (#11)
1 parent 90c3389 commit bbf573c

5 files changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ jobs:
2727
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
2828
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2929
run: |
30+
./scripts/version.sh
3031
python setup.py sdist bdist_wheel
3132
twine upload dist/*

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ dist/
77
*.xml
88
htmlcov/
99
.pylint.d/
10-
.cache/
10+
.cache/
11+
.eggs/

archivist/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
"""Archivist SDK
2+
3+
WARNING: Do **not** edit directly
4+
This file is auto-generated by ./scripts/version.sh
25
"""
6+
__version__ = "0.0.1"

scripts/version.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
#
3+
# inserts version into python package
4+
#
5+
version=$(python3 setup.py --version)
6+
7+
cat>archivist/__init__.py <<EOF
8+
"""Archivist SDK
9+
10+
WARNING: Do **not** edit directly
11+
This file is auto-generated by ./scripts/version.sh
12+
"""
13+
__version__ = "$version"
14+
EOF

setup.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
import os
77
from setuptools import setup, find_packages
88

9+
HERE = os.path.dirname(__file__)
910
REPO_URL = 'https://github.com/jitsuin-inc/archivist-python/'
1011
NAME = "jitsuin-archivist"
1112

12-
with open('README.md') as FF:
13+
with open(os.path.join(HERE, 'README.md')) as FF:
1314
DESC = FF.read()
1415

15-
with open('requirements.txt') as FF:
16+
with open(os.path.join(HERE, 'requirements.txt')) as FF:
1617
requirements=[f"{line.strip()}" for line in FF]
1718

1819
setup(
1920
name=NAME,
20-
version="0.1.0alpha3",
2121
author="Jitsuin Inc.",
2222
author_email="support@jitsuin.com",
2323
description="Jitsuin Archivist Client",
@@ -36,6 +36,15 @@
3636
'Topic :: Utilities' # https://pypi.org/classifiers/ # check another option client-sdk
3737
],
3838
install_requires=requirements,
39+
version_config={
40+
"template": "{tag}",
41+
"dev_template": "{tag}.post{ccount}+git.{sha}",
42+
"dirty_template": "{tag}.post{ccount}+git.{sha}.dirty",
43+
"version_callback": None,
44+
"version_file": None,
45+
"count_commits_from_version_file": False,
46+
},
47+
setup_requires=['setuptools-git-versioning'],
3948
python_requires='>=3.6',
4049
entry_points={
4150
'console_scripts': [

0 commit comments

Comments
 (0)