I am using Jenkins to create a new build packages for Python.
My setup.py file is the following:
setup(
name = "my-package",
version = "1.0.0",
author = "Bob Bob",
description = "test",
packages=['my-package'],
install_requires=['sample1001']
)
We run:
python setup.py bdist_wheel
The resulting file is the following:
my_package-1.0.0-py3-none-any.whl
I know that by simple version change I can impact my wheel package name. But most of the time if some small change is being set we do not want to change the version field, but we would like to add timestamp to the existing name of the wheel package, so that we can have different build file (not to overwrite the previous one),
Can you please tell me - how I can add timestamp to wheel name? I cannot find that info anywhere...
Thanks a lot!
UPDATE: I tried solution suggested by Keith:
import os
from setuptools import setup, find_packages
from os.path import dirname,abspath
with open('Bundle/requirements.txt') as f:
requirements = f.read().splitlines()
def read(fname):
return open(os.path.join(dirname(dirname(abspath(__file__))), 'Readme.Md')).read()
setup(
name='fa-bundle',
version='1.0.0',
install_requires=requirements,
description='Bundle is a project that will replace old Package Manager',
long_description=read('Readme.Md'),
use_scm_version=True,
setup_requires=['setuptools_scm'],
long_description_content_type='text/markdown',
author='FCS',
python_requires=">=3.9, <4",
packages=find_packages()
)
Error:
Traceback (most recent call last):
File "/data/jenkins/pypi/fabundle/fa-bundle/base/setup.py", line 18, in <module>
setup(
File "/data/jenkins/pypi/fabundle/lib64/python3.9/site-packages/setuptools/__init__.py",
line 87, in setup
return distutils.core.setup(**attrs)
File "/data/jenkins/pypi/fabundle/lib64/python3.9/site-packages/setuptools/_distutils/core.py",
line 139, in setup
_setup_distribution = dist = klass(attrs)
File "/data/jenkins/pypi/fabundle/lib64/python3.9/site-packages/setuptools/dist.py",
line 476, in __init__
_Distribution.__init__(
File "/data/jenkins/pypi/fabundle/lib64/python3.9/site-packages/setuptools/_distutils/dist.py",
line 275, in __init__
self.finalize_options()
File "/data/jenkins/pypi/fabundle/lib64/python3.9/site-packages/setuptools/dist.py",
line 900, in finalize_options
ep(self)
File "/data/jenkins/pypi/fabundle/lib64/python3.9/site-packages/setuptools/dist.py",
line 920, in _finalize_setup_keywords
ep.load()(self, ep.name, value)
File "/data/jenkins/pypi/fabundle/fa-bundle/base/.eggs/setuptools_scm-7.0.4-py3.9.egg/setuptools_scm/integration.py",
line 90, in version_keyword
_assign_version(dist, config)
File "/data/jenkins/pypi/fabundle/fa-bundle/base/.eggs/setuptools_scm-7.0.4-py3.9.egg/setuptools_scm/integration.py",
line 62, in _assign_version
_version_missing(config)
File "/data/jenkins/pypi/fabundle/fa-bundle/base/.eggs/setuptools_scm-7.0.4-py3.9.egg/setuptools_scm/__init__.py",
line 109, in _version_missing
raise LookupError( LookupError: setuptools-scm was unable to detect version for /data/jenkins/pypi/fabundle/fa-bundle/base.
Make sure you're either building from a fully intact git repository or
PyPI tarballs. Most other sources (such as GitHub's tarballs, a git
checkout without the .git folder) don't contain the necessary metadata
and will not work.
For example, if you're using pip, instead of
https://github.com/user/proj/archive/master.zip use
git+https://github.com/user/proj.git#egg=proj