Skip to content

set version using setuptools_scm #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
_version.py
__pycache__
build/
dist/
Expand Down
9 changes: 7 additions & 2 deletions hls4ml/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
from __future__ import absolute_import

__version__ = '0.5.1'

from hls4ml import converters
from hls4ml import report
from hls4ml import utils

try:
from ._version import version as __version__
from ._version import version_tuple
except ImportError:
__version__ = "unknown version"
version_tuple = (0, 0, "unknown version")

def reseed(newseed):
print('\npytest-randomly: reseed with {}'.format(newseed))
try:
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
# AVOID CHANGING REQUIRES: IT WILL BE UPDATED BY PYSCAFFOLD!
requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# See configuration details in https://github.com/pypa/setuptools_scm
version_scheme = "release-branch-semver"
git_describe_command = "git describe --dirty --tags --long --match v* --first-parent"
write_to = "hls4ml/_version.py"
38 changes: 38 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
[metadata]
description-file = README.md
name = hls4ml
author = HLS4ML Team
author_email = [email protected]
license = Apache 2.0
description = Machine learning in FPGAs using HLS
url = https://fastmachinelearning.org/hls4ml
long_description = file: README.md
long_description_content_type = text/markdown
classifiers =
Development Status :: 3 - Alpha
Intended Audience :: Developers
Intended Audience :: Science/Research
License :: OSI Approved :: Apache Software License
Programming Language :: C++
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Topic :: Software Development :: Libraries
Topic :: Software Development :: Libraries :: Python Modules

[options]
python_requires = >=3.7
packages = find:
install_requires =
numpy
six
pyyaml
h5py
onnx>=1.4.0
calmjs.parse
tabulate
pydigitalwavetools==1.1
qkeras
include_package_data = True
scripts = scripts/hls4ml

[options.entry_points]
pytest_randomly.random_seeder =
hls4ml = hls4ml:reseed

[options.extras_require]
profiling =
pandas
seaborn
matplotlib
62 changes: 3 additions & 59 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,60 +1,4 @@
from setuptools import setup
from setuptools import find_packages
import setuptools

import codecs
import os.path

def read(rel_path):
this_directory = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(this_directory, rel_path), 'r') as fp:
return fp.read()

def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
else:
raise RuntimeError("Unable to find version string.")

setup(name='hls4ml',
version=get_version("hls4ml/__init__.py"),
description='Machine learning in FPGAs using HLS',
long_description=read('README.md'),
long_description_content_type='text/markdown',
author='HLS4ML Team',
author_email='[email protected]',
url='https://github.com/hls-fpga-machine-learning/hls4ml',
license='Apache 2.0',
install_requires=[
'numpy',
'six',
'pyyaml',
'h5py',
'onnx>=1.4.0',
'calmjs.parse',
'tabulate',
'pydigitalwavetools==1.1',
'qkeras',
],
extras_require={
'profiling': [
'pandas',
'seaborn',
'matplotlib'
]
},
scripts=['scripts/hls4ml'],
include_package_data=True,
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: C++',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules'
],
packages=find_packages())
if __name__ == "__main__":
setuptools.setup()
2 changes: 1 addition & 1 deletion test/pytest/test_qkeras.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def test_qactivation_kwarg(randX_100_10,
np.testing.assert_allclose(
y_qkeras.ravel(),
y_hls4ml.ravel(),
atol=2**-eval(activation_quantizer).bits,
atol=2**-(eval(activation_quantizer).bits-1),
rtol=1.0
)
else:
Expand Down