Skip to content

Commit ade67ab

Browse files
authored
Bump version to 1.2.0 and switch to ruff for formatting (#1395)
* apply ruff to latest main * apply ruff to latest main * bump version number
1 parent b493ea7 commit ade67ab

File tree

167 files changed

+1026
-1073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+1026
-1073
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
exclude: (^hls4ml\/templates\/(vivado|quartus)\/(ap_types|ac_types)\/|^test/pytest/test_report/)
22

33
repos:
4-
- repo: https://github.com/psf/black-pre-commit-mirror
5-
rev: 25.9.0
4+
- repo: https://github.com/astral-sh/ruff-pre-commit
5+
rev: v0.14.3
66
hooks:
7-
- id: black
8-
language_version: python3
9-
args: ['--line-length=125',
10-
'--skip-string-normalization']
7+
- id: ruff
8+
args: [--fix]
9+
- id: ruff-format
1110

1211
- repo: https://github.com/tox-dev/pyproject-fmt
1312
rev: v2.11.0
@@ -29,11 +28,6 @@ repos:
2928
- id: requirements-txt-fixer
3029
- id: trailing-whitespace
3130

32-
- repo: https://github.com/PyCQA/isort
33-
rev: 7.0.0
34-
hooks:
35-
- id: isort
36-
3731
- repo: https://github.com/asottile/pyupgrade
3832
rev: v3.21.0
3933
hooks:
@@ -47,7 +41,9 @@ repos:
4741
exclude: docs/conf.py
4842
additional_dependencies: [flake8-bugbear, flake8-print]
4943
args: ['--max-line-length=125', # github viewer width
50-
'--extend-ignore=E203,T201', # E203 is not PEP8 compliant
44+
'--extend-ignore=E203,T201,F401',
45+
# E203 is not PEP8 compliant
46+
# F401 included in ruff (behaves slightly differently for noqa flags)
5147
'--per-file-ignores=hls4ml/model/optimizer/passes/bit_exact.py:E741',
5248
# i for #int w/o sign, I for #int w/ sign when massively processing bw conversions
5349
]

CITATION.cff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ type: software
44
authors:
55
- given-names: "FastML Team"
66
title: "hls4ml"
7-
version: "v1.1.0"
8-
date-released: "2025-03-17"
7+
version: "v1.2.0"
8+
date-released: "2025-10-31"
99
doi: 10.5281/zenodo.1201549
1010
repository-code: "https://github.com/fastmachinelearning/hls4ml"
1111
url: "https://fastmachinelearning.org/hls4ml"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ If you use this software in a publication, please cite the software
7575
title = {fastmachinelearning/hls4ml},
7676
year = 2025,
7777
publisher = {Zenodo},
78-
version = {v1.1.0},
78+
version = {v1.2.0},
7979
doi = {10.5281/zenodo.1201549},
8080
url = {https://github.com/fastmachinelearning/hls4ml}
8181
}

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def get_pypi_version(package, url_pattern=URL_PATTERN):
100100

101101
# -- Extension configuration -------------------------------------------------
102102
html_show_sourcelink = False
103-
html_logo = "img/hls4ml_logo_navbar.png"
103+
html_logo = 'img/hls4ml_logo_navbar.png'
104104

105105
html_theme_options = {
106106
'canonical_url': '',
@@ -121,7 +121,7 @@ def get_pypi_version(package, url_pattern=URL_PATTERN):
121121
html_context = {
122122
'display_github': True, # Integrate GitHub
123123
'github_user': 'fastmachinelearning', # Username
124-
'github_repo': "hls4ml", # Repo name
124+
'github_repo': 'hls4ml', # Repo name
125125
'github_version': 'main', # Version
126126
'conf_py_path': '/docs/', # Path in the checkout to the docs root
127127
}

hls4ml/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from ._version import version as __version__
55
from ._version import version_tuple
66
except ImportError:
7-
__version__ = "unknown version"
8-
version_tuple = (0, 0, "unknown version")
7+
__version__ = 'unknown version'
8+
version_tuple = (0, 0, 'unknown version')
99

1010

1111
def reseed(newseed):

hls4ml/backends/catapult/catapult_backend.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def build(
251251
ccs_args = f'"reset={reset} csim={csim} synth={synth} cosim={cosim} validation={validation}'
252252
ccs_args += f' export={export} vsynth={vsynth} fifo_opt={fifo_opt} bitfile={bitfile} ran_frame={ran_frame}'
253253
ccs_args += f' sw_opt={sw_opt} power={power} da={da} vhdl={vhdl} verilog={verilog} bup={bup}"'
254-
ccs_invoke = catapult_exe + ' -product ultra -shell -f build_prj.tcl -eval \'set ::argv ' + ccs_args + '\''
254+
ccs_invoke = catapult_exe + " -product ultra -shell -f build_prj.tcl -eval 'set ::argv " + ccs_args + "'"
255255
print(ccs_invoke)
256256
os.system(ccs_invoke)
257257
os.chdir(curr_dir)
@@ -455,9 +455,9 @@ def init_global_pooling2d(self, layer):
455455
@layer_optimizer(Softmax)
456456
def init_softmax(self, layer):
457457
if layer.model.config.get_config_value('IOType') == 'io_parallel':
458-
assert (
459-
len(layer.get_input_variable().shape) == 1
460-
), 'Softmax with io_parallel strategy cannot be used on multidimensional tensors.'
458+
assert len(layer.get_input_variable().shape) == 1, (
459+
'Softmax with io_parallel strategy cannot be used on multidimensional tensors.'
460+
)
461461

462462
@layer_optimizer(Embedding)
463463
def init_embed(self, layer):

hls4ml/backends/catapult/passes/broadcast_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
class Broadcast(Layer):
9-
'''Inserted between layers for broadcasting.'''
9+
"""Inserted between layers for broadcasting."""
1010

1111
def initialize(self):
1212
shape = self.attributes['target_shape']

hls4ml/backends/catapult/passes/conv_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class GenerateConvStreamingInstructions(OptimizerPass):
6-
'''Generates the instructions for streaming implementation of CNNs'''
6+
"""Generates the instructions for streaming implementation of CNNs"""
77

88
def match(self, node):
99
is_match = (

hls4ml/backends/catapult/passes/convolution_winograd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88

99
class ApplyWinogradKernelTransformation(OptimizerPass):
10-
'''
10+
"""
1111
Transforms the weights of a Conv2D kernel to a format suitable for Wingorad convolution
1212
For further information, refer to Lavin & Gray, 2015 - Fast Algorithms for Convolutional Neural Networks
13-
'''
13+
"""
1414

1515
def match(self, node):
1616
node_matches = isinstance(node, (Conv1D, Conv2D))

hls4ml/backends/catapult/passes/fifo_depth_optimization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def transform(self, model):
8282

8383
if len(data['children']) == 0:
8484
print(
85-
"FIFO depth optimization found no FIFOs implemented using BRAMs in the design, no optimization is possible."
85+
'FIFO depth optimization found no FIFOs implemented using BRAMs in the design, no optimization is possible.'
8686
)
87-
print("Consider increasing profiling_fifo_depth.")
87+
print('Consider increasing profiling_fifo_depth.')
8888
return False
8989

9090
n_elem = len(data['children'][0]['children'][0]['children'])

0 commit comments

Comments
 (0)