Skip to content

Commit d31d938

Browse files
authored
set version using setuptools_scm (#479)
* bump version * add pyproject.toml * update * update * update * gitignore update * try different scheme * lower tolerance pytest * Update setup.cfg
1 parent 1413c03 commit d31d938

File tree

6 files changed

+59
-62
lines changed

6 files changed

+59
-62
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
*.pyc
2+
_version.py
23
__pycache__
34
build/
45
dist/

hls4ml/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
from __future__ import absolute_import
22

3-
__version__ = '0.5.1'
4-
53
from hls4ml import converters
64
from hls4ml import report
75
from hls4ml import utils
86

7+
try:
8+
from ._version import version as __version__
9+
from ._version import version_tuple
10+
except ImportError:
11+
__version__ = "unknown version"
12+
version_tuple = (0, 0, "unknown version")
13+
914
def reseed(newseed):
1015
print('\npytest-randomly: reseed with {}'.format(newseed))
1116
try:

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[build-system]
2+
# AVOID CHANGING REQUIRES: IT WILL BE UPDATED BY PYSCAFFOLD!
3+
requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5", "wheel"]
4+
build-backend = "setuptools.build_meta"
5+
6+
[tool.setuptools_scm]
7+
# See configuration details in https://github.com/pypa/setuptools_scm
8+
version_scheme = "release-branch-semver"
9+
git_describe_command = "git describe --dirty --tags --long --match v* --first-parent"
10+
write_to = "hls4ml/_version.py"

setup.cfg

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,47 @@
11
[metadata]
22
description-file = README.md
3+
name = hls4ml
4+
author = hls4ml Team
5+
license = Apache 2.0
6+
description = Machine learning in FPGAs using HLS
7+
url = https://fastmachinelearning.org/hls4ml
8+
long_description = file: README.md
9+
long_description_content_type = text/markdown
10+
classifiers =
11+
Development Status :: 3 - Alpha
12+
Intended Audience :: Developers
13+
Intended Audience :: Science/Research
14+
License :: OSI Approved :: Apache Software License
15+
Programming Language :: C++
16+
Programming Language :: Python :: 3
17+
Programming Language :: Python :: 3.7
18+
Programming Language :: Python :: 3.8
19+
Programming Language :: Python :: 3.9
20+
Topic :: Software Development :: Libraries
21+
Topic :: Software Development :: Libraries :: Python Modules
322

423
[options]
524
python_requires = >=3.7
25+
packages = find:
26+
install_requires =
27+
numpy
28+
six
29+
pyyaml
30+
h5py
31+
onnx>=1.4.0
32+
calmjs.parse
33+
tabulate
34+
pydigitalwavetools==1.1
35+
qkeras
36+
include_package_data = True
37+
scripts = scripts/hls4ml
638

739
[options.entry_points]
840
pytest_randomly.random_seeder =
941
hls4ml = hls4ml:reseed
1042

43+
[options.extras_require]
44+
profiling =
45+
pandas
46+
seaborn
47+
matplotlib

setup.py

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,4 @@
1-
from setuptools import setup
2-
from setuptools import find_packages
1+
import setuptools
32

4-
import codecs
5-
import os.path
6-
7-
def read(rel_path):
8-
this_directory = os.path.abspath(os.path.dirname(__file__))
9-
with codecs.open(os.path.join(this_directory, rel_path), 'r') as fp:
10-
return fp.read()
11-
12-
def get_version(rel_path):
13-
for line in read(rel_path).splitlines():
14-
if line.startswith('__version__'):
15-
delim = '"' if '"' in line else "'"
16-
return line.split(delim)[1]
17-
else:
18-
raise RuntimeError("Unable to find version string.")
19-
20-
setup(name='hls4ml',
21-
version=get_version("hls4ml/__init__.py"),
22-
description='Machine learning in FPGAs using HLS',
23-
long_description=read('README.md'),
24-
long_description_content_type='text/markdown',
25-
author='HLS4ML Team',
26-
author_email='[email protected]',
27-
url='https://github.com/hls-fpga-machine-learning/hls4ml',
28-
license='Apache 2.0',
29-
install_requires=[
30-
'numpy',
31-
'six',
32-
'pyyaml',
33-
'h5py',
34-
'onnx>=1.4.0',
35-
'calmjs.parse',
36-
'tabulate',
37-
'pydigitalwavetools==1.1',
38-
'qkeras',
39-
],
40-
extras_require={
41-
'profiling': [
42-
'pandas',
43-
'seaborn',
44-
'matplotlib'
45-
]
46-
},
47-
scripts=['scripts/hls4ml'],
48-
include_package_data=True,
49-
classifiers=[
50-
'Development Status :: 3 - Alpha',
51-
'Intended Audience :: Developers',
52-
'Intended Audience :: Science/Research',
53-
'License :: OSI Approved :: Apache Software License',
54-
'Programming Language :: C++',
55-
'Programming Language :: Python :: 3',
56-
'Programming Language :: Python :: 3.6',
57-
'Topic :: Software Development :: Libraries',
58-
'Topic :: Software Development :: Libraries :: Python Modules'
59-
],
60-
packages=find_packages())
3+
if __name__ == "__main__":
4+
setuptools.setup()

test/pytest/test_qkeras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def test_qactivation_kwarg(randX_100_10,
305305
np.testing.assert_allclose(
306306
y_qkeras.ravel(),
307307
y_hls4ml.ravel(),
308-
atol=2**-eval(activation_quantizer).bits,
308+
atol=2**-(eval(activation_quantizer).bits-1),
309309
rtol=1.0
310310
)
311311
else:

0 commit comments

Comments
 (0)