From 59357d6ffcddf48a8ab217f5cd64464166ff3d9c Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 11:48:17 -0600 Subject: [PATCH 01/16] . --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a827476c..405b3fdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -289,7 +289,7 @@ extend-ignore = [ "RET", "RSE102", "RUF001", - "RUF003", # greek characters are used in this project e.g. for allotropes, not an issue + "RUF003", # greek characters are used in this project e.g. for allotropes "RUF005", # this one is not micropython compatible # "S101", # Use assert - removed from global ignore, now controlled by per-file-ignores below "S110", From 5a58856e6ac511190f3b68cf7a82e7663dfd394c Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 11:57:00 -0600 Subject: [PATCH 02/16] . --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 405b3fdb..b8a41e20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -309,7 +309,7 @@ extend-ignore = [ "TRY201", "TRY300", "TRY301", - "PYI024", # PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple + "PYI024", # PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple personal preference ] [tool.ruff.lint.mccabe] From db2bcf6a61c1a2caff31cca5e0d747dbc712ae17 Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 11:59:45 -0600 Subject: [PATCH 03/16] . --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b8a41e20..405b3fdb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -309,7 +309,7 @@ extend-ignore = [ "TRY201", "TRY300", "TRY301", - "PYI024", # PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple personal preference + "PYI024", # PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple ] [tool.ruff.lint.mccabe] From 3f586bd5b729492925f00809179301f18dc1f049 Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 12:08:20 -0600 Subject: [PATCH 04/16] Restrict --- .github/workflows/publish-testpypi.yml | 28 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index 41c2731b..30791190 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -1,31 +1,39 @@ name: Publish to TestPyPI - on: push: tags: - 'v*' - permissions: id-token: write contents: read - jobs: test: uses: ./.github/workflows/quality.yml - + publish: needs: test runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') - + environment: + name: pypi steps: + - name: Checkout to verify branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if tag is on release branch + run: | + if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/release'; then + echo "Tag is not on release branch" + exit 1 + fi + - name: Download distributions uses: actions/download-artifact@v4 with: name: distributions path: dist/ - - - name: Upload to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ + + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file From 9ff738be4d67f9ae922ee74256f7559dddf3ac98 Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 12:09:02 -0600 Subject: [PATCH 05/16] . --- fluids/__init__.py | 2 +- pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fluids/__init__.py b/fluids/__init__.py index 65056a4a..02352b5d 100644 --- a/fluids/__init__.py +++ b/fluids/__init__.py @@ -168,7 +168,7 @@ def all_submodules(with_numerics=True): return new_submodules -__version__ = "1.2.6" +__version__ = "1.2.7" try: fluids_dir = os.path.dirname(__file__) diff --git a/pyproject.toml b/pyproject.toml index 405b3fdb..e5083406 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["_custom_build"] [project] name = "fluids" -version = "1.2.6" +version = "1.2.7" description = "Fluid dynamics component of Chemical Engineering Design Library (ChEDL)" readme = "README.rst" requires-python = ">=3.9" @@ -132,7 +132,7 @@ dev = [ [project.urls] Homepage = "https://github.com/CalebBell/fluids" -Download = "https://github.com/CalebBell/fluids/tarball/1.2.6" +Download = "https://github.com/CalebBell/fluids/tarball/1.2.7" [tool.setuptools] packages = ["fluids"] From aba00fc7dcd79c4cf1aa52114925d3d903d7fa4f Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 12:15:41 -0600 Subject: [PATCH 06/16] v1.2.8 --- .github/workflows/publish-testpypi.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index 30791190..90a892e3 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -36,4 +36,6 @@ jobs: path: dist/ - name: Upload to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ \ No newline at end of file From dc77303da4e39a3a6bd367f2b318599421b75efc Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 12:32:30 -0600 Subject: [PATCH 07/16] Another shoul dnot release --- .github/workflows/publish-testpypi.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index 90a892e3..fe839cf3 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -22,12 +22,12 @@ jobs: with: fetch-depth: 0 - - name: Check if tag is on release branch - run: | - if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/release'; then - echo "Tag is not on release branch" - exit 1 - fi + # - name: Check if tag is on release branch + # run: | + # if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/release'; then + # echo "Tag is not on release branch" + # exit 1 + # fi - name: Download distributions uses: actions/download-artifact@v4 From 621237a5c5008d62e0e8065f8c2414d8c285afd1 Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 12:39:17 -0600 Subject: [PATCH 08/16] . --- .github/workflows/publish-testpypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index fe839cf3..b331d60e 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - + # The release branch check can be added but it isn't security, it is just for user assistance # - name: Check if tag is on release branch # run: | # if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/release'; then From ef7888912c9138d638e9a9918808947cee024f7e Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 12:44:41 -0600 Subject: [PATCH 09/16] 1.2.9 test --- .github/workflows/publish-testpypi.yml | 14 +------------- fluids/__init__.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index b331d60e..57a6c83b 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -16,19 +16,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') environment: name: pypi - steps: - - name: Checkout to verify branch - uses: actions/checkout@v4 - with: - fetch-depth: 0 - # The release branch check can be added but it isn't security, it is just for user assistance - # - name: Check if tag is on release branch - # run: | - # if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/release'; then - # echo "Tag is not on release branch" - # exit 1 - # fi - + steps: - name: Download distributions uses: actions/download-artifact@v4 with: diff --git a/fluids/__init__.py b/fluids/__init__.py index 02352b5d..58e55ce5 100644 --- a/fluids/__init__.py +++ b/fluids/__init__.py @@ -168,7 +168,7 @@ def all_submodules(with_numerics=True): return new_submodules -__version__ = "1.2.7" +__version__ = "1.2.9" try: fluids_dir = os.path.dirname(__file__) diff --git a/pyproject.toml b/pyproject.toml index e5083406..6a9d4734 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["_custom_build"] [project] name = "fluids" -version = "1.2.7" +version = "1.2.9" description = "Fluid dynamics component of Chemical Engineering Design Library (ChEDL)" readme = "README.rst" requires-python = ">=3.9" @@ -132,7 +132,7 @@ dev = [ [project.urls] Homepage = "https://github.com/CalebBell/fluids" -Download = "https://github.com/CalebBell/fluids/tarball/1.2.7" +Download = "https://github.com/CalebBell/fluids/tarball/1.2.9" [tool.setuptools] packages = ["fluids"] From 1fc59196bcb012b50048bec4358f97a7dd52bc5c Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 14:35:13 -0600 Subject: [PATCH 10/16] 1.2.10 test --- .github/workflows/publish-testpypi.yml | 6 +++--- fluids/__init__.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index 57a6c83b..c71bd725 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -1,8 +1,8 @@ name: Publish to TestPyPI on: - push: - tags: - - 'v*' + release: + types: [published] + permissions: id-token: write contents: read diff --git a/fluids/__init__.py b/fluids/__init__.py index 58e55ce5..191ec2f6 100644 --- a/fluids/__init__.py +++ b/fluids/__init__.py @@ -168,7 +168,7 @@ def all_submodules(with_numerics=True): return new_submodules -__version__ = "1.2.9" +__version__ = "1.2.10" try: fluids_dir = os.path.dirname(__file__) diff --git a/pyproject.toml b/pyproject.toml index 6a9d4734..4f911d5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["_custom_build"] [project] name = "fluids" -version = "1.2.9" +version = "1.2.10" description = "Fluid dynamics component of Chemical Engineering Design Library (ChEDL)" readme = "README.rst" requires-python = ">=3.9" @@ -132,7 +132,7 @@ dev = [ [project.urls] Homepage = "https://github.com/CalebBell/fluids" -Download = "https://github.com/CalebBell/fluids/tarball/1.2.9" +Download = "https://github.com/CalebBell/fluids/tarball/1.2.10" [tool.setuptools] packages = ["fluids"] From 28631aeec0404c2ffe2cad5be72cb278e8b3e0fb Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 14:52:41 -0600 Subject: [PATCH 11/16] bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4f911d5c..e4ad499e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -309,7 +309,7 @@ extend-ignore = [ "TRY201", "TRY300", "TRY301", - "PYI024", # PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple + "PYI024", # PYI024 Use `typing.NamedTuple` instead of `collections.namedtuple - personal preference ] [tool.ruff.lint.mccabe] From ed589d791fe569a26103211b0403488310574f3e Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 15:17:33 -0600 Subject: [PATCH 12/16] Very painful process --- .github/workflows/publish-testpypi.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-testpypi.yml index c71bd725..8a2b5d47 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-testpypi.yml @@ -11,12 +11,36 @@ jobs: uses: ./.github/workflows/quality.yml publish: + # This job publishes to TestPyPI when a GitHub release is created with a tag starting with 'v' on the release branch. + # + # Requirements: + # - Repository admin must create a release with a tag starting with 'v' (e.g., v1.2.3) + # - The tag must be created on the 'release' branch + # - The release branch is protected by rulesets requiring all changes go through PR review + # + # Security notes: + # - The tag and branch checks in this job are soft checks (can be bypassed by modifying workflow) + # - Real security enforcement comes from the 'pypi' environment which requires manual approval by org admin + # - This provides a final gate before any code is published to TestPyPI needs: test runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') environment: name: pypi - steps: + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Need full history to check branch ancestry + + - name: Check if tag is on release branch + run: | + if ! git branch -r --contains ${{ github.ref }} | grep -q 'origin/release'; then + echo "Error: Tag is not on release branch" + exit 1 + fi + echo "Tag verified to be on release branch" + - name: Download distributions uses: actions/download-artifact@v4 with: From 65f15b9d0eda09c07d86cd875797a1ab5f04a991 Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sat, 25 Oct 2025 15:53:46 -0600 Subject: [PATCH 13/16] 1.3.0 attemped direct release to pypi --- ...{publish-testpypi.yml => publish-pypi.yml} | 10 +++--- changelog.md | 36 +++++++++++++++++++ fluids/__init__.py | 2 +- pyproject.toml | 4 +-- 4 files changed, 43 insertions(+), 9 deletions(-) rename .github/workflows/{publish-testpypi.yml => publish-pypi.yml} (83%) diff --git a/.github/workflows/publish-testpypi.yml b/.github/workflows/publish-pypi.yml similarity index 83% rename from .github/workflows/publish-testpypi.yml rename to .github/workflows/publish-pypi.yml index 8a2b5d47..a305f1db 100644 --- a/.github/workflows/publish-testpypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,4 +1,4 @@ -name: Publish to TestPyPI +name: Publish to PyPI on: release: types: [published] @@ -11,7 +11,7 @@ jobs: uses: ./.github/workflows/quality.yml publish: - # This job publishes to TestPyPI when a GitHub release is created with a tag starting with 'v' on the release branch. + # This job publishes to PyPI when a GitHub release is created with a tag starting with 'v' on the release branch. # # Requirements: # - Repository admin must create a release with a tag starting with 'v' (e.g., v1.2.3) @@ -21,7 +21,7 @@ jobs: # Security notes: # - The tag and branch checks in this job are soft checks (can be bypassed by modifying workflow) # - Real security enforcement comes from the 'pypi' environment which requires manual approval by org admin - # - This provides a final gate before any code is published to TestPyPI + # - This provides a final gate before any code is published to PyPI needs: test runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/v') @@ -48,6 +48,4 @@ jobs: path: dist/ - name: Upload to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ \ No newline at end of file + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/changelog.md b/changelog.md index aaa4dc08..6072a06e 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,42 @@ ## [Unreleased] +## [1.3.0] - 2025-10-25 + +### Added + +- Project is now PEP 517 compliant and doesn't use deprecated setup.py commands anymore +- GitHub Actions workflow for publishing to PyPI using environment protection +- `uv` package manager integration across CI workflows for faster dependency resolution +- New consolidated `quality.yml` workflow for linting and testing +- New `build_third_party_packagers.yml` workflow consolidating cx_Freeze, PyInstaller, Nuitka, and py2exe testing +- Pre-commit hooks configuration +- Justfile with extensive development automation commands - github actions have been refactored use this where possible, making them locally debuggable + +### Changed + +- **Breaking**: Dropped Python 3.8 support; minimum Python version is now 3.9 +- Migrated from setup.py to pyproject.toml-only configuration (PEP 517) +- Consolidated multiarch CI workflows with reduced test matrix for improved performance +- Simplified third-party packager testing into single consolidated workflow +- Moved coverage configuration from .coveragerc to pyproject.toml +- Moved pytest configuration from pytest.ini to pyproject.toml +- Moved mypy configuration from mypy.ini to pyproject.toml +- Moved Ruff configuration from .ruff.toml to pyproject.toml +- Reorganized development requirements into pyproject.toml optional dependencies + +### Removed + +- Removed setup.py (replaced by pyproject.toml) +- Removed standalone configuration files: .coveragerc, pytest.ini, mypy.ini, .ruff.toml +- Removed separate workflow files: build_cxfreeze_library.yml, build_nuitka_library.yml, build_py2exe_library.yml, build_pyinstaller_library.yml +- Removed pre-commit.yml and security.yml workflows (consolidated into quality.yml) +- Removed separate requirements files (test, docs, multiarch) - now in pyproject.toml + +### Security + +- Implemented PyPI publishing workflow with manual approval gate + ## [1.2.0] - 2025-10-19 ### Added diff --git a/fluids/__init__.py b/fluids/__init__.py index 191ec2f6..642f1b7d 100644 --- a/fluids/__init__.py +++ b/fluids/__init__.py @@ -168,7 +168,7 @@ def all_submodules(with_numerics=True): return new_submodules -__version__ = "1.2.10" +__version__ = "1.3.0" try: fluids_dir = os.path.dirname(__file__) diff --git a/pyproject.toml b/pyproject.toml index e4ad499e..88f8a1dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ backend-path = ["_custom_build"] [project] name = "fluids" -version = "1.2.10" +version = "1.3.0" description = "Fluid dynamics component of Chemical Engineering Design Library (ChEDL)" readme = "README.rst" requires-python = ">=3.9" @@ -132,7 +132,7 @@ dev = [ [project.urls] Homepage = "https://github.com/CalebBell/fluids" -Download = "https://github.com/CalebBell/fluids/tarball/1.2.10" +Download = "https://github.com/CalebBell/fluids/tarball/1.3.0" [tool.setuptools] packages = ["fluids"] From 5aff625cd5de351924797144c5d3fd7015fbbb1d Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sun, 9 Nov 2025 00:46:07 -0700 Subject: [PATCH 14/16] Test improvement --- tests/test_fittings.py | 44 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/test_fittings.py b/tests/test_fittings.py index 5b47e450..a06ae66a 100644 --- a/tests/test_fittings.py +++ b/tests/test_fittings.py @@ -381,7 +381,8 @@ def test_bend_rounded_Miller_fuzz(): L_unimpeded = log_uniform(1e-10, Di*1000) ans = bend_rounded_Miller(Di=Di, rc=rc, angle=angle, Re=Re, roughness=roughness, L_unimpeded=L_unimpeded) if isnan(ans) or isinf(ans): - raise Exception + raise ValueError(f"bend_rounded_Miller returned {ans} (NaN or Inf) for iteration {i} with inputs: " + f"Di={Di}, rc={rc}, angle={angle}, Re={Re}, roughness={roughness}, L_unimpeded={L_unimpeded}") answers.append(ans) assert min(answers) >= 0 @@ -401,12 +402,51 @@ def test_bend_miter_Miller_fuzz(): L_unimpeded = log_uniform(1e-10, Di*1000) ans = bend_miter_Miller(Di=Di, angle=angle, Re=Re, roughness=roughness, L_unimpeded=L_unimpeded) if isnan(ans) or isinf(ans): - raise Exception + raise ValueError(f"bend_miter_Miller returned {ans} (NaN or Inf) for iteration {i} with inputs: " + f"Di={Di}, angle={angle}, Re={Re}, roughness={roughness}, L_unimpeded={L_unimpeded}") answers.append(ans) assert min(answers) >= 0 assert max(answers) < 1E10 +def test_bend_rounded_Miller_low_reynolds(): + """Test bend_rounded_Miller with very low Reynolds numbers. + + This regression test ensures the function handles Re < 10 correctly + by using the laminar friction factor. + """ + # Test case from fuzz test that previously caused NaN + result = bend_rounded_Miller( + Di=0.00025245895305993035, + rc=37.99385703460886, + angle=52.57154092916064, + Re=0.001290870786759309, + roughness=9.942554664171295e-05, + L_unimpeded=0.0007564261748889764 + ) + assert not isnan(result) and not isinf(result) + assert result >= 0 + + + +def test_bend_miter_Miller_low_reynolds(): + """Test bend_miter_Miller with very low Reynolds numbers. + + This regression test ensures the function handles Re < 10 correctly + by using the laminar friction factor. + """ + # Test case from fuzz test that previously caused NaN + result = bend_miter_Miller( + Di=0.003999207676352377, + angle=92.66290646488801, + Re=0.012296888674028263, + roughness=0.001190520629756548, + L_unimpeded=2.5794212409839814e-06 + ) + assert not isnan(result) and not isinf(result) + assert result >= 0 + + ### Diffusers From 6b55b86b980fae6bfccba23b4c70a0807981c115 Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sun, 7 Dec 2025 09:40:53 -0700 Subject: [PATCH 15/16] Docs update --- .gitignore | 2 ++ docs/Samples/Tank.ipynb | 8 ++---- docs/_static/custom.css | 16 ++++++++++++ docs/_templates/localtoc.html | 7 ++++++ docs/conf.py | 3 +++ docs/developers.rst | 4 +-- docs/examples.rst | 4 +-- docs/fluids.rst | 28 --------------------- docs/index.rst | 46 +++++++++++++++++++++++++++++++---- docs/modules.rst | 7 ------ docs/sample_programs.rst | 3 ++- docs/tutorial.rst | 46 +++++++++++++++++------------------ 12 files changed, 100 insertions(+), 74 deletions(-) create mode 100644 docs/_static/custom.css create mode 100644 docs/_templates/localtoc.html delete mode 100644 docs/fluids.rst delete mode 100644 docs/modules.rst diff --git a/.gitignore b/.gitignore index d8289295..facba821 100644 --- a/.gitignore +++ b/.gitignore @@ -61,6 +61,8 @@ dev/pyinstaller/build ._* _* !_custom_build/ +!docs/_templates/ +!docs/_static/ .Spotlight-V100 .Trashes ehthumbs.db diff --git a/docs/Samples/Tank.ipynb b/docs/Samples/Tank.ipynb index fee9b36f..743e9eae 100644 --- a/docs/Samples/Tank.ipynb +++ b/docs/Samples/Tank.ipynb @@ -4,11 +4,7 @@ "cell_type": "markdown", "id": "83344e81", "metadata": {}, - "source": [ - "## Sample Program:\n", - "\n", - "Function to automatically create a representative horizontal vessel in the process industry given a volume." - ] + "source": "## Tank Design and Weight Estimation\n\nSample program demonstrating how to automatically create a representative horizontal vessel in the process industry given a volume." }, { "cell_type": "code", @@ -689,4 +685,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/docs/_static/custom.css b/docs/_static/custom.css new file mode 100644 index 00000000..467fe7c3 --- /dev/null +++ b/docs/_static/custom.css @@ -0,0 +1,16 @@ +/* Fix for Sphinx issue #11000: nature theme sidebar overflow with autodoc names */ +/* See: https://github.com/sphinx-doc/sphinx/issues/11000 */ + +/* Increase sidebar width to accommodate longer names */ +div.documentwrapper div.bodywrapper { + margin-left: 250px; +} + +div.document div.sphinxsidebar { + width: 250px; +} + +/* Add scrollbar for overflowing content */ +div.sphinxsidebarwrapper div { + overflow: auto; +} diff --git a/docs/_templates/localtoc.html b/docs/_templates/localtoc.html new file mode 100644 index 00000000..45d89ee4 --- /dev/null +++ b/docs/_templates/localtoc.html @@ -0,0 +1,7 @@ +{# Custom local TOC template with depth limit #} +{%- if display_toc %} +
+

{{ _('Table of Contents') }}

+ {{ toctree(maxdepth=1, collapse=False, includehidden=True) }} +
+{%- endif %} diff --git a/docs/conf.py b/docs/conf.py index 3d890682..f1086483 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -163,6 +163,9 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] +# Custom CSS files +html_css_files = ["custom.css"] + # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. diff --git a/docs/developers.rst b/docs/developers.rst index 76d0f5c9..cff9d41e 100644 --- a/docs/developers.rst +++ b/docs/developers.rst @@ -89,7 +89,7 @@ Type hints are a work in progress. After numerous years supporting old python ve Supported Python Versions ------------------------- -Fluids targets Python 3.9 and up as well as PyPy3. Additionally, fluids has been tested by the author at various points to load in Micropython. +Fluids targets Python 3.9 and up as well as PyPy3. Additionally, Fluids has been tested by the author at various points to load in Micropython. Unfortunately there is no CI infrastructure for these other Python implementations. For Micropython there is no NumPy/SciPy which means there is no hope of passing the whole test suite on them either; indeed pytest won't load on any of them. @@ -100,7 +100,7 @@ Over the years the development speed of Python and IronPython have diverged sign Although a Python 3 IronPython was released at the end of 2022, the Python version implemented (3.4) was already dropped from support by Fluids; the CI could no longer work with it. At this point it would probably be recommended to use an old version of fluids with IronPython and the library will probably fail to load in IronPython due to the use of modern syntax. -Micropython is designed to run on limited RAM, and fluids is too large for most microprocessors. +Micropython is designed to run on limited RAM, and Fluids is too large for most microprocessors. You will likely have to copy/paste the specific parts of `fluids` you want to use on a microprocessor. Packaging diff --git a/docs/examples.rst b/docs/examples.rst index 71b95770..a08f5bae 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -1,9 +1,9 @@ Solved Fluids Mechanics Problems ================================ -A collection of problems from Crane TP 410 have been solved using the fluids library. +A collection of problems from Crane TP 410 have been solved using the Fluids library. These are industrially relevant problems. Crane TP 410 is used extensively as a source in -fluids, although often there are better correlations that are implemented and chosen as default methods. +Fluids, although often there are better correlations that are implemented and chosen as default methods. All problems include a description of the problems, but Crane TP 410 includes schematics that are not included here. A copy can be obtained from your local library or bought `here `_. diff --git a/docs/fluids.rst b/docs/fluids.rst deleted file mode 100644 index da9554c2..00000000 --- a/docs/fluids.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. toctree:: - - fluids.atmosphere - fluids.compressible - fluids.control_valve - fluids.core - fluids.drag - fluids.filters - fluids.fittings - fluids.flow_meter - fluids.friction - fluids.geometry - fluids.jet_pump - fluids.mixing - fluids.numba - fluids.open_flow - fluids.packed_bed - fluids.packed_tower - fluids.particle_size_distribution - fluids.piping - fluids.pump - fluids.safety_valve - fluids.separator - fluids.saltation - fluids.two_phase - fluids.two_phase_voidage - fluids.units - fluids.vectorized diff --git a/docs/index.rst b/docs/index.rst index 7560e16f..d3e0ec5d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -17,10 +17,46 @@ other flow meters, ejectors, relief valves, and more. Module Contents: .. toctree:: - :maxdepth: 2 - + :maxdepth: 1 + :caption: Tutorial + tutorial.rst - modules.rst + +.. toctree:: + :maxdepth: 1 + :caption: API + + fluids.atmosphere + fluids.compressible + fluids.control_valve + fluids.core + fluids.drag + fluids.filters + fluids.fittings + fluids.flow_meter + fluids.friction + fluids.geometry + fluids.jet_pump + fluids.mixing + fluids.numba + fluids.open_flow + fluids.packed_bed + fluids.packed_tower + fluids.particle_size_distribution + fluids.piping + fluids.pump + fluids.safety_valve + fluids.separator + fluids.saltation + fluids.two_phase + fluids.two_phase_voidage + fluids.units + fluids.vectorized + +.. toctree:: + :maxdepth: 1 + :caption: Additional Resources + examples.rst data.rst sample_programs.rst @@ -68,7 +104,7 @@ To get the git version, run: Latest source code ------------------ -The latest development version of fluids's sources can be obtained at +The latest development version of Fluids's sources can be obtained at https://github.com/CalebBell/fluids @@ -76,7 +112,7 @@ The latest development version of fluids's sources can be obtained at Bug reports ----------- -To report bugs, please use the fluids's Bug Tracker at: +To report bugs, please use the Fluids's Bug Tracker at: https://github.com/CalebBell/fluids/issues diff --git a/docs/modules.rst b/docs/modules.rst deleted file mode 100644 index caa31ef0..00000000 --- a/docs/modules.rst +++ /dev/null @@ -1,7 +0,0 @@ -API Reference -============= - -.. toctree:: - :maxdepth: 4 - - fluids diff --git a/docs/sample_programs.rst b/docs/sample_programs.rst index c8c1b527..42dc75f3 100644 --- a/docs/sample_programs.rst +++ b/docs/sample_programs.rst @@ -2,5 +2,6 @@ Sample Programs =============== .. toctree:: + :maxdepth: 1 - Samples/Tank.ipynb + Samples/Tank.ipynb diff --git a/docs/tutorial.rst b/docs/tutorial.rst index d74b4d77..fad0ca3d 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -1,4 +1,4 @@ -fluids tutorial +Fluids Tutorial =============== Importing @@ -14,7 +14,7 @@ All functions are available from either the main fluids module or the submodule; i.e. both fluids.friction_factor and fluids.friction.friction_factor are valid ways of accessing a function. -Design philosophy +Design Philosophy ----------------- Like all libraries, this was developed to scratch my own itches. Since its public release it has been found useful by many others, from students across @@ -60,7 +60,7 @@ with a different import. >>> from fluids.numba_vectorized import * # doctest: +SKIP -Dimensionless numbers +Dimensionless Numbers --------------------- More than 30 Dimensionless numbers are available in :py:mod:`fluids.core` : @@ -97,7 +97,7 @@ transfer version; it always requires mass diffusivity. Among the coded dimensionless numbers are :py:func:`~.Archimedes`, :py:func:`~.Bejan_L`, :py:func:`~.Bejan_p`, :py:func:`~.Biot`, :py:func:`~.Boiling`, :py:func:`~.Bond`, :py:func:`~.Capillary`, :py:func:`~.Cavitation`, :py:func:`~.Confinement`, :py:func:`~.Dean`, :py:func:`~.Drag`, :py:func:`~.Eckert`, :py:func:`~.Euler`, :py:func:`~.Fourier_heat`, :py:func:`~.Fourier_mass`, :py:func:`~.Froude_densimetric`, :py:func:`~.Froude`, :py:func:`~.Graetz_heat`, :py:func:`~.Grashof`, :py:func:`~.Hagen`, :py:func:`~.Jakob`, :py:func:`~.Knudsen`, :py:func:`~.Lewis`, :py:func:`~.Mach`, :py:func:`~.Nusselt`, :py:func:`~.Ohnesorge`, :py:func:`~.Peclet_heat`, :py:func:`~.Peclet_mass`, :py:func:`~.Power_number`, :py:func:`~.Prandtl`, :py:func:`~.Rayleigh`, :py:func:`~.Reynolds`, :py:func:`~.Schmidt`, :py:func:`~.Sherwood`, :py:func:`~.Stanton`, :py:func:`~.Stokes_number`, :py:func:`~.Strouhal`, :py:func:`~.Suratman`, :py:func:`~.Weber`, :py:func:`~.Morton`. -Miscellaneous utilities +Miscellaneous Utilities ----------------------- More than just dimensionless groups are implemented in :py:mod:`fluids.core`. @@ -168,7 +168,7 @@ and latitude (input in degrees and height in meters): 6.729011976863571 -Friction factors +Friction Factors ---------------- Friction factor is easily calculable with :py:func:`~.friction_factor`. @@ -248,7 +248,7 @@ with the :py:func:`~.transmission_factor` function. 0.01 -Pipe schedules +Pipe Schedules -------------- ASME/ANSI pipe tables from B36.10M-2004 and B36-19M-2004 are implemented in fluids.piping. @@ -288,7 +288,7 @@ Traceback (most recent call last): ValueError: Pipe input is larger than max of selected schedule -Wire gauges +Wire Gauges ----------- The construction of mechanical systems often uses the "gauge" systems, a variety @@ -324,7 +324,7 @@ Other schedules are also supported: 0.00102362 -Tank geometry +Tank Geometry ------------- Sizing of vessels and storage tanks is implemented in an object-oriented way @@ -387,7 +387,7 @@ surface area of the tank. >>> DIN.A_sideA, DIN.A_sideB, DIN.A_lateral, DIN.A (24.749677, 24.749677, 47.123889, 96.623244) -Miscellaneous geometry +Miscellaneous Geometry ---------------------- In addition to sizing all sorts of tanks, helical coils are supported and so are a number of other simple calculations. @@ -418,7 +418,7 @@ For a rectangle, one side length = 1, second side length = 100: 0.03079690 -Atmospheric properties +Atmospheric Properties ---------------------- Various main classes are available to model the atmosphere, of varying accuracy. They are the US Standard Atmosphere 1976 (:py:class:`~.ATMOSPHERE_1976`), a basic @@ -594,7 +594,7 @@ are obtained via the :py:class:`~.ATMOSPHERE_NRLMSISE00` class, but this quadruples the time required for the calculation. -Compressor sizing +Compressor Sizing ----------------- Both isothermal and isentropic/polytropic compression models are implemented in :py:mod:`fluids.compressible`. Isothermal compression calculates the work required to compress a gas from @@ -695,7 +695,7 @@ Checking the calculated power is the same: >>> isentropic_work_compression(P1=1E5, P2=1E6, T1=300, k=1.4, eta=eta_s) 10556.4981 -Gas pipeline sizing +Gas Pipeline Sizing ------------------- The standard isothermal compressible gas flow is fully implemented as @@ -818,7 +818,7 @@ pressure drop is approximately 1%. Please note the values given here may change as properties are updated in the `thermo` library, they are here to demonstrate the technique only. -Gas pipeline sizing: Empirical equations +Gas Pipeline Sizing: Empirical Equations ---------------------------------------- In addition to the actual model, many common simplifications used in industry are implemented as well. These are equally capable of solving for any of the @@ -890,7 +890,7 @@ the most authoritative or common ones were used in those cases. -Drag and terminal velocity +Drag and Terminal Velocity -------------------------- A number of spherical particle drag correlations are implemented. @@ -943,7 +943,7 @@ of distance travelled: Many engineering applications such as direct contact condensers do operate far from terminal velocity however, and this function is useful there. -Pressure drop through packed beds +Pressure Drop Through Packed Beds --------------------------------- Twelve different packed bed pressure drop correlations are available. A meta @@ -1027,10 +1027,10 @@ Same calculation, but using the general correlation for all shapes: >>> voidage_Benyahia_Oneil(Dpe=D_sphere_eq, Dt=0.05, sphericity=sph) 0.44257695 -Pressure drop through piping +Pressure Drop Through Piping ---------------------------- It is straightforward to calculate the pressure drop of fluid flowing in a -pipeline with any number of fittings using the fluids library's +pipeline with any number of fittings using the Fluids library's :py:mod:`fluids.fittings` submodule. 15 m of piping, with a sharp entrance and sharp exit, two 30 degree miter @@ -1102,7 +1102,7 @@ pipe (15 more meters), and a sharp exit: -Control valve sizing: Introduction +Control Valve Sizing: Introduction ---------------------------------- The now internationally-standardized methods (IEC 60534) for sizing liquid and gas valves have been implemented. Conversion factors among the different types @@ -1179,7 +1179,7 @@ have large influences on the performance of control valves. Historically, valve manufacturers had their own standards for sizing valves, but these have been standardized today into the IEC 60534 methods. -Control valve sizing: Liquid flow +Control Valve Sizing: Liquid Flow --------------------------------- To rigorously size a control valve for liquid flow, the inlet pressure, allowable pressure drop, and desired flow rate must first be known. @@ -1253,7 +1253,7 @@ pressure through a mole-weighted average. For actual values of Cv, Fl, Fd, and available diameters, an excellent resource is the `Fisher Catalog 12 `_. -Control valve sizing: Gas flow +Control Valve Sizing: Gas Flow ------------------------------ To rigorously size a control valve for gas flow, the inlet pressure, allowable pressure drop, and desired flow rate must first be known. @@ -1341,7 +1341,7 @@ Creating and solving the objective function: We see the valve should indeed be set to almost exactly 75% open to provide the desired flow. -Electric motor sizing +Electric Motor Sizing --------------------- Motors are available in standard sizes, mostly as designated by the National Electrical Manufacturers Association (NEMA). To easily determine what @@ -1533,7 +1533,7 @@ Required Resources The fluids library is designed to be a low-overhead, lightweight repository of engineering knowledge and utilities that relate to fluid dynamics. It occupies ~4 MB of RAM on load and should load in a small fraction of a -second. Fluids does load NumPy if it is present, which takes ~150 ms; fluids +second. Fluids does load NumPy if it is present, which takes ~150 ms; Fluids itself loads in approximately 20 ms. No other libraries will become required dependencies; anything else, including SciPy, is optional and loaded when needed. @@ -1542,4 +1542,4 @@ Fluids was originally tightly integrated with SciPy and NumPy; today they are optional components used for only a small amount of functionality which do not have pure-Python numerical methods implemented. Fluids targets Python 3.9 and up as well as PyPy3. Additionally, -fluids has been tested by the author to load in micropython. +Fluids has been tested by the author to load in micropython. From e2ec461bb2920fd062b82295073ca633d07e0f6f Mon Sep 17 00:00:00 2001 From: Caleb Bell Date: Sun, 7 Dec 2025 09:48:59 -0700 Subject: [PATCH 16/16] Update readthedocs install key --- .readthedocs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 1aca9f01..98134c1b 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -24,5 +24,5 @@ python: install: - method: pip path: . - extra_requires: + extra_requirements: - docs