From 7690aa258d2cb52bff16bc256b28294e0c157376 Mon Sep 17 00:00:00 2001 From: kevin r Date: Thu, 15 Oct 2026 17:19:02 -0400 Subject: [PATCH 1/2] Update build workflow and pyproject.toml for version 0.3.2 and dependency adjustments --- .github/workflows/build.yml | 126 +++++++++++++++++++++++++++++----- .github/workflows/release.yml | 102 --------------------------- pyproject.toml | 11 ++- 3 files changed, 117 insertions(+), 122 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c09d9a0..3d8b05b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,23 +1,15 @@ name: build +# One pipeline: build/test on every PR and every push to main; release runs +# ONLY after the test matrix passes (release job `needs: test`), and only on +# push to main or manual dispatch — never on PRs. on: pull_request: - types: - - opened - - edited - - synchronize - - reopened - paths: - - '**.py' - - 'pyproject.toml' push: branches: - main - paths: - - '**.py' - - 'pyproject.toml' workflow_dispatch: - workflow_call: + jobs: format: runs-on: ubuntu-latest @@ -29,7 +21,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} ref: ${{ github.head_ref || github.ref }} - + - name: Install Python uses: actions/setup-python@v4 with: @@ -41,7 +33,6 @@ jobs: pip install black - name: Check for existing release - if: github.event_name == 'pull_request' run: | VERSION=$(python -c " try: @@ -58,6 +49,8 @@ jobs: else echo "Version v$VERSION is available" fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Auto-format with Black run: | @@ -96,11 +89,110 @@ jobs: run: | python -m pip install --upgrade pip pip install flake8 pytest black - pip install -e .[all] + pip install -e .[all] + + # Transitional (until the engforge-structures split, docs/ENGFORGE_1.0.md): + # the eng extra's sectionproperties~=3.1.2 has no py3.12 release, and + # 3.2+ requires numpy>=2. Install current eng deps, then pin numpy back + # below 2 — runtime-compatible even though the resolver disagrees. + - name: Install eng deps on 3.12 + if: matrix.python-version == '3.12' + run: | + pip install sectionproperties PyNiteFEA CoolProp fluids control + pip install "numpy>=1.26,<2" - name: Check Python & Run Tests run: | python -c "import sys; print(sys.version)" - python -m pip list | grep PyNiteFEA || echo "pynite-not-found" - python -m pip list | grep coolprop || echo "coolprop-not-found" + python -m pip list | grep -i PyNiteFEA || echo "pynite-not-found" + python -m pip list | grep -i coolprop || echo "coolprop-not-found" python -m unittest discover -s engforge/test -p "test_*.py" -v + + release: + runs-on: ubuntu-latest + needs: [test] + # only ever release from main — push is already main-only via the trigger, + # but workflow_dispatch can be fired from any branch, so pin the ref too + if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') + permissions: + contents: write + pages: write + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + pip install -e .[all] + + - name: Get version + id: version + run: | + VERSION=$(python -c " + try: + import tomllib + except ImportError: + import tomli as tomllib + with open('pyproject.toml', 'rb') as f: + print(tomllib.load(f)['project']['version']) + ") + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Version: $VERSION" + + - name: Check if release exists + id: check_release + run: | + if gh release view "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then + echo "exists=true" >> $GITHUB_OUTPUT + echo "Release v${{ steps.version.outputs.version }} already exists" + else + echo "exists=false" >> $GITHUB_OUTPUT + echo "Release v${{ steps.version.outputs.version }} does not exist" + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build documentation + run: | + cd docs + make html + + - name: Upload pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: 'docs/_build/html/' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + + - name: Build package + if: steps.check_release.outputs.exists == 'false' + run: | + python -m build + + - name: Create GitHub Release + if: steps.check_release.outputs.exists == 'false' + run: | + gh release create "v${{ steps.version.outputs.version }}" \ + --title "Release v${{ steps.version.outputs.version }}" \ + --notes "Automated release for version ${{ steps.version.outputs.version }}" \ + --generate-notes \ + dist/* + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to PyPI + if: steps.check_release.outputs.exists == 'false' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://upload.pypi.org/legacy/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 5c08894..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: release - -on: - push: - branches: - - main - paths: - - '**.py' - - 'pyproject.toml' - - '**.md' - - '**.rst' - - '**.yml' - workflow_dispatch: - - workflow_call: - -permissions: - contents: write - pages: write - id-token: write - -jobs: - release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build twine - pip install -e .[all] - - - name: Get version - id: version - run: | - VERSION=$(python -c " - try: - import tomllib - except ImportError: - import tomli as tomllib - with open('pyproject.toml', 'rb') as f: - print(tomllib.load(f)['project']['version']) - ") - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Version: $VERSION" - - - name: Check if release exists - id: check_release - run: | - if gh release view "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then - echo "exists=true" >> $GITHUB_OUTPUT - echo "Release v${{ steps.version.outputs.version }} already exists" - else - echo "exists=false" >> $GITHUB_OUTPUT - echo "Release v${{ steps.version.outputs.version }} does not exist" - fi - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Build documentation - run: | - cd docs - make html - - - name: Upload pages artifact - uses: actions/upload-pages-artifact@v3 - with: - path: 'docs/_build/html/' - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - - - name: Build package - if: steps.check_release.outputs.exists == 'false' - run: | - python -m build - - - name: Create GitHub Release - if: steps.check_release.outputs.exists == 'false' - run: | - gh release create "v${{ steps.version.outputs.version }}" \ - --title "Release v${{ steps.version.outputs.version }}" \ - --notes "Automated release for version ${{ steps.version.outputs.version }}" \ - --generate-notes \ - dist/* - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to PyPI - if: steps.check_release.outputs.exists == 'false' - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://upload.pypi.org/legacy/ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 4a80d52..ffd56fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "engforge" -version = "0.3.1" +version = "0.3.2" description = "The Engineer's Framework" readme = "README.md" license = "MIT" @@ -68,10 +68,11 @@ eng = [ database = [ "SQLAlchemy~=1.3.17", - "SQLAlchemy-Utils", + "SQLAlchemy-Utils", "psycopg2-binary", "diskcache>=5.6.1", "sqlalchemy-batch-inserts", + "cachetools", ] google = [ "expiringdict~=1.2.2", @@ -94,8 +95,12 @@ docs = [ "sphinx_autodoc_typehints", "toml~=0.10.2", ] +# NOTE: the eng extra (sectionproperties~=3.1.2) has no Python 3.12-compatible +# release that works with numpy<2, so `all` includes it only on <3.12. The +# long-term fix is the engforge-structures split (docs/ENGFORGE_1.0.md). all = [ - "engforge[database,google,cloud,distributed,docs,eng,dev]", + "engforge[database,google,cloud,distributed,docs,dev]", + "engforge[eng]; python_version < '3.12'", ] [tool.setuptools] From 2ff96dbcc1902e8fd58dc8964832783c3fbc6255 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 15 Oct 2026 21:20:21 +0000 Subject: [PATCH 2/2] Auto-format code with Black [skip ci] --- engforge/analysis.py | 1 - engforge/dynamics.py | 1 - engforge/eng/fluid_material.py | 1 - engforge/solveable.py | 1 - engforge/test/test_solver.py | 1 - 5 files changed, 5 deletions(-) diff --git a/engforge/analysis.py b/engforge/analysis.py index 0014b5f..9914094 100644 --- a/engforge/analysis.py +++ b/engforge/analysis.py @@ -7,7 +7,6 @@ from engforge.reporting import * from engforge.attr_plotting import PlottingMixin - # import datetime import os from uuid import uuid4 diff --git a/engforge/dynamics.py b/engforge/dynamics.py index 2b40058..3525137 100644 --- a/engforge/dynamics.py +++ b/engforge/dynamics.py @@ -31,7 +31,6 @@ import pandas import attr, attrs - # Index maps are used to translate between different indexes (local & global) diff --git a/engforge/eng/fluid_material.py b/engforge/eng/fluid_material.py index 2adbd8f..379309e 100644 --- a/engforge/eng/fluid_material.py +++ b/engforge/eng/fluid_material.py @@ -14,7 +14,6 @@ import fluids import abc - # TODO: add a exact fluid state (T,P) / (Q,P) in the concept of processes for each thermodynamic operation (isothermal,isobaric,heating...ect) STD_PRESSURE = 1e5 # pa diff --git a/engforge/solveable.py b/engforge/solveable.py index 486cd13..e74dcc2 100644 --- a/engforge/solveable.py +++ b/engforge/solveable.py @@ -8,7 +8,6 @@ import datetime import typing - # from engforge.dynamics import DynamicsMixin from engforge.attributes import AttributeInstance from engforge.engforge_attributes import AttributedBaseMixin diff --git a/engforge/test/test_solver.py b/engforge/test/test_solver.py index 92dfd16..d1eaf22 100644 --- a/engforge/test/test_solver.py +++ b/engforge/test/test_solver.py @@ -3,7 +3,6 @@ from engforge.problem_context import ProblemExec import itertools - indep = "*x,*y,*z" indep_l = indep.split(",")