diff --git a/.github/workflows/pr-python.yml b/.github/workflows/pr-python.yml index c284f5d78..1b2b78755 100644 --- a/.github/workflows/pr-python.yml +++ b/.github/workflows/pr-python.yml @@ -18,63 +18,63 @@ jobs: outputs: should_skip: ${{ steps.skip_check.outputs.should_skip }} steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - paths: '[ - "compiler/**", - "edg_core/**", - "electronics_model/**", - "electronics_abstract_parts/**", - "electronics_lib/**", - "edg/**", - "examples/**.py" - ]' + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + paths: '[ + "compiler/**", + "edg_core/**", + "electronics_model/**", + "electronics_abstract_parts/**", + "electronics_lib/**", + "edg/**", + "examples/**.py" + ]' - black_latest_3_11: + black_latest_3_13: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: - python-version: '3.11' + python-version: '3.13' - - name: install mypy + - name: install black run: | pip install -r requirements.txt pip install black - name: black run: black --check . - mypy_latest_3_11: + mypy_latest_3_13: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - with: - python-version: '3.11' + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: '3.13' - - name: install mypy - run: | - pip install -r requirements.txt - pip install mypy mypy-protobuf - mypy --version - - name: mypy - run: mypy --install-types . + - name: install mypy + run: | + pip install -r requirements.txt + pip install mypy mypy-protobuf + mypy --version + - name: mypy + run: mypy --install-types . - packagetest_latest_3_11: + packagetest_latest_3_13: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: - python-version: '3.11' + python-version: '3.13' - name: install dependencies run: pip install -r requirements.txt @@ -85,30 +85,30 @@ jobs: - name: toptest run: cd examples && python test_blinky.py - unittest_latest_3_11: + unittest_latest_3_13: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 - with: - python-version: '3.11' + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 + with: + python-version: '3.13' - - name: install dependencies - run: pip install -r requirements.txt - - name: unittest - run: python -m unittest discover + - name: install dependencies + run: pip install -r requirements.txt + - name: unittest + run: python -m unittest discover - unittest_latest_3_9: + unittest_latest_3_10: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-python@v1 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: - python-version: '3.9' + python-version: '3.10' - name: install dependencies run: pip install -r requirements.txt diff --git a/.github/workflows/pr-scala.yml b/.github/workflows/pr-scala.yml index fde080762..196aec031 100644 --- a/.github/workflows/pr-scala.yml +++ b/.github/workflows/pr-scala.yml @@ -17,37 +17,37 @@ jobs: outputs: should_skip: ${{ steps.skip_check.outputs.should_skip }} steps: - - id: skip_check - uses: fkirc/skip-duplicate-actions@master - with: - paths: '["compiler/**"]' + - id: skip_check + uses: fkirc/skip-duplicate-actions@master + with: + paths: '["compiler/**"]' sbt: needs: pre_job if: ${{ needs.pre_job.outputs.should_skip != 'true' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Setup JDK - uses: actions/setup-java@v2 - with: - distribution: temurin - java-version: 17 - - uses: actions/setup-python@v1 - with: - python-version: '3.10' - - name: Setup sbt launcher - uses: sbt/setup-sbt@v1 - - name: install dependencies - run: pip install -r requirements.txt - - name: sbt test - run: cd compiler && sbt -v +test + - uses: actions/checkout@v6 + - name: Setup JDK + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 17 + - uses: actions/setup-python@v6 + with: + python-version: '3.13' + - name: Setup sbt launcher + uses: sbt/setup-sbt@v1 + - name: install dependencies + run: pip install -r requirements.txt + - name: sbt test + run: cd compiler && sbt -v +test scalafmt-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Checking the code with scalafmt - uses: AvaPL/scalafmt-native-formatter@v0 - with: - conf-path: compiler/.scalafmt.conf + - uses: actions/checkout@v6 + - name: Checking the code with scalafmt + uses: AvaPL/scalafmt-native-formatter@v0 + with: + conf-path: compiler/.scalafmt.conf diff --git a/edg/BoardCompiler.py b/edg/BoardCompiler.py index b0735a838..835b85c5c 100644 --- a/edg/BoardCompiler.py +++ b/edg/BoardCompiler.py @@ -12,7 +12,7 @@ def compile_board(design: Type[Block], target_dir_name: Optional[Tuple[str, str]]) -> CompiledDesign: if target_dir_name is not None: - (target_dir, target_name) = target_dir_name + target_dir, target_name = target_dir_name if not os.path.exists(target_dir): os.makedirs(target_dir) assert os.path.isdir(target_dir), f"target_dir {target_dir} to compile_board must be directory" diff --git a/edg/abstract_parts/AbstractLed.py b/edg/abstract_parts/AbstractLed.py index 7e7f1c662..c4460d16d 100644 --- a/edg/abstract_parts/AbstractLed.py +++ b/edg/abstract_parts/AbstractLed.py @@ -9,7 +9,6 @@ from .PartsTablePart import PartsTableSelector from .StandardFootprint import StandardFootprint, HasStandardFootprint - LedColor = str # type alias LedColorLike = StringLike # type alias diff --git a/edg/abstract_parts/ESeriesUtil.py b/edg/abstract_parts/ESeriesUtil.py index c30cfa575..55f1f4059 100644 --- a/edg/abstract_parts/ESeriesUtil.py +++ b/edg/abstract_parts/ESeriesUtil.py @@ -6,7 +6,6 @@ from ..electronics_model import * - SeriesDefaultType = TypeVar("SeriesDefaultType") diff --git a/edg/abstract_parts/PassiveConnector.py b/edg/abstract_parts/PassiveConnector.py index 6dabf617c..7409a6e6c 100644 --- a/edg/abstract_parts/PassiveConnector.py +++ b/edg/abstract_parts/PassiveConnector.py @@ -60,5 +60,5 @@ def generate(self) -> None: # TODO ideally this is require, but we don't support set ops in the IR assert length in self.allowed_pins, f"requested length {length} outside allowed length {self.allowed_pins}" - (footprint, mfr, part) = self.part_footprint_mfr_name(length) + footprint, mfr, part = self.part_footprint_mfr_name(length) self.footprint("J", footprint, {pin_name: pin_port for (pin_name, pin_port) in self.pins.items()}, mfr, part) diff --git a/edg/abstract_parts/StandardFootprint.py b/edg/abstract_parts/StandardFootprint.py index 12337cb77..b52b3bca3 100644 --- a/edg/abstract_parts/StandardFootprint.py +++ b/edg/abstract_parts/StandardFootprint.py @@ -3,7 +3,6 @@ from ..electronics_model import * - StandardPinningType = TypeVar("StandardPinningType", bound=Block) PinningFunction = Callable[[StandardPinningType], Dict[str, CircuitPort]] diff --git a/edg/core/Blocks.py b/edg/core/Blocks.py index 85fa44576..06946377a 100644 --- a/edg/core/Blocks.py +++ b/edg/core/Blocks.py @@ -106,7 +106,7 @@ def add_ports(self, ports: Iterable[BasePort]) -> None: elif len(self.ports) == 2: is_export = self._is_export() if is_export: - (ext_port, int_port) = is_export + ext_port, int_port = is_export initializers = ext_port._get_initializers([]) if initializers: raise UnconnectableError( @@ -198,7 +198,7 @@ def make_connection(self) -> Optional[Union[ConnectedLink, Export]]: is_export = self._is_export() if is_export: - (ext_port, int_port) = is_export + ext_port, int_port = is_export return Connection.Export(isinstance(ext_port, BaseVector), ext_port, int_port) bridged_connects: List[Tuple[BasePort, edgir.LocalPath]] = [] diff --git a/edg/core/BufferSerializer.py b/edg/core/BufferSerializer.py index 3c7463b07..15badbc32 100644 --- a/edg/core/BufferSerializer.py +++ b/edg/core/BufferSerializer.py @@ -3,7 +3,6 @@ import google.protobuf as protobuf import struct - MessageType = TypeVar("MessageType", bound=protobuf.message.Message) kHeaderMagicByte = b"\xfe" diff --git a/edg/core/Core.py b/edg/core/Core.py index 45013f346..6eede21cb 100644 --- a/edg/core/Core.py +++ b/edg/core/Core.py @@ -10,7 +10,6 @@ from .IdentityDict import IdentityDict from .IdentitySet import IdentitySet - ElementType = TypeVar("ElementType") diff --git a/edg/core/Generator.py b/edg/core/Generator.py index dff817991..42a7135ef 100644 --- a/edg/core/Generator.py +++ b/edg/core/Generator.py @@ -17,7 +17,6 @@ from .HdlUserExceptions import * from .HierarchyBlock import Block - CastableType = TypeVar("CastableType", bound=Any) diff --git a/edg/core/Refinements.py b/edg/core/Refinements.py index daa4e786f..7dd846fba 100644 --- a/edg/core/Refinements.py +++ b/edg/core/Refinements.py @@ -7,7 +7,6 @@ from .. import edgrpc from .HierarchyBlock import Block - DesignPath = Iterable[str] DesignPostfix = Iterable[str] diff --git a/edg/electronics_model/test_kicad.py b/edg/electronics_model/test_kicad.py index 7ac2b956d..6c282668b 100644 --- a/edg/electronics_model/test_kicad.py +++ b/edg/electronics_model/test_kicad.py @@ -16,21 +16,21 @@ def generate_net(self, design: Type[Block]) -> Tuple[str, str]: return NetlistBackend().run(compiled)[0][1], GenerateBom().run(compiled)[0][1] def test_basic_kicad(self) -> None: - (net, bom) = self.generate_net(test_netlist.TestBasicCircuit) + net, bom = self.generate_net(test_netlist.TestBasicCircuit) with open(os.path.splitext(os.path.basename(__file__))[0] + "_basic.net", "w") as f: f.write(net) with open(os.path.splitext(os.path.basename(__file__))[0] + "_basic.csv", "w") as f: f.write(bom) def test_multisink_kicad(self) -> None: - (net, bom) = self.generate_net(test_netlist.TestMultisinkCircuit) + net, bom = self.generate_net(test_netlist.TestMultisinkCircuit) with open(os.path.splitext(os.path.basename(__file__))[0] + "_multisink.net", "w") as f: f.write(net) with open(os.path.splitext(os.path.basename(__file__))[0] + "_multisink.csv", "w") as f: f.write(bom) def test_multinet_kicad(self) -> None: - (net, bom) = self.generate_net(test_netlist.TestMultinetCircuit) + net, bom = self.generate_net(test_netlist.TestMultinetCircuit) with open(os.path.splitext(os.path.basename(__file__))[0] + "_multinet.net", "w") as f: f.write(net) with open(os.path.splitext(os.path.basename(__file__))[0] + "_multinet.csv", "w") as f: diff --git a/edg/hdl_server/__main__.py b/edg/hdl_server/__main__.py index fe0b5f82e..638f5619f 100644 --- a/edg/hdl_server/__main__.py +++ b/edg/hdl_server/__main__.py @@ -9,7 +9,6 @@ from ..core import * from ..core.Core import NonLibraryProperty - EDG_PROTO_VERSION = 7 diff --git a/edg/parts/Microcontroller_Esp.py b/edg/parts/Microcontroller_Esp.py index 53650d38f..04fd58aa2 100644 --- a/edg/parts/Microcontroller_Esp.py +++ b/edg/parts/Microcontroller_Esp.py @@ -6,7 +6,6 @@ from .PassiveConnector_Header import PinHeader254 from .PassiveConnector_TagConnect import TagConnect - # contains common blocks for ESP microcontrollers diff --git a/edg/parts/Rf_Pn7160.py b/edg/parts/Rf_Pn7160.py index 38b5d04c2..959e79762 100644 --- a/edg/parts/Rf_Pn7160.py +++ b/edg/parts/Rf_Pn7160.py @@ -6,7 +6,6 @@ from ..abstract_parts import * from .JlcPart import JlcPart - # TODO: some of these are pretty general RF building blocks and can be moved into shared libraries # but until there are enough use cases they'll be buried here for now # TODO: this is a bit of a structural mess right now, as with the other RF blocks, and needs refactoring diff --git a/edg/parts/__init__.py b/edg/parts/__init__.py index 8d45e14ed..f82c7bb78 100644 --- a/edg/parts/__init__.py +++ b/edg/parts/__init__.py @@ -230,7 +230,6 @@ from .Jacdac import JacdacMountingData1, JacdacMountingGnd2, JacdacMountingGnd4, JacdacMountingPwr3 from .Jacdac import JacdacDeviceTop - # compatibility shims import deprecated as __deprecated # not to be exported diff --git a/examples/jlcpcb_pcba_postprocess.py b/examples/jlcpcb_pcba_postprocess.py index a9d185128..fe96132a9 100644 --- a/examples/jlcpcb_pcba_postprocess.py +++ b/examples/jlcpcb_pcba_postprocess.py @@ -200,13 +200,13 @@ def remap_by_dict(elt: str, remap_dict: Dict[str, str]) -> str: # correct offsets before applying rotation if lcsc_opt is not None and lcsc_opt in PART_OFFSETS: - (xoff, yoff) = PART_OFFSETS[lcsc_opt] + xoff, yoff = PART_OFFSETS[lcsc_opt] rot = math.radians(float(row[rot_index])) row[x_index] = str((float(row[x_index]) + xoff * math.cos(rot) + yoff * math.sin(rot))) row[y_index] = str((float(row[y_index]) + xoff * math.sin(rot) - yoff * math.cos(rot))) print(f"correct offset for row {i+1} ref {refdes}, {lcsc_opt}") elif package in PACKAGE_OFFSETS: - (xoff, yoff) = PACKAGE_OFFSETS[package] + xoff, yoff = PACKAGE_OFFSETS[package] rot = math.radians(float(row[rot_index])) row[x_index] = str((float(row[x_index]) + xoff * math.cos(rot) + yoff * math.sin(rot))) row[y_index] = str((float(row[y_index]) + xoff * math.sin(rot) - yoff * math.cos(rot))) diff --git a/examples/resources/upgrade_pcb.py b/examples/resources/upgrade_pcb.py index 103ee3817..9e50d3271 100644 --- a/examples/resources/upgrade_pcb.py +++ b/examples/resources/upgrade_pcb.py @@ -6,7 +6,6 @@ # otherwise, this import fails since the root path is incorrect from edg.electronics_model.KiCadSchematicParser import group_by_car, parse_symbol, test_cast - if __name__ == "__main__": parser = argparse.ArgumentParser( description="Update timestamps on a kicad_pcb file from a new netlist."