From 610f910f4930c7cfc479069908a67afd097910fd Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 12:00:28 -0800 Subject: [PATCH 01/15] Basic github actions to run tests --- .github/workflows/python-app.yml | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..8c7c6f3 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,38 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: pcbflow + +on: + push: + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest From bd30d6f78dd86a1a9519081c9ac5582a774edc51 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 12:08:07 -0800 Subject: [PATCH 02/15] Seperate linting and testing, add running some of the examples --- .github/workflows/main.yml | 68 ++++++++++++++++++++++++++++++++ .github/workflows/python-app.yml | 42 +++++++++++++++++--- 2 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..1d349b9 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,68 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: pcbflow + +on: + push: + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + pytest + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + examples: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Run basic examples + run: | + python examples/basic/blank.py + python examples/basic/holes.py + - name: Run sample + run: | + python examples/sample/sample.py diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 8c7c6f3..5c11edb 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -12,10 +12,24 @@ permissions: contents: read jobs: - build: - + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + pytest + lint: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - name: Set up Python 3.10 @@ -25,7 +39,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest + pip install flake8 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | @@ -33,6 +47,22 @@ jobs: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest + examples: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install dependencies run: | - pytest + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Run basic examples + run: | + python examples/basic/blank.py + python examples/basic/holes.py + - name: Run sample + run: | + python examples/sample/sample.py From 28c6cad5682a400770db699306cb73b45cf37af7 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 12:13:50 -0800 Subject: [PATCH 03/15] Try installing before running tests in GH actions --- .github/workflows/python-app.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 5c11edb..9632533 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -25,6 +25,7 @@ jobs: python -m pip install --upgrade pip pip install pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python setup.py install - name: Test with pytest run: | pytest @@ -41,6 +42,7 @@ jobs: python -m pip install --upgrade pip pip install flake8 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python setup.py install - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names @@ -59,6 +61,7 @@ jobs: run: | python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python setup.py install - name: Run basic examples run: | python examples/basic/blank.py From 1b8124d91ef41725e6737bec2e66e51dabea2b56 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 12:27:09 -0800 Subject: [PATCH 04/15] Checkout submodules --- .github/workflows/python-app.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 9632533..39859b5 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -16,6 +16,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -33,6 +35,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -53,6 +57,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: From c31bc373497603529252a29845fe1990eab35d0b Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 12:56:20 -0800 Subject: [PATCH 05/15] Specify folder name so this works from the root --- examples/sample/sample.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/sample/sample.py b/examples/sample/sample.py index 0b02eed..7ec8d79 100644 --- a/examples/sample/sample.py +++ b/examples/sample/sample.py @@ -38,7 +38,7 @@ brd.add_part((35, 5), SOIC8, side="bottom") usb_con = EaglePart( brd.DC((50, 15)).right(180), - libraryfile="sparkfun.lbr", + libraryfile="scripts/sparkfun.lbr", partname="USB-B-SMT", side="top", ) From c1c5abbd9e05dab480be1f3e71b663e0460c35b3 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:00:37 -0800 Subject: [PATCH 06/15] Add skidl --- .github/workflows/main.yml | 23 +++++++--- .github/workflows/python-app.yml | 77 -------------------------------- 2 files changed, 18 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/python-app.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d349b9..fae687a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -23,8 +25,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest + pip install pytest skidl if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python setup.py install - name: Test with pytest run: | pytest @@ -32,6 +35,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -51,6 +56,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -59,10 +66,16 @@ jobs: run: | python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Run basic examples - run: | + python setup.py install + - name: Run basic blank + run: | + python examples/basic/blank.py + - name: Run basic blank + run: | python examples/basic/blank.py + - name: Run basic holes + run: | python examples/basic/holes.py - - name: Run sample - run: | + - name: Run sample + run: | python examples/sample/sample.py diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml deleted file mode 100644 index 39859b5..0000000 --- a/.github/workflows/python-app.yml +++ /dev/null @@ -1,77 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: pcbflow - -on: - push: - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'true' - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python setup.py install - - name: Test with pytest - run: | - pytest - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'true' - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python setup.py install - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - examples: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: 'true' - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python setup.py install - - name: Run basic examples - run: | - python examples/basic/blank.py - python examples/basic/holes.py - - name: Run sample - run: | - python examples/sample/sample.py From 7c3c667e150f917e776eaec4d84c8fd9a2bb47f2 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:10:23 -0800 Subject: [PATCH 07/15] Ignore skidl_test.* output from tests --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 97a4cd5..5b75a82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# test files +skidl_test.* + # python intermediate files *.py[cod] From 89622e0a3d9ba5cc6b31d19586ae974cc9b7f659 Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:19:46 -0800 Subject: [PATCH 08/15] Fix some minor issues, hopefully get the linter passing (with warnings) --- .flake8 | 2 ++ pcbflow/hershey.py | 2 +- pcbflow/sexp_parser.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..091e39b --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +exclude = setup.py, scripts, examples, tests, build, pcbflow/hershey.py diff --git a/pcbflow/hershey.py b/pcbflow/hershey.py index 4cfdafb..4e7a583 100644 --- a/pcbflow/hershey.py +++ b/pcbflow/hershey.py @@ -46,7 +46,7 @@ def hersheyparse(dat): def plline(l): (ucode, h, _) = [int(i, 0) for i in l[:-1].split(",")] - return (unichr(ucode), h) + return (chr(ucode), h) # From http://paulbourke.net/dataformats/hershey/romans.hmp diff --git a/pcbflow/sexp_parser.py b/pcbflow/sexp_parser.py index 3f29dec..7146fc7 100644 --- a/pcbflow/sexp_parser.py +++ b/pcbflow/sexp_parser.py @@ -30,7 +30,7 @@ if PY3: string_types = (str,) else: - string_types = (basestring,) + string_types = (str,) logger = logging.getLogger(__name__) From eba11a6a57e48fb8abaac186eb3c956fa880a4fa Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:21:52 -0800 Subject: [PATCH 09/15] Remove some excess steps / errors --- .github/workflows/main.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index fae687a..f446c23 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,8 +16,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -27,7 +25,6 @@ jobs: python -m pip install --upgrade pip pip install pytest skidl if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - python setup.py install - name: Test with pytest run: | pytest @@ -35,8 +32,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: @@ -56,20 +51,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: python-version: "3.10" - name: Install dependencies run: | - python -m pip install --upgrade pip - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python setup.py install - - name: Run basic blank - run: | - python examples/basic/blank.py - name: Run basic blank run: | python examples/basic/blank.py From d9380d34e60182226964b97b8a1a2a1fa30086ce Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:27:18 -0800 Subject: [PATCH 10/15] Add martix, python setup.py install for tests - forgot it's needed --- .github/workflows/main.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f446c23..afaafbc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,26 +14,30 @@ permissions: jobs: test: runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.10 - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip pip install pytest skidl if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python setup.py install - name: Test with pytest run: | pytest lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies @@ -50,9 +54,9 @@ jobs: examples: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.10 - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install dependencies @@ -64,6 +68,6 @@ jobs: - name: Run basic holes run: | python examples/basic/holes.py - - name: Run sample - run: | - python examples/sample/sample.py + # - name: Run sample + # run: | + # python examples/sample/sample.py From 83f8f9d8c92deac3881aac99b50a96a0e2ac82cc Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:33:13 -0800 Subject: [PATCH 11/15] Update docs, requirements to what's listed in the readme --- .github/workflows/main.yml | 2 +- README.md | 25 ++++++++++++------------- setup.py | 8 ++++---- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index afaafbc..4214dcb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/README.md b/README.md index 1df6de4..21b9049 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ # pcbflow - Python PCB layout and design (based on CuFlow) ![python version](https://img.shields.io/static/v1?label=python&message=3.9%2B&color=blue&style=flat&logo=python) -Code style: black +Code style: black ![https://travis-ci.org/michaelgale/pcbflow](https://travis-ci.com/michaelgale/pcbflow.svg?branch=main) [![codecov](https://codecov.io/gh/michaelgale/pcbflow/branch/main/graph/badge.svg)](https://codecov.io/gh/michaelgale/pcbflow) @@ -29,14 +29,13 @@ This implementation is alpha and not fully documented. ## Requirements -Since the initial release of `pcbflow`, some changes have been made to adapt with newer versions of python and library dependancies. In particular: +Since the initial release of `pcbflow`, some changes have been made to adapt with newer versions of python and library dependancies. In particular: +- Python 3.9+ - the initial versions of `pcbflow` used `shapely` v.1.6+. However `shapely` has changed the way geometries are iterated in v.2.0.1+; therefore `pcbflow` has been changed to support `shapley` versions 2.0.1+ -> -> `pcbflow` has been changed to support `shapley` versions 2.0.1+ ONLY. -> Check your version with `pip list` and verify `shapley` is v.2.0.1+ -> +> [!IMPORTANT] +> `pcbflow` has been changed to support `shapley` versions 2.0.1+ ONLY. Check your version with `pip list` and verify `shapley` is v.2.0.1+. If it's not, you can fix by running `pip install --upgrade shapely` ## Installation @@ -177,7 +176,7 @@ The `side` argument can be specified as either `top` or `bottom`. This will mir Arbitrary bitmap logos/annotations can be applied to the PCB as follows: ```python -brd.add_bitmap((x, y), "logo.png", +brd.add_bitmap((x, y), "logo.png", scale=None, side="top", layer=None, @@ -189,7 +188,7 @@ The bitmap should be a monochrome bitmap image with transparent background. It ## Named Polygons -Arbitary polygon regions can be added to a copper layer with a name corresponding to its net name. For example, this can be used to apply different voltage "patches" under a part requiring several voltages, or to make a split plane of several voltages or GND references. +Arbitary polygon regions can be added to a copper layer with a name corresponding to its net name. For example, this can be used to apply different voltage "patches" under a part requiring several voltages, or to make a split plane of several voltages or GND references. ```python # add a polygon with a coordinate list @@ -252,7 +251,7 @@ print(usb_con) # 5: VUSB (17.00, 8.12) # alternatively, we can reference the pad by name to do the same thing -usb_con.pad("D-").turtle("r 90 f 5 l 90 f 10").wire(width=0.25) +usb_con.pad("D-").turtle("r 90 f 5 l 90 f 10").wire(width=0.25) ``` ## Saving Asset Files @@ -269,7 +268,7 @@ usb_con.pad("D-").turtle("r 90 f 5 l 90 f 10").wire(width=0.25) Outfiles can be created in the same folder as the script file or in a subfolder under the script (generated automatically). To generate asset files: ```python -brd.save(basename, in_subdir=True, +brd.save(basename, in_subdir=True, gerber=True, pdf=True, bom=True, centroids=True, povray=False) ``` @@ -360,7 +359,7 @@ if __name__ == "__main__": # Create a pcbflow Board instance brd = Board((55, 30)) - + # add two inner copper layers (named GP2, GP3) brd.add_inner_copper_layer(2) # Place 2 mm mounting holes in the corners @@ -394,14 +393,14 @@ if __name__ == "__main__": sp.fanout(["GND"], relative_to="inside") print(brd.parts_str()) - + # finish the PCB with an outline and poured copper layers brd.add_outline() brd.fill_layer("GTL", "GND") brd.fill_layer("GBL", "GND") brd.fill_layer("GP3", "GND") - # Save the rendered PCB to asset files + # Save the rendered PCB to asset files brd.save("%s" % (os.path.basename(__file__)[:-3])) ``` diff --git a/setup.py b/setup.py index adb62eb..1f73a36 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ import setuptools PACKAGE_NAME = "pcbflow" -MINIMUM_PYTHON_VERSION = "3.6" +MINIMUM_PYTHON_VERSION = "3.9" loc = os.path.abspath(os.path.dirname(__file__)) @@ -38,7 +38,7 @@ def check_python_version(): """Exit when the Python version is too low.""" - + # get the version number, remove any trailing text, split into numerical values. # then compare these sequences of numbers to one another version = [int(v) for v in sys.version.split(' ')[0].split(".")] @@ -48,8 +48,8 @@ def check_python_version(): break if a Date: Tue, 16 Jan 2024 13:44:22 -0800 Subject: [PATCH 12/15] Add some swapspace (re random failures, fix idea from: actions/runner#2468#issuecomment-1651313943), and flake8-black --- .github/workflows/main.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4214dcb..c6456c3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,10 @@ jobs: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: + - name: Set Swap Space + uses: pierotofy/set-swap-space@master + with: + swap-size-gb: 10 - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 @@ -43,9 +47,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 + pip install flake8 flake8-black if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Lint with flake8 + - name: Lint with flake8 / flake8-black run: | # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics From 14218cc940ca9448b17e9be873493112a9579d8e Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:44:37 -0800 Subject: [PATCH 13/15] Change to 3.9 as the docs say --- environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index f757f33..3252130 100644 --- a/environment.yml +++ b/environment.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python>=3.6 + - python>=3.9 - ipython - pyparsing - sphinx=3.2.1 From ea6065e523f95b9f06534fd8bdb2e8075c1866ad Mon Sep 17 00:00:00 2001 From: Russell Smith Date: Tue, 16 Jan 2024 13:44:59 -0800 Subject: [PATCH 14/15] Changes from black --- pcbflow/hershey.py | 30 +++++++++++++++++++++++++----- setup.py | 15 +++++++-------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/pcbflow/hershey.py b/pcbflow/hershey.py index 4e7a583..e7d8dec 100644 --- a/pcbflow/hershey.py +++ b/pcbflow/hershey.py @@ -14,7 +14,7 @@ def char2val(c): # data is stored as signed bytes relative to ASCII R def hersheyparse(dat): - """ reads a line of Hershey font text """ + """reads a line of Hershey font text""" lines = [] @@ -22,7 +22,6 @@ def hersheyparse(dat): # starting at col 11 for s in dat[10:].split(" R"): - # each line is a list of pairs of coordinates # NB: origin is at centre(ish) of character # Y coordinates **increase** downwards @@ -71,11 +70,32 @@ def plline(l): 720, ] + list(range(700, 710)) - + [712, 713, 2241, 726, 2242, 715, 2273,] + + [ + 712, + 713, + 2241, + 726, + 2242, + 715, + 2273, + ] + list(range(501, 527)) - + [2223, 804, 2224, 2262, 999, 730,] + + [ + 2223, + 804, + 2224, + 2262, + 999, + 730, + ] + list(range(601, 627)) - + [2225, 723, 2226, 2246, 718,] + + [ + 2225, + 723, + 2226, + 2246, + 718, + ] ) diff --git a/setup.py b/setup.py index 1f73a36..0569c60 100644 --- a/setup.py +++ b/setup.py @@ -41,16 +41,15 @@ def check_python_version(): # get the version number, remove any trailing text, split into numerical values. # then compare these sequences of numbers to one another - version = [int(v) for v in sys.version.split(' ')[0].split(".")] - min_version = [int(v) for v in MINIMUM_PYTHON_VERSION.split(' ')[0].split(".")] - for a,b in zip(version, min_version): - if a>b: + version = [int(v) for v in sys.version.split(" ")[0].split(".")] + min_version = [int(v) for v in MINIMUM_PYTHON_VERSION.split(" ")[0].split(".")] + for a, b in zip(version, min_version): + if a > b: break - if a Date: Tue, 16 Jan 2024 13:55:52 -0800 Subject: [PATCH 15/15] Try installing setuptools for 3.12 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c6456c3..150b7f7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest skidl + pip install pytest skidl setuptools if [ -f requirements.txt ]; then pip install -r requirements.txt; fi python setup.py install - name: Test with pytest