Skip to content

Commit aa3d3bf

Browse files
authored
Merge pull request #593 from zapta/develop
Assorted changes
2 parents a48718a + 9fc1372 commit aa3d3bf

Some content is hidden

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

72 files changed

+198
-226
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,9 @@ jobs:
2020
shell: bash
2121

2222
strategy:
23-
# max-parallel: 3
2423
matrix:
2524
os: [ubuntu-22.04, macos-latest, windows-latest]
26-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
27-
# Windows test are almost x10 slower on github so we drop the
28-
# less critical ones.
29-
exclude:
30-
- os: windows-latest
31-
python-version: '3.9'
32-
- os: windows-latest
33-
python-version: '3.10'
25+
python-version: ['3.11', '3.12', '3.13']
3426

3527
steps:
3628
- name: Checkout sources

.pylintrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Configuration file for pylint.
2+
3+
[MESSAGES CONTROL]
4+
# Do not warn about TODOs.
5+
disable=fixme
6+
7+
[SIMILARITIES]
8+
# Reducing the sensitivity of duplicate code (default is 4)
9+
min-similarity-lines=15

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[![][apio-logo]][wiki]
22

3-
[![PyPI Version][pypi-image]][pypi-url]
4-
[![Build Status][build-image]][build-url]
5-
[![License][license-image]][license-url]
3+
[![PyPI Version][pypi-image]][pypi-url]<br>
4+
[![License][license-image]][license-url]<br>
5+
[![Test](https://github.com/FPGAwars/apio/actions/workflows/test.yml/badge.svg)](https://github.com/FPGAwars/apio/actions/workflows/test.yml)<br>
6+
[![build-linux-x86-64-installer](https://github.com/FPGAwars/apio/actions/workflows/build-linux-x86-64-installer.yml/badge.svg)](https://github.com/FPGAwars/apio/actions/workflows/build-linux-x86-64-installer.yml)<br>
7+
[![build-darwin-arm64-installer](https://github.com/FPGAwars/apio/actions/workflows/build-darwin-arm64-installer.yml/badge.svg)](https://github.com/FPGAwars/apio/actions/workflows/build-darwin-arm64-installer.yml)<br>
8+
[![build-windows-amd64-installer](https://github.com/FPGAwars/apio/actions/workflows/build-windows-amd64-installer.yml/badge.svg)](https://github.com/FPGAwars/apio/actions/workflows/build-windows-amd64-installer.yml)
69

710
![][linux-logo]&nbsp;&nbsp;&nbsp;![][macosx-logo]&nbsp;&nbsp;&nbsp;![][windows-logo]&nbsp;&nbsp;&nbsp;![][ubuntu-logo]&nbsp;&nbsp;&nbsp;![][raspbian-logo]
811

apio/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
import sys
55

6-
# pylint: disable=import-outside-toplevel
7-
86

97
def main():
108
"""Apio starting point."""
119

10+
# pylint: disable=import-outside-toplevel
11+
1212
# -- Handle the case in which we run under pyinstaller and the pyinstaller
1313
# -- program was invoked to run the scons subprocess. This case doesn't
1414
# -- happen when running as a standard pip package.

apio/apio_context.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ class ApioContextScope(Enum):
8282
PROJECT_REQUIRED = 3
8383

8484

85-
# pylint: disable=too-many-instance-attributes
8685
class ApioContext:
8786
"""Apio context. Class for accessing apio resources and configurations."""
8887

88+
# pylint: disable=too-many-instance-attributes
89+
8990
def __init__(
9091
self,
9192
*,
@@ -554,8 +555,9 @@ def is_windows(self) -> bool:
554555
return "windows" in self.platform_id
555556

556557

557-
# pylint: disable=too-few-public-methods
558558
class _ProjectResolverImpl(ProjectResolver):
559+
# pylint: disable=too-few-public-methods
560+
559561
def __init__(self, apio_context: ApioContext):
560562
"""When ApioContext instances this object, ApioContext is fully
561563
constructed, except for the project field."""

apio/commands/apio_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@
7878
)
7979

8080

81-
# pylint: disable=too-many-locals
8281
@click.command(
8382
name="info",
8483
cls=ApioCommand,
@@ -98,6 +97,8 @@ def _info_cli(
9897
):
9998
"""Implements the 'apio apio info' command."""
10099

100+
# pylint: disable=too-many-locals
101+
101102
# -- Should have at list one section
102103
if not sections:
103104
cerror("Please list at least one section (e.g. --section boards).")

apio/commands/apio_boards.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
from apio.managers.examples import Examples
2525

2626

27-
# pylint: disable=duplicate-code
28-
# pylint: disable=too-many-instance-attributes
2927
@dataclass(frozen=True)
3028
class Entry:
3129
"""Holds the values of a single board report line."""
3230

31+
# pylint: disable=too-many-instance-attributes
32+
3333
board: str
3434
examples_count: str
3535
board_description: str
@@ -47,11 +47,11 @@ def sort_key(self):
4747
return (util.fpga_arch_sort_key(self.fpga_arch), self.board.lower())
4848

4949

50-
# R0914: Too many local variables (17/15)
51-
# pylint: disable=R0914
5250
def list_boards(apio_ctx: ApioContext, verbose: bool):
5351
"""Prints all the available board definitions."""
5452

53+
# pylint: disable=too-many-locals
54+
5555
# -- Get examples counts by board. This is a sparse dictionary.
5656
examples = Examples(apio_ctx)
5757
examples_counts: Dict[str, int] = examples.count_examples_by_board()
@@ -154,8 +154,6 @@ def list_boards(apio_ctx: ApioContext, verbose: bool):
154154

155155
# ------------- apio boards
156156

157-
# pylint: disable=duplicate-code
158-
159157

160158
# -- Text in the rich-text format of the python rich library.
161159
APIO_BOARDS_HELP = """

apio/commands/apio_build.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def cli(
7373
# -- Create the scons manager.
7474
scons = SCons(apio_ctx)
7575

76-
# pylint: disable=duplicate-code
7776
# -- Build the project with the given parameters
7877
exit_code = scons.build(
7978
Verbosity(all=verbose, synth=verbose_synth, pnr=verbose_pnr)

apio/commands/apio_examples.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def examples_sort_key(entry: ExampleInfo) -> Any:
4444
return (util.fpga_arch_sort_key(entry.fpga_arch), entry.name)
4545

4646

47-
# pylint: disable=duplicate-code
4847
def list_examples(apio_ctx: ApioContext, verbose: bool) -> None:
4948
"""Print all the examples available. Return a process exit
5049
code, 0 if ok, non zero otherwise."""

apio/commands/apio_fpgas.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
from apio.commands import options
2323

2424

25-
# pylint: disable=duplicate-code
26-
# pylint: disable=too-many-instance-attributes
2725
@dataclass(frozen=True)
2826
class Entry:
2927
"""A class to hold the field of a single line of the report."""
3028

29+
# pylint: disable=too-many-instance-attributes
30+
3131
fpga: str
3232
board_count: int
3333
fpga_arch: str
@@ -42,10 +42,11 @@ def sort_key(self):
4242
return (util.fpga_arch_sort_key(self.fpga_arch), self.fpga.lower())
4343

4444

45-
# pylint: disable=too-many-locals
4645
def list_fpgas(apio_ctx: ApioContext, verbose: bool):
4746
"""Prints all the available FPGA definitions."""
4847

48+
# pylint: disable=too-many-locals
49+
4950
# -- Collect a sparse dict with fpga ids to board count.
5051
boards_counts: Dict[str, int] = {}
5152
for board_info in apio_ctx.boards.values():
@@ -142,7 +143,6 @@ def list_fpgas(apio_ctx: ApioContext, verbose: bool):
142143

143144
# -------- apio fpgas
144145

145-
# pylint: disable=duplicate-code
146146

147147
# -- Text in the rich-text format of the python rich library.
148148
APIO_FPGAS_HELP = """

apio/commands/apio_graph.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@
6161
"""
6262

6363

64-
# pylint: disable=too-many-arguments
65-
# pylint: disable=too-many-positional-arguments
6664
@click.command(
6765
name="graph",
6866
cls=cmd_util.ApioCommand,
@@ -87,6 +85,10 @@ def cli(
8785
top_module: str,
8886
):
8987
"""Implements the apio graph command."""
88+
89+
# pylint: disable=too-many-arguments
90+
# pylint: disable=too-many-positional-arguments
91+
9092
# -- Make pylint happy.
9193
_ = (svg,)
9294

apio/commands/apio_info.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ def _options_cli(
219219
"""
220220

221221

222-
# pylint: disable=duplicate-code
223222
@click.command(
224223
name="resources",
225224
cls=ApioCommand,
@@ -291,7 +290,6 @@ def _resources_cli():
291290
"""
292291

293292

294-
# pylint: disable=duplicate-code
295293
@click.command(
296294
name="system",
297295
cls=ApioCommand,
@@ -446,8 +444,6 @@ def _platforms_cli():
446444
)
447445

448446

449-
# pylint: disable=duplicate-code
450-
# pylint: disable=too-many-locals
451447
@click.command(
452448
name="colors",
453449
cls=ApioCommand,
@@ -467,6 +463,8 @@ def _colors_cli(
467463
):
468464
"""Implements the 'apio info colors' command."""
469465

466+
# pylint: disable=too-many-locals
467+
470468
# -- Make pylint happy.
471469
_ = (rich_,)
472470

apio/commands/apio_lint.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
"""
7070

7171

72-
# pylint: disable=too-many-arguments
73-
# pylint: disable=too-many-positional-arguments
7472
@click.command(
7573
name="lint",
7674
cls=cmd_util.ApioCommand,
@@ -98,6 +96,9 @@ def cli(
9896
):
9997
"""Lint the verilog code."""
10098

99+
# pylint: disable=too-many-arguments
100+
# pylint: disable=too-many-positional-arguments
101+
101102
# -- Create the apio context.
102103
apio_ctx = ApioContext(
103104
scope=ApioContextScope.PROJECT_REQUIRED,

apio/commands/apio_packages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from apio.utils.cmd_util import ApioGroup, ApioSubgroup, ApioCommand
2121

2222

23-
# pylint: disable=duplicate-code
2423
def print_packages_report(apio_ctx: ApioContext) -> None:
2524
"""A common function to print the state of the packages."""
2625

apio/commands/apio_preferences.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def _list_themes_colors():
6161
print()
6262

6363

64-
# pylint: disable=duplicate-code
6564
def _list_preferences(apio_ctx: ApioContext):
6665
"""Lists the preferences."""
6766

apio/commands/apio_report.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"""
3232

3333

34-
# pylint: disable=duplicate-code
3534
@click.command(
3635
name="report",
3736
cls=cmd_util.ApioCommand,

apio/commands/apio_sim.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
# --------- apio sim
2323

24-
# pylint: disable=duplicate-code
2524

2625
# -- Text in the rich-text format of the python rich library.
2726
APIO_SIM_HELP = """

apio/commands/apio_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
# --------- apio test
2121

22-
# pylint: disable=duplicate-code
2322

2423
# -- Text in the rich-text format of the python rich library.
2524
APIO_TEST_HELP = """

apio/commands/options.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
# ----------------------------------
2626

2727

28-
# W0622: Redefining built-in 'help'
29-
# pylint: disable=W0622
3028
def force_option_gen(*, help: str):
3129
"""Generate a --force option with given help text."""
30+
31+
# W0622: Redefining built-in 'help'
32+
# pylint: disable=redefined-builtin
33+
3234
return click.option(
3335
"force", # Var name
3436
"-f",
@@ -39,10 +41,12 @@ def force_option_gen(*, help: str):
3941
)
4042

4143

42-
# W0622: Redefining built-in 'help'
43-
# pylint: disable=W0622
4444
def list_option_gen(*, help: str):
4545
"""Generate a --list option with given help text."""
46+
47+
# W0622: Redefining built-in 'help'
48+
# pylint: disable=redefined-builtin
49+
4650
return click.option(
4751
"list_", # Var name. Deconflicting from python builtin 'list'.
4852
"-l",
@@ -53,13 +57,15 @@ def list_option_gen(*, help: str):
5357
)
5458

5559

56-
# W0622: Redefining built-in 'help'
57-
# pylint: disable=W0622
5860
def top_module_option_gen(
5961
*,
6062
help: str = "Set the top level module name.",
6163
):
6264
"""Generate a --top-module option with given help text."""
65+
66+
# W0622: Redefining built-in 'help'
67+
# pylint: disable=redefined-builtin
68+
6369
return click.option(
6470
"top_module", # Var name.
6571
"-t",
@@ -74,6 +80,10 @@ def top_module_option_gen(
7480

7581
def dst_option_gen(*, help: str):
7682
"""Generate a --dst option with given help text."""
83+
84+
# W0622: Redefining built-in 'help'
85+
# pylint: disable=redefined-builtin
86+
7787
dst_option = click.option(
7888
"dst", # Var name.
7989
"-d",

apio/common/apio_console.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@ def __post_init__(self):
6464

6565
# NOTE: not declaring terminal_mode and theme_name is Optional[] because it
6666
# causes the tests to fail with python 3.9.
67-
# pylint: disable=global-statement
6867
def configure(
6968
*,
7069
terminal_mode: TerminalMode = None,
7170
theme_name: str = None,
7271
) -> None:
7372
"""Change the apio console settings."""
73+
74+
# pylint: disable=global-statement
75+
7476
global _state
7577

7678
# -- Force utf-8 output encoding. This is a workaround for rich library

0 commit comments

Comments
 (0)