Skip to content

Commit b6b50f5

Browse files
MarkDaoustcopybara-github
authored andcommitted
Add automatic version numbers for tensorflow_docs.
And drop 3.8 from supported list. Tested: ``` Successfully installed tensorflow-docs-2023.5.24.56664 ``` PiperOrigin-RevId: 535095942
1 parent 47be943 commit b6b50f5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

setup.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,30 @@
1414
# ==============================================================================
1515
"""tensorflow_docs is a package for generating python api-reference docs."""
1616

17+
import datetime
18+
import subprocess
1719
import sys
1820

1921
from setuptools import find_packages
2022
from setuptools import setup
2123

2224
project_name = 'tensorflow-docs'
23-
version = '0.0.0.dev0'
25+
26+
27+
def get_version() -> str:
28+
ts = int(
29+
subprocess.check_output(['git', 'log', '-1', '--format=%ct', 'tools'])
30+
.decode('utf-8')
31+
.strip()
32+
)
33+
dt = datetime.datetime.utcfromtimestamp(ts)
34+
sec = 60 * 60 * dt.hour + 60 * dt.minute + dt.second
35+
36+
# calver.org
37+
return f'{dt.year}.{dt.month}.{dt.day}.{sec}'
38+
39+
40+
version = get_version()
2441

2542
DOCLINES = __doc__.split('\n')
2643

@@ -42,7 +59,7 @@
4259
# https://setuptools.readthedocs.io/en/latest/setuptools.html#new-and-changed-setup-keywords
4360
setup(
4461
name=project_name,
45-
python_requires='>=3.8',
62+
python_requires='>=3.9',
4663
version=version,
4764
description=DOCLINES[0],
4865
long_description='\n'.join(DOCLINES[2:]),

0 commit comments

Comments
 (0)