From d7f1d7348e39316939727fe0cdeb31fb00662222 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 16:26:09 -0400 Subject: [PATCH 01/22] cibuildwheel?? --- .github/workflows/ci.yml | 122 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..1900d67e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,122 @@ +name: CI + +on: + push: + pull_request: + # Allow manual runs through the web UI + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + # python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.10"] + + name: Python ${{ matrix.python-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: 'x64' + + - name: Install standard and test dependencies on Mac/Linux + if: ${{ matrix.os != 'windows-latest' }} + run: pip install build coverage coveralls flake8 numpy pytest + + - name: Install standard and test dependencies on Windows + if: ${{ matrix.os == 'windows-latest' }} + run: | + choco install ninja mingw + choco install rtools --no-progress + echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH + gfortran --version + pip install coverage coveralls flake8 meson-python numpy pytest scipy + + - name: Install on Linux + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + python -m build . + pip install . + + - name: Install on MacOS + if: ${{ matrix.os == 'macos-latest' }} + run: | + brew reinstall gcc + CC=/usr/local/bin/gcc-12 python -m build . + CC=/usr/local/bin/gcc-12 pip install . + + - name: Install on Windows + if: ${{ matrix.os == 'windows-latest' }} + run: | + meson setup build + ninja -j 2 -C build + cd build + meson install --destdir=${{ env.Python3_ROOT_DIR }} + + - name: Test PEP8 compliance + run: flake8 . --count --show-source --statistics + + - name: Evaluate complexity + run: flake8 . --count --exit-zero --max-complexity=10 --statistics + + - name: Run unit and integration tests on Mac/Linux + if: ${{ matrix.os != 'windows-latest' }} + run: | + cd .. + coverage run --rcfile=apexpy/setup.cfg -m pytest + + - name: Run unit and integration tests on Windows + if: ${{ matrix.os == 'windows-latest' }} + run: | + cd .. + coverage run --rcfile=apexpy\setup.cfg -m pytest + + - name: Publish results to coveralls upon success on Mac/Linux + if: ${{ matrix.os != 'windows-latest' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd .. + coverage combine + coverage report -m + coveralls --rcfile=apexpy/setup.cfg --service=github + + - name: Publish results to coveralls upon success on Windows + if: ${{ matrix.os == 'windows-latest' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd .. + coverage combine + coverage report -m + coveralls --rcfile=apexpy\setup.cfg --service=github + + publish: + # Build wheels when pushing to any branch except main + # publish.yml will only publish if tagged ^v.* + if: | + ( + github.event_name != 'pull_request' && ( + github.ref_name != 'main' || + github.event_name == 'workflow_dispatch' + ) + ) || ( + github.event_name == 'pull_request' && + contains(github.event.pull_request.labels.*.name, 'Run publish') + ) + needs: [test] + uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@main + with: + sdist: false + test_command: 'pytest --pyargs apexpy' + submodules: false From bc61a82485dd38bc03c192b7264e4d2cf8b43e2f Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 16:28:58 -0400 Subject: [PATCH 02/22] TMP: Remove some old stuff --- .github/workflows/ci.yml | 1 - .github/workflows/docs.yml | 43 -------------- .github/workflows/main.yml | 114 ------------------------------------- 3 files changed, 158 deletions(-) delete mode 100644 .github/workflows/docs.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1900d67e..9b6df178 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,7 +114,6 @@ jobs: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'Run publish') ) - needs: [test] uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@main with: sdist: false diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index dc2d5595..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,43 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a -# variety of Python versions. For more information see: -# https://help.github.com/actions/language-and-framework-guides/ -# using-python-with-github-actions - -name: Documentation test - -on: [push, pull_request] - -jobs: - build: - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - python-version: ["3.9"] - - env: - FC: gfortran - - name: Docs ${{ matrix.python-version }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install standard and test dependencies, then apexpy - run: | - pip install build - python -m build . - pip install -r docs/requirements.txt - - - name: Check documentation build - run: sphinx-build -E -b html docs dist/docs - - - name: Check documentation links - run: sphinx-build -b linkcheck docs dist/docs - - - name: Load .zenodo.json to check for errors - run: python -c "import json; json.loads(open('.zenodo.json').read())" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index c50a12bf..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,114 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a -# variety of Python versions. For more information see: -# https://help.github.com/actions/language-and-framework-guides/ -# using-python-with-github-actions - -name: pytest with flake8 - -on: - pull_request: - push: - schedule: - - cron: "0 3 * * 1" # Runs 03:00 UT on Mondays - -jobs: - build: - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] - - name: Python ${{ matrix.python-version }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - architecture: 'x64' - - - name: Install standard and test dependencies on Mac/Linux - if: ${{ matrix.os != 'windows-latest' }} - run: pip install build coverage coveralls flake8 numpy pytest - - - name: Install standard and test dependencies on Windows - if: ${{ matrix.os == 'windows-latest' }} - run: | - choco install ninja mingw - choco install rtools --no-progress - echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH - gfortran --version - pip install coverage coveralls flake8 meson-python numpy pytest scipy - - - name: Install on Linux - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - python -m build . - pip install . - - - name: Install on MacOS - if: ${{ matrix.os == 'macos-latest' }} - run: | - brew reinstall gcc - CC=/usr/local/bin/gcc-12 python -m build . - CC=/usr/local/bin/gcc-12 pip install . - - - name: Install on Windows - if: ${{ matrix.os == 'windows-latest' }} - run: | - meson setup build - ninja -j 2 -C build - cd build - meson install --destdir=${{ env.Python3_ROOT_DIR }} - - - name: Test PEP8 compliance - run: flake8 . --count --show-source --statistics - - - name: Evaluate complexity - run: flake8 . --count --exit-zero --max-complexity=10 --statistics - - - name: Run unit and integration tests on Mac/Linux - if: ${{ matrix.os != 'windows-latest' }} - run: | - cd .. - coverage run --rcfile=apexpy/setup.cfg -m pytest - - - name: Run unit and integration tests on Windows - if: ${{ matrix.os == 'windows-latest' }} - run: | - cd .. - coverage run --rcfile=apexpy\setup.cfg -m pytest - - - name: Publish results to coveralls upon success on Mac/Linux - if: ${{ matrix.os != 'windows-latest' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd .. - coverage combine - coverage report -m - coveralls --rcfile=apexpy/setup.cfg --service=github - - - name: Publish results to coveralls upon success on Windows - if: ${{ matrix.os == 'windows-latest' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd .. - coverage combine - coverage report -m - coveralls --rcfile=apexpy\setup.cfg --service=github - - - name: Create a Windows wheel - if: ${{ matrix.os == 'windows-latest' }} - run: | - mkdir dist - pip wheel . -w dist - - - name: Upload wheels - uses: actions/upload-artifact@v3 - with: - path: dist/*.whl - if-no-files-found: warn From ab88a74933e686ab49494e6e4d02ddf7aa561124 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 16:37:07 -0400 Subject: [PATCH 03/22] MOAR --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b6df178..21e28072 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,5 +117,6 @@ jobs: uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@main with: sdist: false + test_extras: test test_command: 'pytest --pyargs apexpy' submodules: false From 0be5ad7d895b7f63d6cf9027d13138f970367a7d Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:02:08 -0400 Subject: [PATCH 04/22] MASH MASH MASH --- .github/workflows/ci.yml | 32 ++++++++++++++------------------ apexpy/tests/__init__.py | 0 cibw_before_build_macos.sh | 6 ++++++ pyproject.toml | 15 +++++++++++++++ 4 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 apexpy/tests/__init__.py create mode 100644 cibw_before_build_macos.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21e28072..9da5cb82 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,21 +102,17 @@ jobs: coveralls --rcfile=apexpy\setup.cfg --service=github publish: - # Build wheels when pushing to any branch except main - # publish.yml will only publish if tagged ^v.* - if: | - ( - github.event_name != 'pull_request' && ( - github.ref_name != 'main' || - github.event_name == 'workflow_dispatch' - ) - ) || ( - github.event_name == 'pull_request' && - contains(github.event.pull_request.labels.*.name, 'Run publish') - ) - uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish.yml@main - with: - sdist: false - test_extras: test - test_command: 'pytest --pyargs apexpy' - submodules: false + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install mingw-w64 on Windows + if: ${{ runner.os == 'Windows' }} + uses: msys2/setup-msys2@v2 + with: + path-type: inherit + install: | + mingw-w64-x86_64-gcc-fortran + + - name: Build and test wheels + uses: pypa/cibuildwheel@v2.16.1 diff --git a/apexpy/tests/__init__.py b/apexpy/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/cibw_before_build_macos.sh b/cibw_before_build_macos.sh new file mode 100644 index 00000000..03fc72b8 --- /dev/null +++ b/cibw_before_build_macos.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -e +set -x + +sudo ln -fs /usr/local/bin/gfortran-12 /usr/local/bin/gfortran diff --git a/pyproject.toml b/pyproject.toml index 51255d5e..2d59e28c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,3 +75,18 @@ source = "https://github.com/aburrell/apexpy" documentation = "https://apexpy.readthedocs.io/en/latest/" tracker = "https://github.com/aburrell/apexpy/issues" download = "https://github.com/aburrell/apexpy/releases" + +[tool.cibuildwheel] +build-verbosity = "3" +test-command = "pytest {project}" + +[tool.cibuildwheel.linux] +manylinux-i686-image = "manylinux2014" +manylinux-x86_64-image = "manylinux2014" + +[tool.cibuildwheel.macos] +before-build = "bash {project}/python/build_tools/cibw_before_build_macos.sh" + +[[tool.cibuildwheel.overrides]] +select = "*-win_amd64" +environment = { PKG_CONFIG_PATH="c:/opt/64/lib/pkgconfig" } From 923f9704fa60a14346a99d12f48afde28052da30 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:06:43 -0400 Subject: [PATCH 05/22] again --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9da5cb82..9c515514 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,6 +102,13 @@ jobs: coveralls --rcfile=apexpy\setup.cfg --service=github publish: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + name: Build wheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v4 From 2deaddbca7a25cb00488230951390df6c702cd8d Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:08:36 -0400 Subject: [PATCH 06/22] pfffffpt --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2d59e28c..dd20a34c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,7 +85,7 @@ manylinux-i686-image = "manylinux2014" manylinux-x86_64-image = "manylinux2014" [tool.cibuildwheel.macos] -before-build = "bash {project}/python/build_tools/cibw_before_build_macos.sh" +before-build = "bash {project}/cibw_before_build_macos.sh" [[tool.cibuildwheel.overrides]] select = "*-win_amd64" From f157ab074cdb3c02583cd70562e2300296fec161 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:14:57 -0400 Subject: [PATCH 07/22] test extra --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dd20a34c..ce347640 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ description = "A Python wrapper for Apex coordinates" maintainers = [ {name = "Angeline G. Burrell", email = "angeline.burrell@nrl.navy.mil"}, ] -requires-python = ">=3.7" +requires-python = ">=3.8" dependencies = [ # TODO: update to "pin-compatible" once possible, see # https://github.com/FFY00/meson-python/issues/29 @@ -79,6 +79,8 @@ download = "https://github.com/aburrell/apexpy/releases" [tool.cibuildwheel] build-verbosity = "3" test-command = "pytest {project}" +# Will cause the wheel to be installed with `pip install [test]` +test-extras = ["test"] [tool.cibuildwheel.linux] manylinux-i686-image = "manylinux2014" From ee460508302051cefe337fee8b310bb0ba7bc6f6 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:25:14 -0400 Subject: [PATCH 08/22] hmmm --- .github/workflows/ci.yml | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c515514..232674d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,10 +29,6 @@ jobs: python-version: ${{ matrix.python-version }} architecture: 'x64' - - name: Install standard and test dependencies on Mac/Linux - if: ${{ matrix.os != 'windows-latest' }} - run: pip install build coverage coveralls flake8 numpy pytest - - name: Install standard and test dependencies on Windows if: ${{ matrix.os == 'windows-latest' }} run: | @@ -40,34 +36,22 @@ jobs: choco install rtools --no-progress echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH gfortran --version - pip install coverage coveralls flake8 meson-python numpy pytest scipy - name: Install on Linux if: ${{ matrix.os == 'ubuntu-latest' }} run: | - python -m build . pip install . - name: Install on MacOS if: ${{ matrix.os == 'macos-latest' }} run: | brew reinstall gcc - CC=/usr/local/bin/gcc-12 python -m build . CC=/usr/local/bin/gcc-12 pip install . - name: Install on Windows if: ${{ matrix.os == 'windows-latest' }} run: | - meson setup build - ninja -j 2 -C build - cd build - meson install --destdir=${{ env.Python3_ROOT_DIR }} - - - name: Test PEP8 compliance - run: flake8 . --count --show-source --statistics - - - name: Evaluate complexity - run: flake8 . --count --exit-zero --max-complexity=10 --statistics + pip install . - name: Run unit and integration tests on Mac/Linux if: ${{ matrix.os != 'windows-latest' }} @@ -81,26 +65,6 @@ jobs: cd .. coverage run --rcfile=apexpy\setup.cfg -m pytest - - name: Publish results to coveralls upon success on Mac/Linux - if: ${{ matrix.os != 'windows-latest' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd .. - coverage combine - coverage report -m - coveralls --rcfile=apexpy/setup.cfg --service=github - - - name: Publish results to coveralls upon success on Windows - if: ${{ matrix.os == 'windows-latest' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - cd .. - coverage combine - coverage report -m - coveralls --rcfile=apexpy\setup.cfg --service=github - publish: strategy: fail-fast: false From 5445a6fa72e123624fda9b3481ed6a985976318d Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:40:31 -0400 Subject: [PATCH 09/22] god knows --- .github/workflows/ci.yml | 23 ++++-------------- meson.build | 15 ++++++------ {apexpy => src/apexpy}/__init__.py | 0 {apexpy => src/apexpy}/__main__.py | 0 {apexpy => src/apexpy}/_gcc_build_bitness.py | 0 {apexpy => src/apexpy}/apex.py | 0 {apexpy => src/apexpy}/apexsh.dat | Bin {apexpy => src/apexpy}/helpers.py | 0 {apexpy => src/apexpy}/igrf13coeffs.txt | 0 {apexpy/tests => tests}/__init__.py | 0 {apexpy/tests => tests}/test_Apex.py | 0 {apexpy/tests => tests}/test_cmd.py | 0 {apexpy/tests => tests}/test_convert.txt | 0 .../test_convert_single_line.txt | 0 {apexpy/tests => tests}/test_fortranapex.py | 0 {apexpy/tests => tests}/test_helpers.py | 0 16 files changed, 13 insertions(+), 25 deletions(-) rename {apexpy => src/apexpy}/__init__.py (100%) rename {apexpy => src/apexpy}/__main__.py (100%) rename {apexpy => src/apexpy}/_gcc_build_bitness.py (100%) rename {apexpy => src/apexpy}/apex.py (100%) rename {apexpy => src/apexpy}/apexsh.dat (100%) rename {apexpy => src/apexpy}/helpers.py (100%) rename {apexpy => src/apexpy}/igrf13coeffs.txt (100%) rename {apexpy/tests => tests}/__init__.py (100%) rename {apexpy/tests => tests}/test_Apex.py (100%) rename {apexpy/tests => tests}/test_cmd.py (100%) rename {apexpy/tests => tests}/test_convert.txt (100%) rename {apexpy/tests => tests}/test_convert_single_line.txt (100%) rename {apexpy/tests => tests}/test_fortranapex.py (100%) rename {apexpy/tests => tests}/test_helpers.py (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 232674d1..6b4cb242 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: python-version: ${{ matrix.python-version }} architecture: 'x64' - - name: Install standard and test dependencies on Windows + - name: Install system deps on Windows if: ${{ matrix.os == 'windows-latest' }} run: | choco install ninja mingw @@ -37,33 +37,20 @@ jobs: echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH gfortran --version - - name: Install on Linux - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - pip install . - - name: Install on MacOS if: ${{ matrix.os == 'macos-latest' }} run: | brew reinstall gcc CC=/usr/local/bin/gcc-12 pip install . - - name: Install on Windows - if: ${{ matrix.os == 'windows-latest' }} + - name: Install on not Windows + if: ${{ matrix.os != 'macos-latest' }} run: | pip install . - - name: Run unit and integration tests on Mac/Linux - if: ${{ matrix.os != 'windows-latest' }} - run: | - cd .. - coverage run --rcfile=apexpy/setup.cfg -m pytest - - - name: Run unit and integration tests on Windows - if: ${{ matrix.os == 'windows-latest' }} + - name: Run unit and integration tests run: | - cd .. - coverage run --rcfile=apexpy\setup.cfg -m pytest + pytest publish: strategy: diff --git a/meson.build b/meson.build index e7f1556d..debaada9 100644 --- a/meson.build +++ b/meson.build @@ -95,7 +95,7 @@ if is_windows # Manual add of MS_WIN64 macro when not using MSVC. # https://bugs.python.org/issue28267 - bitness = run_command('apexpy/_gcc_build_bitness.py').stdout().strip() + bitness = run_command('src/apexpy/_gcc_build_bitness.py').stdout().strip() if bitness == '64' add_global_arguments('-DMS_WIN64', language: ['c', 'fortran']) endif @@ -173,11 +173,12 @@ py3.extension_module('fortranapex', # Declare the sources py3.install_sources([ - 'apexpy/__init__.py', - 'apexpy/__main__.py', - 'apexpy/apex.py', - 'apexpy/apexsh.dat', - 'apexpy/helpers.py', - 'apexpy/igrf13coeffs.txt'], + 'src/apexpy/__init__.py', + 'src/apexpy/__main__.py', + 'src/apexpy/apex.py', + 'src/apexpy/apexsh.dat', + 'src/apexpy/helpers.py', + 'src/apexpy/igrf13coeffs.txt', + ], pure: false, subdir: 'apexpy') diff --git a/apexpy/__init__.py b/src/apexpy/__init__.py similarity index 100% rename from apexpy/__init__.py rename to src/apexpy/__init__.py diff --git a/apexpy/__main__.py b/src/apexpy/__main__.py similarity index 100% rename from apexpy/__main__.py rename to src/apexpy/__main__.py diff --git a/apexpy/_gcc_build_bitness.py b/src/apexpy/_gcc_build_bitness.py similarity index 100% rename from apexpy/_gcc_build_bitness.py rename to src/apexpy/_gcc_build_bitness.py diff --git a/apexpy/apex.py b/src/apexpy/apex.py similarity index 100% rename from apexpy/apex.py rename to src/apexpy/apex.py diff --git a/apexpy/apexsh.dat b/src/apexpy/apexsh.dat similarity index 100% rename from apexpy/apexsh.dat rename to src/apexpy/apexsh.dat diff --git a/apexpy/helpers.py b/src/apexpy/helpers.py similarity index 100% rename from apexpy/helpers.py rename to src/apexpy/helpers.py diff --git a/apexpy/igrf13coeffs.txt b/src/apexpy/igrf13coeffs.txt similarity index 100% rename from apexpy/igrf13coeffs.txt rename to src/apexpy/igrf13coeffs.txt diff --git a/apexpy/tests/__init__.py b/tests/__init__.py similarity index 100% rename from apexpy/tests/__init__.py rename to tests/__init__.py diff --git a/apexpy/tests/test_Apex.py b/tests/test_Apex.py similarity index 100% rename from apexpy/tests/test_Apex.py rename to tests/test_Apex.py diff --git a/apexpy/tests/test_cmd.py b/tests/test_cmd.py similarity index 100% rename from apexpy/tests/test_cmd.py rename to tests/test_cmd.py diff --git a/apexpy/tests/test_convert.txt b/tests/test_convert.txt similarity index 100% rename from apexpy/tests/test_convert.txt rename to tests/test_convert.txt diff --git a/apexpy/tests/test_convert_single_line.txt b/tests/test_convert_single_line.txt similarity index 100% rename from apexpy/tests/test_convert_single_line.txt rename to tests/test_convert_single_line.txt diff --git a/apexpy/tests/test_fortranapex.py b/tests/test_fortranapex.py similarity index 100% rename from apexpy/tests/test_fortranapex.py rename to tests/test_fortranapex.py diff --git a/apexpy/tests/test_helpers.py b/tests/test_helpers.py similarity index 100% rename from apexpy/tests/test_helpers.py rename to tests/test_helpers.py From e3b2cd23f1d6b83ba1e580080bfd6ab298a00055 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:47:48 -0400 Subject: [PATCH 10/22] AGAIN --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b4cb242..f1155566 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: - name: Run unit and integration tests run: | - pytest + pytest tests/ publish: strategy: From 2df3f528f29b388c12d1c2b40338005b05be6ff3 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 10 Oct 2023 17:51:20 -0400 Subject: [PATCH 11/22] Install test deps --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1155566..53ef56d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: Install on not Windows if: ${{ matrix.os != 'macos-latest' }} run: | - pip install . + pip install ".[test]" - name: Run unit and integration tests run: | From 92c491f14106258c5723340d9d64fba26e57a35e Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 09:07:51 -0400 Subject: [PATCH 12/22] Skip 3.12 --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ce347640..d97b49f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,9 +78,11 @@ download = "https://github.com/aburrell/apexpy/releases" [tool.cibuildwheel] build-verbosity = "3" -test-command = "pytest {project}" +test-command = "pytest {project}/tests" # Will cause the wheel to be installed with `pip install [test]` test-extras = ["test"] +# Skip building on CPython 3.12 on all platforms (seems meson dosen't work at the moment) +skip = "cp312-*" [tool.cibuildwheel.linux] manylinux-i686-image = "manylinux2014" From bdd1e1d52a46b3a02945ef703bc17951a89128b2 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 09:12:04 -0400 Subject: [PATCH 13/22] untabify --- pyproject.toml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d97b49f6..06fc31ed 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,13 @@ [build-system] build-backend = 'mesonpy' requires = [ - "wheel", - "meson-python>=0.12.0", - "setuptools<60.0", # Do not increase, 60.0 enables vendored distutils - "Cython>=0.29.21", - "python-dev-tools", - "oldest-supported-numpy; python_version>'3.9'", - "numpy; python_version<='3.9'" + "wheel", + "meson-python>=0.12.0", + "setuptools<60.0", # Do not increase, 60.0 enables vendored distutils + "Cython>=0.29.21", + "python-dev-tools", + "oldest-supported-numpy; python_version>'3.9'", + "numpy; python_version<='3.9'" ] [project] @@ -25,16 +25,16 @@ dependencies = [ ] readme = "README.rst" keywords = [ - "apex", - "modified apex", - "quasi-dipole", - "quasi dipole", - "coordinates", - "magnetic coordinates", - "mlt", - "magnetic local time", - "conversion", - "converting", + "apex", + "modified apex", + "quasi-dipole", + "quasi dipole", + "coordinates", + "magnetic coordinates", + "mlt", + "magnetic local time", + "conversion", + "converting", ] classifiers = [ "Development Status :: 5 - Production/Stable", @@ -47,6 +47,7 @@ classifiers = [ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries", "Topic :: Scientific/Engineering :: Physics", From 1ea721a18c8accdf5ec3794aa0f186ace291cf44 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 09:25:36 -0400 Subject: [PATCH 14/22] Why windows why --- .github/workflows/ci.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53ef56d7..efed3ade 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,10 +41,18 @@ jobs: if: ${{ matrix.os == 'macos-latest' }} run: | brew reinstall gcc - CC=/usr/local/bin/gcc-12 pip install . + CC=/usr/local/bin/gcc-12 pip install ".[test]" - - name: Install on not Windows - if: ${{ matrix.os != 'macos-latest' }} + - name: Install on Windows + if: ${{ matrix.os == 'windows-latest' }} + run: | + meson setup build + ninja -j 2 -C build + cd build + meson install --destdir=${{ env.Python3_ROOT_DIR }} + + - name: Install on linux + if: ${{ matrix.os == 'ubuntu-latest' }} run: | pip install ".[test]" From f979c99e793fa635b242b9fe96458a5685e39883 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 09:30:26 -0400 Subject: [PATCH 15/22] there's gonna be a windows murder --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efed3ade..5adc4ae6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: choco install rtools --no-progress echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH gfortran --version + pip install meson-python - name: Install on MacOS if: ${{ matrix.os == 'macos-latest' }} From bc59508e3c8936cb22a37d1f16d686afa60e72d1 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 09:48:19 -0400 Subject: [PATCH 16/22] Spam blindly at windows --- .github/workflows/ci.yml | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5adc4ae6..4f655cc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-2019] # python-version: ["3.7", "3.8", "3.9", "3.10"] python-version: ["3.10"] @@ -23,20 +23,19 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} architecture: 'x64' - - name: Install system deps on Windows - if: ${{ matrix.os == 'windows-latest' }} - run: | - choco install ninja mingw - choco install rtools --no-progress - echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH - gfortran --version - pip install meson-python + - name: Install mingw-w64 on Windows + if: ${{ runner.os == 'Windows' }} + uses: msys2/setup-msys2@v2 + with: + msystem: ucrt64 + install: mingw-w64-ucrt-x86_64-gcc-fortran - name: Install on MacOS if: ${{ matrix.os == 'macos-latest' }} @@ -44,16 +43,12 @@ jobs: brew reinstall gcc CC=/usr/local/bin/gcc-12 pip install ".[test]" - - name: Install on Windows - if: ${{ matrix.os == 'windows-latest' }} + - name: Print gfortran info run: | - meson setup build - ninja -j 2 -C build - cd build - meson install --destdir=${{ env.Python3_ROOT_DIR }} + gfortran --version - - name: Install on linux - if: ${{ matrix.os == 'ubuntu-latest' }} + - name: Install on not MacOS + if: ${{ matrix.os != 'macos-latest' }} run: | pip install ".[test]" @@ -65,7 +60,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest, windows-2019] name: Build wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -77,9 +72,9 @@ jobs: if: ${{ runner.os == 'Windows' }} uses: msys2/setup-msys2@v2 with: - path-type: inherit - install: | - mingw-w64-x86_64-gcc-fortran + msystem: ucrt64 + install: mingw-w64-ucrt-x86_64-gcc-fortran + - name: Build and test wheels uses: pypa/cibuildwheel@v2.16.1 From 4e834c22d9ea807f787c85ef0b9418057fd62be6 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 10:08:37 -0400 Subject: [PATCH 17/22] With enough monkeys --- .github/workflows/ci.yml | 6 ++++-- pyproject.toml | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f655cc6..958d0aee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,8 @@ jobs: uses: msys2/setup-msys2@v2 with: msystem: ucrt64 - install: mingw-w64-ucrt-x86_64-gcc-fortran + install: | + mingw-w64-ucrt-x86_64-toolchain - name: Install on MacOS if: ${{ matrix.os == 'macos-latest' }} @@ -73,7 +74,8 @@ jobs: uses: msys2/setup-msys2@v2 with: msystem: ucrt64 - install: mingw-w64-ucrt-x86_64-gcc-fortran + install: | + mingw-w64-ucrt-x86_64-toolchain - name: Build and test wheels diff --git a/pyproject.toml b/pyproject.toml index 06fc31ed..118ae83d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,7 +83,8 @@ test-command = "pytest {project}/tests" # Will cause the wheel to be installed with `pip install [test]` test-extras = ["test"] # Skip building on CPython 3.12 on all platforms (seems meson dosen't work at the moment) -skip = "cp312-*" +# Also skip 32bit builds +skip = ["cp312-*", "*-win32", "*-manylinux_i686"] [tool.cibuildwheel.linux] manylinux-i686-image = "manylinux2014" From 682963ca985a649c74f2241ffeb5f3dfb76754c1 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 10:19:36 -0400 Subject: [PATCH 18/22] I am out of ideas --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 958d0aee..5b3efcb5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: uses: msys2/setup-msys2@v2 with: msystem: ucrt64 + update: true install: | mingw-w64-ucrt-x86_64-toolchain @@ -74,9 +75,9 @@ jobs: uses: msys2/setup-msys2@v2 with: msystem: ucrt64 + update: true install: | mingw-w64-ucrt-x86_64-toolchain - - name: Build and test wheels uses: pypa/cibuildwheel@v2.16.1 From d0f32fbb2019f4bac6ac5957afa128630b4c3704 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 10:28:03 -0400 Subject: [PATCH 19/22] How about noooo --- meson.build | 2 -- 1 file changed, 2 deletions(-) diff --git a/meson.build b/meson.build index debaada9..b2dc0ce3 100644 --- a/meson.build +++ b/meson.build @@ -81,8 +81,6 @@ is_mingw = is_windows and cc.get_id() == 'gcc' cython_c_args = [] if is_windows - # For mingw-w64, link statically against the UCRT. - gcc_link_args = ['-lucrt', '-static'] if is_mingw add_global_link_arguments(gcc_link_args, language: ['c']) From 4cd9f7c9f00f092a57cfe133c64200fb77faf621 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 11:01:06 -0400 Subject: [PATCH 20/22] whoops --- meson.build | 4 ---- 1 file changed, 4 deletions(-) diff --git a/meson.build b/meson.build index b2dc0ce3..04722a13 100644 --- a/meson.build +++ b/meson.build @@ -82,8 +82,6 @@ is_mingw = is_windows and cc.get_id() == 'gcc' cython_c_args = [] if is_windows if is_mingw - add_global_link_arguments(gcc_link_args, language: ['c']) - # Force gcc to float64 long doubles for compatibility with MSVC # builds, for C only. add_global_arguments('-mlong-double-64', language: 'c') @@ -113,8 +111,6 @@ if is_windows endif if meson.get_compiler('fortran').get_id() == 'gcc' - add_global_link_arguments(gcc_link_args, language: ['fortran']) - # Flag needed to work around BLAS and LAPACK Gfortran dependence on # undocumented C feature when passing single character string # arguments. From 481a1e54b4da4469128d2462199685bd3d242a4b Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 11:13:36 -0400 Subject: [PATCH 21/22] slowly delete stuff until it works --- meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 04722a13..03d0af6e 100644 --- a/meson.build +++ b/meson.build @@ -104,10 +104,10 @@ if is_windows # Windows may need the directory for Python.h added. This location # does not have the same name for all installs. This is the one # for Windows on GitHub actions - incdir_py = run_command(py3, - ['-c', 'import os; os.chdir(".."); import sys; print(os.path.join(sys.prefix, "include"))'], - check : true).stdout().strip() - inc_dirs = include_directories(incdir_numpy, incdir_f2py, incdir_py) + # incdir_py = run_command(py3, + # ['-c', 'import os; os.chdir(".."); import sys; print(os.path.join(sys.prefix, "include"))'], + # check : true).stdout().strip() + # inc_dirs = include_directories(incdir_numpy, incdir_f2py, incdir_py) endif if meson.get_compiler('fortran').get_id() == 'gcc' From 11bdf41bfe098bdd9860c91e4c39add390d5dbf6 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Wed, 11 Oct 2023 11:40:59 -0400 Subject: [PATCH 22/22] Only build on cpython --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 118ae83d..7f3ccfb2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,7 @@ tracker = "https://github.com/aburrell/apexpy/issues" download = "https://github.com/aburrell/apexpy/releases" [tool.cibuildwheel] +build = "cp*" build-verbosity = "3" test-command = "pytest {project}/tests" # Will cause the wheel to be installed with `pip install [test]` @@ -93,6 +94,9 @@ manylinux-x86_64-image = "manylinux2014" [tool.cibuildwheel.macos] before-build = "bash {project}/cibw_before_build_macos.sh" +[tool.cibuildwheel.windows] +repair-wheel-command = "bash python/build_tools/cibw_repair_wheel_command_windows.sh {wheel} {dest_dir}" + [[tool.cibuildwheel.overrides]] select = "*-win_amd64" environment = { PKG_CONFIG_PATH="c:/opt/64/lib/pkgconfig" }