From b6b50f5239af08c8af7f2b817527ac3c5d4da84c Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Wed, 24 May 2023 21:33:14 -0700 Subject: [PATCH] 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 --- setup.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 639829a2554..404479668b3 100644 --- a/setup.py +++ b/setup.py @@ -14,13 +14,30 @@ # ============================================================================== """tensorflow_docs is a package for generating python api-reference docs.""" +import datetime +import subprocess import sys from setuptools import find_packages from setuptools import setup project_name = 'tensorflow-docs' -version = '0.0.0.dev0' + + +def get_version() -> str: + ts = int( + subprocess.check_output(['git', 'log', '-1', '--format=%ct', 'tools']) + .decode('utf-8') + .strip() + ) + dt = datetime.datetime.utcfromtimestamp(ts) + sec = 60 * 60 * dt.hour + 60 * dt.minute + dt.second + + # calver.org + return f'{dt.year}.{dt.month}.{dt.day}.{sec}' + + +version = get_version() DOCLINES = __doc__.split('\n') @@ -42,7 +59,7 @@ # https://setuptools.readthedocs.io/en/latest/setuptools.html#new-and-changed-setup-keywords setup( name=project_name, - python_requires='>=3.8', + python_requires='>=3.9', version=version, description=DOCLINES[0], long_description='\n'.join(DOCLINES[2:]),