From 8de1928a287987fd07ff92aab6b0d9d2d133559d Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:11:11 -0500 Subject: [PATCH 01/23] Fix CITATION.cff validator for Ubuntu 24.04 runner --- .github/workflows/cff-validator.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cff-validator.yml b/.github/workflows/cff-validator.yml index 83d75d0..6fce818 100644 --- a/.github/workflows/cff-validator.yml +++ b/.github/workflows/cff-validator.yml @@ -23,3 +23,5 @@ jobs: uses: actions/checkout@v4 - name: Validate CITATION.cff uses: dieghernan/cff-validator@v3 + with: + install-r: true From cff704bc5cb83220f8a5a2fd074eebde8718f9f4 Mon Sep 17 00:00:00 2001 From: Chen Heroy Date: Tue, 17 Dec 2024 15:00:43 -0700 Subject: [PATCH 02/23] update CITATION --- .gitignore | 1 + CITATION.cff | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ac9216b..611c769 100644 --- a/.gitignore +++ b/.gitignore @@ -164,3 +164,4 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +.idea/ diff --git a/CITATION.cff b/CITATION.cff index b1a5bb7..356609a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -25,9 +25,8 @@ authors: alias: NTIA/ITS email: code@ntia.gov website: 'https://its.ntia.gov' -repository-code: 'https://github.com/NTIA/LFMF' +repository-code: 'https://github.com/NTIA/LFMF-python' url: 'https://ntia.github.io/propagation-library-wiki/models/LFMF' -repository: 'https://github.com/NTIA/LFMF' keywords: - its - propagation From c948c24821fdb7bada0f5d80a9181033059ed064 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:16:53 -0500 Subject: [PATCH 03/23] Update pyupgrade pre-commit hook --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c7ec2e1..5d06997 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.19.0 + rev: v3.19.1 hooks: - id: pyupgrade args: ["--py39-plus"] From 4877693af44d72d865fc75b07889d38b1fe87625 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:25:35 -0500 Subject: [PATCH 04/23] Remove keyword resulting in misleading zenodo content --- .zenodo.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.zenodo.json b/.zenodo.json index 6bda553..c407507 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -10,7 +10,6 @@ } ], "description": "TODO-TEMPLATE. Make this the same as the abstract.", - "access_right": "open", "keywords": [ "TODO-TEMPLATE", "TODO-TEMPLATE" From 51593f68e2a9922fd8dc2d8dcfc7cba4ab68a36e Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:02:45 -0500 Subject: [PATCH 05/23] Add PropLib Wiki link to metadata --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 573e5db..454ad32 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ dev = [ ] [project.urls] +"PropLib Wiki" = "https://ntia.github.io/propagation-library-wiki/models/TODO-TEMPLATE/" "Python Wrapper Source" = "https://github.com/NTIA/TODO-TEMPLATE" "Python Wrapper Bug Tracker" = "https://github.com/NTIA/TODO-TEMPLATE/issues" "C++ Source" = "https://github.com/NTIA/TODO-TEMPLATE" From 60b44888ffdbb0ab9a31a6816e7d314d519ed13c Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:02:59 -0500 Subject: [PATCH 06/23] Add license and disclaimer information --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 3785637..5d4b25c 100644 --- a/README.md +++ b/README.md @@ -150,8 +150,18 @@ TODO-TEMPLATE: Update references - [`TODO-TEMPLATE` C++ API Reference](https://ntia.github.io/TODO-TEMPLATE) - TODO-TEMPLATE: Link supporting documentation such as ITU-R Recommendations, NTIA reports, etc. +## License ## + +See [LICENSE](./LICENSE.md). + +"Python" and the Python logos are trademarks or registered trademarks of the Python Software Foundation, used by the National Telecommunications and Information Administration with permission from the Foundation. + ## Contact ## For technical questions, contact . +## Disclaimer ## + +Certain commercial equipment, instruments, or materials are identified in this project were used for the convenience of the developers. In no case does such identification imply recommendation or endorsement by the National Telecommunications and Information Administration, nor does it imply that the material or equipment identified is necessarily the best available for the purpose. + --> From 1b417af81978be667e2249014c49a4e0d2ad4fbf Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:19:15 -0500 Subject: [PATCH 07/23] Deduplicate workflow runs --- .github/workflows/cff-validator.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cff-validator.yml b/.github/workflows/cff-validator.yml index 6fce818..27c0abc 100644 --- a/.github/workflows/cff-validator.yml +++ b/.github/workflows/cff-validator.yml @@ -2,10 +2,12 @@ name: Validate CITATION.cff on: push: + branches: ["main", "dev"] paths: - 'CITATION.cff' - '.github/workflows/cff-validator.yml' pull_request: + branches: ["main", "dev"] paths: - 'CITATION.cff' - '.github/workflows/cff-validator.yml' From 3409b56b6185b573cc6e5d185e3565ecd8155e51 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 18 Dec 2024 11:33:28 -0500 Subject: [PATCH 08/23] Fix README badge order --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8483437..e08f03a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Low Frequency / Medium Frequency (LF/MF) Propagation Model, Python® Wrapper # [![NTIA/ITS PropLib][proplib-badge]][proplib-link] -[![GitHub Issues][gh-issues-badge]][gh-issues-link] [![PyPI Release][pypi-release-badge]][pypi-release-link] [![GitHub Actions Unit Test Status][gh-actions-test-badge]][gh-actions-test-link] +[![GitHub Issues][gh-issues-badge]][gh-issues-link] [![DOI][doi-badge]][doi-link] [proplib-badge]: https://img.shields.io/badge/PropLib-badge?label=%F0%9F%87%BA%F0%9F%87%B8%20NTIA%2FITS&labelColor=162E51&color=D63E04 From 8cfc2e9da9f871f365f485211657d62b746b8609 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:51:56 -0500 Subject: [PATCH 09/23] Add pytest GitHub Actions workflow --- .github/workflows/pytest.yml | 97 ++++++++++++++++++++++++++++++++++++ README.md | 6 +-- pyproject.toml | 24 --------- 3 files changed, 100 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/pytest.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml new file mode 100644 index 0000000..018e1a4 --- /dev/null +++ b/.github/workflows/pytest.yml @@ -0,0 +1,97 @@ +name: Test with pytest + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + - dev + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + +# TODO-TEMPLATE: Populate environment variables below +# LIBRARY_BASE_REPO: The base repo with the C++ implementation, e.g. "NTIA/itm" +# LIBRARY_RELEASE_TAG: The Git tag identifying a release. Can be a pre-release. +# LIBRARY_DESTINATION_DIRECTORY: Path in this repo where shared library files should be placed +env: + LIBRARY_BASE_REPO: NTIA/proplib-template + LIBRARY_RELEASE_TAG: v1.0 + LIBRARY_DESTINATION_DIRECTORY: 'src/ITS/PropLibTemplate/' + +jobs: + run-all-tests: + name: ${{ matrix.platform.os-name }} / Py${{ matrix.py }} + runs-on: ${{ matrix.platform.os-runner }} + strategy: + fail-fast: false + matrix: + platform: + - os-name: 'Windows (64-bit)' + os-runner: 'windows-latest' + arch-id: 'x64' + release-file-pattern: '*-x64.dll' + - os-name: 'Windows (32-bit)' + os-runner: 'windows-latest' + arch-id: 'x86' + release-file-pattern: '*-x86.dll' + - os-name: 'macOS (intel/x64)' + os-runner: 'macos-13' + arch-id: 'x64' + release-file-pattern: '*.dylib' + - os-name: 'macOS (apple/arm64)' + os-runner: 'macos-latest' + arch-id: 'arm64' + release-file-pattern: '*.dylib' + - os-name: 'Linux (Ubuntu)' + os-runner: 'ubuntu-latest' + arch-id: 'x64' + release-file-pattern: '*.so' + py: # Python versions to test on all platforms + - "3.9" + - "3.10" + - "3.11" + - "3.12" + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + submodules: true + + # Cache key is unique to the combination of runner OS + architecture (matrix.arch-id) + release tag + - name: Restore ${{ env.LIBRARY_RELEASE_TAG }} binaries from cache if available + id: cache-restore + uses: actions/cache@v4 + with: + key: ${{ runner.os }}-${{ matrix.platform.arch-id }}-${{ env.LIBRARY_RELEASE_TAG }} + path: ${{ env.LIBRARY_DESTINATION_DIRECTORY}}/${{ matrix.platform.release-file-pattern }} + + # Only the binaries required for the current platform are downloaded. Note that the distributed + # wheel for proplib python packages includes all binaries, so that the wheel is inherently cross-platform. + - name: Download required ${{ env.LIBRARY_RELEASE_TAG }} binaries + if: ${{ steps.cache-restore.outputs.cache-hit != 'true' }} + uses: robinraju/release-downloader@v1 + with: + repository: ${{ env.LIBRARY_BASE_REPO }} + tag: ${{ env.LIBRARY_RELEASE_TAG }} + fileName: ${{ matrix.platform.release-file-pattern }} + tarBall: false + zipBall: false + out-file-path: ${{ env.LIBRARY_DESTINATION_DIRECTORY }} + + - name: Set up Python ${{ matrix.py }} + uses: actions/setup-python@v5 + with: + architecture: ${{ matrix.platform.arch-id }} + python-version: ${{ matrix.py }} + cache: 'pip' + + - name: Install dependencies for testing + run: python -m pip install -e .[tests] + + - name: Run pytest + run: pytest --cov-report=term-missing --no-cov-on-fail --cov diff --git a/README.md b/README.md index 5d4b25c..fa7d571 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ - Make sure to update the [pypi-release-badge] and [pypi-release-link] URLs with your package name on PyPI (NOT the repository name on GitHub!) - This can only be added once there is a published version of the package on PyPI -- The third badge is the Tox GitHub actions status. +- The third badge is the pytest GitHub actions status. - Update the repository name in [gh-actions-test-badge] and [gh-actions-test-link] - The fourth badge displays open GitHub Issues - Update the repository name in [gh-issues-badge] @@ -27,8 +27,8 @@ --> [proplib-badge]: https://img.shields.io/badge/PropLib-badge?label=%F0%9F%87%BA%F0%9F%87%B8%20NTIA%2FITS&labelColor=162E51&color=D63E04 [proplib-link]: https://ntia.github.io/propagation-library-wiki -[gh-actions-test-badge]: https://img.shields.io/github/actions/workflow/status/NTIA/TODO-TEMPLATE/tox.yml?branch=main&logo=pytest&logoColor=ffffff&label=Tests&labelColor=162E51 -[gh-actions-test-link]: https://github.com/NTIA/TODO-TEMPLATE/actions/workflows/tox.yml +[gh-actions-test-badge]: https://img.shields.io/github/actions/workflow/status/NTIA/TODO-TEMPLATE/pytest.yml?branch=main&logo=pytest&logoColor=ffffff&label=Tests&labelColor=162E51 +[gh-actions-test-link]: https://github.com/NTIA/TODO-TEMPLATE/actions/workflows/pytest.yml [pypi-release-badge]: https://img.shields.io/pypi/v/TODO-TEMPLATE?logo=pypi&logoColor=ffffff&label=Release&labelColor=162E51&color=D63E04 [pypi-release-link]: https://pypi.org/project/TODO-TEMPLATE [gh-issues-badge]: https://img.shields.io/github/issues/NTIA/TODO-TEMPLATE?logo=github&label=Issues&labelColor=162E51 diff --git a/pyproject.toml b/pyproject.toml index 454ad32..2a84cb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,6 @@ classifiers = [ tests = [ "pytest>=8.2.0,<9.0", "pytest-cov>=6.0.0,<7.0", - "tox>=4.21.1,<5.0", # Keep in sync with tool.tox.min_version ] dev = [ "hatchling>=1.25.0,<2.0", @@ -64,26 +63,3 @@ ignore-vcs = true [tool.cibuildwheel] test-command = "pytest ." test-requires = "pytest" - -[tool.tox] -min_version = "4.21.1" -env_list = ["3.9", "3.10", "3.11", "3.12", "3.13"] -skip_missing_interpreters = true # TODO override this in GHA - -[tool.tox.env.testenv] -description = "Run tests with pytest and generate coverage report" -extras = "tests" -commands = [ - "pytest", - "--cov-report=term-missing", - "--no-cov-on-fail", - "--cov", - { replace = "posargs", extend = true }, -] - -[tool.tox.gh.python] # tox-gh config for GitHub Actions testing -"3.9" = ["3.9"] -"3.10" = ["3.10"] -"3.11" = ["3.11"] -"3.12" = ["3.12"] -"3.13" = ["3.13"] From a9cb4fe64e32956fa6ee3152cdd783f652f086d8 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:54:44 -0500 Subject: [PATCH 10/23] Support 32-bit windows --- src/ITS/PropLibTemplate/proplib_loader.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ITS/PropLibTemplate/proplib_loader.py b/src/ITS/PropLibTemplate/proplib_loader.py index ff8312d..72e3dfc 100644 --- a/src/ITS/PropLibTemplate/proplib_loader.py +++ b/src/ITS/PropLibTemplate/proplib_loader.py @@ -43,6 +43,7 @@ """ import platform +import struct from ctypes import * from pathlib import Path @@ -71,7 +72,15 @@ def get_lib_name(lib_name: str) -> str: """ # Load the compiled library if platform.uname()[0] == "Windows": - lib_name += ".dll" + arch = struct.calcsize("P") * 8 # 32 or 64 + if arch == 64: + lib_name += "-x64.dll" + elif arch == 32: + lib_name += "-x86.dll" + else: + raise RuntimeError( + "Failed to determine system architecture for DLL loading" + ) elif platform.uname()[0] == "Linux": lib_name += ".so" elif platform.uname()[0] == "Darwin": From 84e80d697121ab54532ba2830539f4ca4ad43fad Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:58:39 -0500 Subject: [PATCH 11/23] Remove __all__ in package root, add check for test data --- src/ITS/PropLibTemplate/__init__.py | 3 --- tests/test_utils.py | 10 +++++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ITS/PropLibTemplate/__init__.py b/src/ITS/PropLibTemplate/__init__.py index 9145e88..98e008e 100644 --- a/src/ITS/PropLibTemplate/__init__.py +++ b/src/ITS/PropLibTemplate/__init__.py @@ -6,6 +6,3 @@ # from .proplib_template import ( # ) - -# TODO-TEMPLATE: Put the name of the module here -__all__ = ["proplib_template"] diff --git a/tests/test_utils.py b/tests/test_utils.py index 4a6a2ce..a107003 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -2,9 +2,17 @@ from pathlib import Path # Test data is expected to exist in tests/data -TEST_DATA_DIR = Path(__file__).parent / "data" +# TODO-TEMPLATE: Remove the '#' in the line below after adding your test data submodule +TEST_DATA_DIR = Path(__file__).parent # / "data" ABSTOL__DB = 0.1 # Absolute tolerance, in dB, to ensure outputs match expected value +# Check if test data directory exists and is not empty +if not TEST_DATA_DIR.exists() or not any(TEST_DATA_DIR.iterdir()): + raise RuntimeError( + f"Test data is not available in {TEST_DATA_DIR}.\n Try running " + + "`git submodule init` and `git submodule update` to clone the test data submodule." + ) + # TODO-TEMPLATE: Update CSV reader based on test data CSV structure def read_csv_test_data(filename: str): From 1abc5101564ac1b2e7ee17570cd42997b12a6f3d Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:44:48 -0500 Subject: [PATCH 12/23] Populate environment variables for pytest action --- .github/workflows/pytest.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 018e1a4..819cd04 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -14,14 +14,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true -# TODO-TEMPLATE: Populate environment variables below -# LIBRARY_BASE_REPO: The base repo with the C++ implementation, e.g. "NTIA/itm" -# LIBRARY_RELEASE_TAG: The Git tag identifying a release. Can be a pre-release. -# LIBRARY_DESTINATION_DIRECTORY: Path in this repo where shared library files should be placed env: - LIBRARY_BASE_REPO: NTIA/proplib-template - LIBRARY_RELEASE_TAG: v1.0 - LIBRARY_DESTINATION_DIRECTORY: 'src/ITS/PropLibTemplate/' + LIBRARY_BASE_REPO: NTIA/LFMF + LIBRARY_RELEASE_TAG: v1.0-rc.1 + LIBRARY_DESTINATION_DIRECTORY: 'src/ITS/Propagation/LFMF' jobs: run-all-tests: From 78facd1953a0411407c77a9f038718b96a244ce3 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:17:51 -0500 Subject: [PATCH 13/23] Update cff-validator to v4 --- .github/workflows/cff-validator.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cff-validator.yml b/.github/workflows/cff-validator.yml index 27c0abc..598eaed 100644 --- a/.github/workflows/cff-validator.yml +++ b/.github/workflows/cff-validator.yml @@ -24,6 +24,4 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Validate CITATION.cff - uses: dieghernan/cff-validator@v3 - with: - install-r: true + uses: dieghernan/cff-validator@v4 From ece190a066455da2347fac899292f263515d6773 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:18:12 -0500 Subject: [PATCH 14/23] Add buildwheels template workflow --- .github/workflows/buildwheels.yml | 86 +++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/buildwheels.yml diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml new file mode 100644 index 0000000..9266878 --- /dev/null +++ b/.github/workflows/buildwheels.yml @@ -0,0 +1,86 @@ +# Action builds a universal (Win32/Win64/macOS-universal/Linux-x64) Python wheel +# from the source code, using Hatchling, and uploads it as an artifact. This wheel +# can then be distributed with new releases. The action is triggered by pushes into `main` +# or pull_requests into `main` or `dev` (for testing). To aid in releases, the workflow is +# also triggered when new SemVer tags are created. This action handles downloading all +# shared library files and including them in the resulting wheel. +name: Build Wheels + +on: + workflow_dispatch: + push: + branches: + - main + tags: + - 'v[0-9]+.*' + pull_request: + branches: + - main + - dev + +# TODO-TEMPLATE: Populate environment variables below +# LIBRARY_BASE_REPO: The base repo with the C++ implementation, e.g. "NTIA/itm" +# LIBRARY_RELEASE_TAG: The Git tag identifying a release. Can be a pre-release. +# LIBRARY_DESTINATION_DIRECTORY: Path in this repo where shared library files should be placed +env: + LIBRARY_BASE_REPO: NTIA/proplib-template + LIBRARY_RELEASE_TAG: v1.0 + LIBRARY_DESTINATION_DIRECTORY: 'src/ITS/PropLibTemplate/' + +jobs: + build_wheel: + name: Build a universal, cross-platform wheel + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + submodules: true + + # Only the binaries required for the current platform are downloaded. Note that the distributed + # wheel for proplib python packages includes all binaries, so that the wheel is inherently cross-platform. + - name: Download required ${{ env.LIBRARY_RELEASE_TAG }} Windows binaries + uses: robinraju/release-downloader@v1 + with: + repository: ${{ env.LIBRARY_BASE_REPO }} + tag: ${{ env.LIBRARY_RELEASE_TAG }} + fileName: '*.dll' + tarBall: false + zipBall: false + out-file-path: ${{ env.LIBRARY_DESTINATION_DIRECTORY }} + + - name: Download required ${{ env.LIBRARY_RELEASE_TAG }} Linux binaries + uses: robinraju/release-downloader@v1 + with: + repository: ${{ env.LIBRARY_BASE_REPO }} + tag: ${{ env.LIBRARY_RELEASE_TAG }} + fileName: '*.so' + tarBall: false + zipBall: false + out-file-path: ${{ env.LIBRARY_DESTINATION_DIRECTORY }} + + - name: Download required ${{ env.LIBRARY_RELEASE_TAG }} macOS binaries + uses: robinraju/release-downloader@v1 + with: + repository: ${{ env.LIBRARY_BASE_REPO }} + tag: ${{ env.LIBRARY_RELEASE_TAG }} + fileName: '*.dylib' + tarBall: false + zipBall: false + out-file-path: ${{ env.LIBRARY_DESTINATION_DIRECTORY }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - name: Install build dependencies + run: pip install hatchling + + - name: Build wheels + run: hatchling build + + - uses: actions/upload-artifact@v4 + with: + name: Universal Wheel (.whl) + path: dist/*.whl From 1414e6cdcfd6c3e3acdfa9a42c4c62cfdd4014c3 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:18:39 -0500 Subject: [PATCH 15/23] Add runtimeerror documentation --- src/ITS/PropLibTemplate/proplib_loader.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ITS/PropLibTemplate/proplib_loader.py b/src/ITS/PropLibTemplate/proplib_loader.py index 72e3dfc..bd3087e 100644 --- a/src/ITS/PropLibTemplate/proplib_loader.py +++ b/src/ITS/PropLibTemplate/proplib_loader.py @@ -68,6 +68,7 @@ def get_lib_name(lib_name: str) -> str: :param lib_name: The library name, with no extension or path, e.g., "P2108-1.0" :raises NotImplementedError: For platforms other than Windows, Linux, or macOS. + :raises RuntimeError: On Windows, if unable to determine system architecture. :return: The full filename, including path and extension, of the library. """ # Load the compiled library From d29452886f392f59a66da0ec4fb051c06f8b65fb Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:32:30 -0500 Subject: [PATCH 16/23] Include sdist release artifacts --- .github/workflows/{buildwheels.yml => release.yml} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename .github/workflows/{buildwheels.yml => release.yml} (87%) diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/release.yml similarity index 87% rename from .github/workflows/buildwheels.yml rename to .github/workflows/release.yml index 9266878..7d04d25 100644 --- a/.github/workflows/buildwheels.yml +++ b/.github/workflows/release.yml @@ -1,10 +1,10 @@ # Action builds a universal (Win32/Win64/macOS-universal/Linux-x64) Python wheel -# from the source code, using Hatchling, and uploads it as an artifact. This wheel -# can then be distributed with new releases. The action is triggered by pushes into `main` +# from the source code, using Hatchling, and uploads it as an artifact. An sdist (.tar.gz) is +# also uploaded, which includes all platform shared library files. These artifacts should be +# used when creating new releases on PyPI and GitHub. The action is triggered by pushes into `main` # or pull_requests into `main` or `dev` (for testing). To aid in releases, the workflow is -# also triggered when new SemVer tags are created. This action handles downloading all -# shared library files and including them in the resulting wheel. -name: Build Wheels +# also triggered when new SemVer tags are created. +name: Build Release Artifacts on: workflow_dispatch: @@ -82,5 +82,5 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: Universal Wheel (.whl) - path: dist/*.whl + name: Release Artifacts (sdist and wheel) + path: dist/* From b5a9231ff9abed6df7ddd3522ecc9085e5eed147 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:38:29 -0500 Subject: [PATCH 17/23] Include shared library files when building sdist --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 2a84cb0..f65933e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -60,6 +60,9 @@ path = "src/ITS/PropLibTemplate/__init__.py" packages = ["src/ITS"] ignore-vcs = true +[tool.hatch.build.targets.sdist] +ignore-vcs = true + [tool.cibuildwheel] test-command = "pytest ." test-requires = "pytest" From e17cb3b7ec553a2f9be6f0e98a4ec53cd75486ea Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 16:49:10 -0500 Subject: [PATCH 18/23] Fix publication resource type field for related info --- .zenodo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zenodo.json b/.zenodo.json index c407507..09db0cf 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -28,7 +28,7 @@ { "identifier": "https://ntia.github.io/propagation-library-wiki/models/TODO-TEMPLATE/", "relation": "isDocumentedBy", - "resource_type": "softwaredocumentation" + "resource_type": "publication-softwaredocumentation" } ], "version": "TODO-TEMPLATE" From 95cb444cdb94772f96e7198508933d24d9391fa5 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:28:25 -0500 Subject: [PATCH 19/23] Update template values --- .github/workflows/pytest.yml | 2 +- .github/workflows/release.yml | 10 +++------- .zenodo.json | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 819cd04..dc73c56 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -16,7 +16,7 @@ concurrency: env: LIBRARY_BASE_REPO: NTIA/LFMF - LIBRARY_RELEASE_TAG: v1.0-rc.1 + LIBRARY_RELEASE_TAG: v1.1-rc.2 LIBRARY_DESTINATION_DIRECTORY: 'src/ITS/Propagation/LFMF' jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7d04d25..71aeace 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,14 +18,10 @@ on: - main - dev -# TODO-TEMPLATE: Populate environment variables below -# LIBRARY_BASE_REPO: The base repo with the C++ implementation, e.g. "NTIA/itm" -# LIBRARY_RELEASE_TAG: The Git tag identifying a release. Can be a pre-release. -# LIBRARY_DESTINATION_DIRECTORY: Path in this repo where shared library files should be placed env: - LIBRARY_BASE_REPO: NTIA/proplib-template - LIBRARY_RELEASE_TAG: v1.0 - LIBRARY_DESTINATION_DIRECTORY: 'src/ITS/PropLibTemplate/' + LIBRARY_BASE_REPO: NTIA/LFMF + LIBRARY_RELEASE_TAG: v1.1-rc.2 + LIBRARY_DESTINATION_DIRECTORY: 'src/ITS/Propagation/LFMF/' jobs: build_wheel: diff --git a/.zenodo.json b/.zenodo.json index b446385..690a57a 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "upload_type": "software", - "publication_date": "TODO-TEMPLATE", + "publication_date": "2025-1-22", "title": "Low Frequency / Medium Frequency (LF/MF) Propagation Model, Python Wrapper", "creators": [ { From b8d2f6bf11eb4aea49a8e92beee9ae953ac546ca Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:35:53 -0500 Subject: [PATCH 20/23] Fix expected shared library path on mac and linux --- src/ITS/PropLibTemplate/proplib_loader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ITS/PropLibTemplate/proplib_loader.py b/src/ITS/PropLibTemplate/proplib_loader.py index bd3087e..21702e3 100644 --- a/src/ITS/PropLibTemplate/proplib_loader.py +++ b/src/ITS/PropLibTemplate/proplib_loader.py @@ -83,9 +83,9 @@ def get_lib_name(lib_name: str) -> str: "Failed to determine system architecture for DLL loading" ) elif platform.uname()[0] == "Linux": - lib_name += ".so" + lib_name += "-x86_64.so" elif platform.uname()[0] == "Darwin": - lib_name += ".dylib" + lib_name += "-universal.dylib" else: raise NotImplementedError("Your OS is not yet supported") # Library should be in the same directory as this file From 529e396834473edb508e68503baad64e55e9d327 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:36:24 -0500 Subject: [PATCH 21/23] Fix shared library path on mac and linux --- src/ITS/Propagation/LFMF/proplib_loader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ITS/Propagation/LFMF/proplib_loader.py b/src/ITS/Propagation/LFMF/proplib_loader.py index bd3087e..21702e3 100644 --- a/src/ITS/Propagation/LFMF/proplib_loader.py +++ b/src/ITS/Propagation/LFMF/proplib_loader.py @@ -83,9 +83,9 @@ def get_lib_name(lib_name: str) -> str: "Failed to determine system architecture for DLL loading" ) elif platform.uname()[0] == "Linux": - lib_name += ".so" + lib_name += "-x86_64.so" elif platform.uname()[0] == "Darwin": - lib_name += ".dylib" + lib_name += "-universal.dylib" else: raise NotImplementedError("Your OS is not yet supported") # Library should be in the same directory as this file From fc257ca3d4f15188c339c88009b1fe34feef066f Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:40:20 -0500 Subject: [PATCH 22/23] Update project name for PyPI --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 00e1b9e..24569ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "LFMF" +name = "proplib-lfmf" dynamic = ["version"] description = "A Python wrapper for the NTIA/ITS implementation of the Low Frequency / Medium Frequency (LF/MF) Propagation Model" readme = "README.md" From 790c6d1f674bbdc81aa00e20ecde97484b59a70a Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Wed, 22 Jan 2025 17:43:35 -0500 Subject: [PATCH 23/23] Add test data submodule --- .gitmodules | 3 +++ tests/data | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 tests/data diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c05fabe --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tests/data"] + path = tests/data + url = https://github.com/NTIA/LFMF-test-data diff --git a/tests/data b/tests/data new file mode 160000 index 0000000..d3cc4d6 --- /dev/null +++ b/tests/data @@ -0,0 +1 @@ +Subproject commit d3cc4d6efff973b1a4fac4dbf3074439aa3246ba