From 535e2f1eecacb3f74c205e77328ad81c52a0051c Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 15 Sep 2021 09:18:03 -0400 Subject: [PATCH 01/29] start of try to add cibuildwheel to spiceypy --- .github/workflows/ci-build.yml | 34 +++++++++++++++++++++++++++++ pyproject.toml | 39 ++++++++++++++++++++++++++++++++++ setup.py | 6 +++--- 3 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 00bd3c42..4c0a1977 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -105,3 +105,37 @@ jobs: - name: Upload ๐Ÿ†™ coverage ๐Ÿ“ˆ report to codecov run: | codecov + build-wheels: + name: Build SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ wheels of ${{ matrix.os }} + runs-on: + strategy: $${{ matrix.os }} + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Checkout ๐ŸŒถ๏ธ ๐Ÿฅง + uses: actions/checkout@v2 + - name: Set up Python ๐Ÿ 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Display Python ๐Ÿ Version + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install -r ci-requirements.txt + python -m pip install cibuildwheel==2.1.2 + - name: Build wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง + run: | + python -m cibuildwheel --output-dir wheelhouse + - name: Inspect outputs + run: | + ls ./wheelhouse/ -lahtr + ls ./ -lahtr + python -m zipfile --list ./wheelhouse/*.whl + - name: Upload wheels + uses: actions/upload-artifact@v2 + with: + name: spiceypy_wheels + path: ./wheelhouse/*.whl + diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..9cd2e3d5 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,39 @@ +[project] +name = "spiceypy" +version="4.0.2" +author="Andrew Annex" +author_email="ama6fy@virginia.edu" +description="A Python Wrapper for the NAIF CSPICE Toolkit" +license = "MIT" +homepage = "https://github.com/AndrewAnnex/SpiceyPy" +repository = "https://github.com/AndrewAnnex/SpiceyPy" +documentation = "https://spiceypy.readthedocs.io" +keywords=["spiceypy", "spice", "naif", "jpl", "space", "geometry", "ephemeris"] +readme = "README.rst" +classifiers=[ + "Development Status :: 5 - Production/Stable", + "Natural Language :: English", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Astronomy", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Operating System :: MacOS :: MacOS X", + "Operating System :: POSIX :: Linux", + "Operating System :: POSIX :: BSD :: FreeBSD", + "Operating System :: Microsoft :: Windows", +] +requires-python = ">=3.6, <4" +dependencies = ["numpy>=1.17.0"] + +[build-system] +requires = ["setuptools >= 42", "wheel"] +build-backend = "setuptools.build_meta" + + +[tool.cibuildwheel] +build-verbosity = 2 +before-test = "pip install -r ci-requirements.txt" +test-command = "pytest spiceypy/tests" \ No newline at end of file diff --git a/setup.py b/setup.py index 9b3d4fbb..dfc4ec87 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ from get_spice import InstallCSpice DEV_CI_DEPENDENCIES = [ - 'numpy>=1.17.0;python_version>="3.5"', + 'numpy>=1.17.0;python_version>="3.6"', "pytest>=2.9.0", "pandas>=0.24.0", "coverage>=5.1.0", @@ -42,12 +42,12 @@ ] TEST_DEPENDENCIES = [ - 'numpy>=1.17.0;python_version>="3.5"', + 'numpy>=1.17.0;python_version>="3.6"', "pytest>=2.9.0", "pandas>=0.24.0", ] DEPENDENCIES = [ - 'numpy>=1.17.0;python_version>="3.5"', + 'numpy>=1.17.0;python_version>="3.6"', ] REQUIRES = ["numpy"] From c61f6c2a21cec5f7ab4ff3105b6459e53df3269d Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 15 Sep 2021 09:20:11 -0400 Subject: [PATCH 02/29] quick fix --- .github/workflows/ci-build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 4c0a1977..035c2bc0 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -106,11 +106,11 @@ jobs: run: | codecov build-wheels: - name: Build SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ wheels of ${{ matrix.os }} - runs-on: - strategy: $${{ matrix.os }} + strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + name: Build SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ wheels of ${{ matrix.os }} + runs-on: $${{ matrix.os }} steps: - name: Checkout ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/checkout@v2 From 60a35f12caa2ae687868ca84d787b30ef31615fe Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 15 Sep 2021 12:41:49 -0400 Subject: [PATCH 03/29] not sure why builds won't start for cibuildwheel --- .github/workflows/ci-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 035c2bc0..8545adba 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -105,12 +105,12 @@ jobs: - name: Upload ๐Ÿ†™ coverage ๐Ÿ“ˆ report to codecov run: | codecov - build-wheels: + build_wheels: + runs-on: $${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] name: Build SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ wheels of ${{ matrix.os }} - runs-on: $${{ matrix.os }} steps: - name: Checkout ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/checkout@v2 From 31da087323a30d8c4dcb0e537f1d8cdeae72e2ad Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 15 Sep 2021 19:22:06 -0400 Subject: [PATCH 04/29] fix for failing to start builds --- .github/workflows/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 8545adba..a045ea51 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -106,7 +106,7 @@ jobs: run: | codecov build_wheels: - runs-on: $${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] From 24dcf3e17cc2d12ed8f585e74662d824cf39a626 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 15 Sep 2021 19:43:08 -0400 Subject: [PATCH 05/29] made changes to wrong branch --- setup.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index dfc4ec87..e6c12f61 100644 --- a/setup.py +++ b/setup.py @@ -28,8 +28,6 @@ from setuptools.command.build_py import build_py from setuptools.dist import Distribution -from get_spice import InstallCSpice - DEV_CI_DEPENDENCIES = [ 'numpy>=1.17.0;python_version>="3.6"', "pytest>=2.9.0", @@ -71,6 +69,8 @@ def finalize_options(self): self.install_lib = self.install_platlib def run(self): + from get_spice import InstallCSpice + InstallCSpice.get_cspice() install.run(self) @@ -88,6 +88,8 @@ def finalize_options(self): pass def run(self): + from get_spice import InstallCSpice + InstallCSpice.get_cspice() @@ -95,6 +97,8 @@ class BuildPyCommand(build_py): """Custom build command to ensure cspice is built and packaged""" def run(self): + from get_spice import InstallCSpice + InstallCSpice.get_cspice() build_py.run(self) @@ -139,7 +143,10 @@ def run(self): include_package_data=True, zip_safe=False, distclass=SpiceyPyBinaryDistribution, - package_data={"spiceypy": ["utils/*.so", "utils/*.dll"]}, + package_data={ + "spiceypy": ["utils/*.so", "utils/*.dll"], + "": ["get_spice.py", "LICENSE"], + }, setup_requires=DEPENDENCIES, install_requires=DEPENDENCIES, requires=REQUIRES, From 0c5e1fcf4635076fd5e546d9c7e97b5f521d5e87 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 15 Sep 2021 19:59:33 -0400 Subject: [PATCH 06/29] looks like get_spice is not available to build_py, need to call it ahead of time maybe --- pyproject.toml | 4 ++-- setup.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9cd2e3d5..fa9c1166 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,8 @@ dependencies = ["numpy>=1.17.0"] requires = ["setuptools >= 42", "wheel"] build-backend = "setuptools.build_meta" - [tool.cibuildwheel] build-verbosity = 2 +before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" -test-command = "pytest spiceypy/tests" \ No newline at end of file +test-command = "pytest spiceypy/tests" diff --git a/setup.py b/setup.py index e6c12f61..50339fc6 100644 --- a/setup.py +++ b/setup.py @@ -97,10 +97,14 @@ class BuildPyCommand(build_py): """Custom build command to ensure cspice is built and packaged""" def run(self): - from get_spice import InstallCSpice - - InstallCSpice.get_cspice() - build_py.run(self) + try: + from get_spice import InstallCSpice + + InstallCSpice.get_cspice() + except ModuleNotFoundError as mnfe: + pass + finally: + build_py.run(self) cmdclass = { From 90c34331620e1062fc4ea84fe4ece9b573ea1456 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 15 Sep 2021 21:37:25 -0400 Subject: [PATCH 07/29] okay maybe something here is correct? but I need to post an issue to see what the proper process should be --- setup.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 50339fc6..be1a33c4 100644 --- a/setup.py +++ b/setup.py @@ -69,10 +69,14 @@ def finalize_options(self): self.install_lib = self.install_platlib def run(self): - from get_spice import InstallCSpice + try: + from get_spice import InstallCSpice - InstallCSpice.get_cspice() - install.run(self) + InstallCSpice.get_cspice() + except ModuleNotFoundError as mnfe: + pass + finally: + install.run(self) class GetCSPICECommand(Command): @@ -88,9 +92,12 @@ def finalize_options(self): pass def run(self): - from get_spice import InstallCSpice + try: + from get_spice import InstallCSpice - InstallCSpice.get_cspice() + InstallCSpice.get_cspice() + except ModuleNotFoundError as mnfe: + pass class BuildPyCommand(build_py): From 65001b01df24bd769dc58a1c3ff1b02b09756835 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Mon, 20 Sep 2021 10:10:26 -0400 Subject: [PATCH 08/29] not sure if this helps, may have to ask around --- pyproject.toml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fa9c1166..b21b3c27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,19 @@ requires = ["setuptools >= 42", "wheel"] build-backend = "setuptools.build_meta" [tool.cibuildwheel] +# Skip 32-bit builds +skip = ["*-win32", "*-manylinux_i686"] +# Disable building PyPy wheels on all platforms +skip = "pp*" +# other options build-verbosity = 2 before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" test-command = "pytest spiceypy/tests" + + +[tool.cibuildwheel.macos] +archs = ["x86_64"] + +[tool.cibuildwheel.linux] +archs = ["x86_64"] \ No newline at end of file From 151ac7e0497508e90c77a975dd6edb0535fa1ae5 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Mon, 20 Sep 2021 19:28:58 -0400 Subject: [PATCH 09/29] fixes --- pyproject.toml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b21b3c27..728cf490 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,18 +33,16 @@ requires = ["setuptools >= 42", "wheel"] build-backend = "setuptools.build_meta" [tool.cibuildwheel] -# Skip 32-bit builds -skip = ["*-win32", "*-manylinux_i686"] -# Disable building PyPy wheels on all platforms -skip = "pp*" +# Skip 32-bit builds and pypy +skip = ["*-win32", "*-manylinux_i686", "pp*"] # other options build-verbosity = 2 before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" test-command = "pytest spiceypy/tests" - [tool.cibuildwheel.macos] +# to start just try to get amd64 working, later we can worry about arm archs = ["x86_64"] [tool.cibuildwheel.linux] From a79ff297ed42c0b4b1a1c4b85cbc9d28ab9286d2 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Mon, 20 Sep 2021 19:35:10 -0400 Subject: [PATCH 10/29] fix for pypy exclusion --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 728cf490..7f39bc07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ build-backend = "setuptools.build_meta" [tool.cibuildwheel] # Skip 32-bit builds and pypy -skip = ["*-win32", "*-manylinux_i686", "pp*"] +skip = ["*-win32", "*-manylinux_i686", "pypy*"] # other options build-verbosity = 2 before-build = "python get_spice.py" From 84d2c53c39420811f005a8cda216c69d25fba6de Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Mon, 20 Sep 2021 20:04:30 -0400 Subject: [PATCH 11/29] force use build --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7f39bc07..7373d1c3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ build-backend = "setuptools.build_meta" # Skip 32-bit builds and pypy skip = ["*-win32", "*-manylinux_i686", "pypy*"] # other options +build-frontend = "build" build-verbosity = 2 before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" From 66afd641ae68a96e2ae6e492a7b76d97c63baca8 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Mon, 20 Sep 2021 20:20:33 -0400 Subject: [PATCH 12/29] that change didn't do what I thought it was doing --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7373d1c3..7f39bc07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,6 @@ build-backend = "setuptools.build_meta" # Skip 32-bit builds and pypy skip = ["*-win32", "*-manylinux_i686", "pypy*"] # other options -build-frontend = "build" build-verbosity = 2 before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" From c81dcb50382333fe306edb4f96a109d67246e5cc Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 09:42:35 -0400 Subject: [PATCH 13/29] trying to override bdist_wheel again --- setup.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/setup.py b/setup.py index be1a33c4..a0345dad 100644 --- a/setup.py +++ b/setup.py @@ -120,6 +120,33 @@ def run(self): "get_cspice": GetCSPICECommand, } +# https://stackoverflow.com/questions/45150304/how-to-force-a-python-wheel-to-be-platform-specific-when-building-it +# http://lepture.com/en/2014/python-on-a-hard-wheel +try: + from wheel.bdist_wheel import bdist_wheel as _bdist_wheel + + class generic_bdist_wheel(_bdist_wheel): + """ + override for bdist_wheel + """ + + def finalize_options(self) -> None: + _bdist_wheel.finalize_options(self) + self.root_is_pure = False + + def get_tag(self) -> (str, str, str): + python, abi, plat = _bdist_wheel.get_tag(self) + python = "py36.py37.py38.py39" + return python, abi, plat + + # add our override to the cmdclass dict so we can inject this behavior + cmdclass["bdist_wheel"] = generic_bdist_wheel + +except ImportError: + # we don't have wheel installed so there is nothing to change + pass + + readme = open("README.rst", "r") readmetext = readme.read() readme.close() From 3f435c8a41867c592abb3da2c2081efa64eeb8e5 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 09:50:48 -0400 Subject: [PATCH 14/29] changing abi compatiblity to abi3, I think that may force generic python3 compatibility without allowing a pure python library --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a0345dad..72da1b0f 100644 --- a/setup.py +++ b/setup.py @@ -136,8 +136,7 @@ def finalize_options(self) -> None: def get_tag(self) -> (str, str, str): python, abi, plat = _bdist_wheel.get_tag(self) - python = "py36.py37.py38.py39" - return python, abi, plat + return "py36.py37.py38.py39", "abi3", plat # add our override to the cmdclass dict so we can inject this behavior cmdclass["bdist_wheel"] = generic_bdist_wheel From c9d531db493da54cb8c293c14c0b9e70dace1179 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 09:57:39 -0400 Subject: [PATCH 15/29] looks like python tag cannot have multiple 3.x versions, according to https://github.com/pypa/wheel/issues/336 the installer decides this behavior so it maybe safe to leave the default python version and just insert an abi3 tag --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 72da1b0f..fee19352 100644 --- a/setup.py +++ b/setup.py @@ -136,7 +136,7 @@ def finalize_options(self) -> None: def get_tag(self) -> (str, str, str): python, abi, plat = _bdist_wheel.get_tag(self) - return "py36.py37.py38.py39", "abi3", plat + return python, "abi3", plat # add our override to the cmdclass dict so we can inject this behavior cmdclass["bdist_wheel"] = generic_bdist_wheel From 9ed7a96699dbfb179a61f06ad46866f223c924f7 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 10:05:24 -0400 Subject: [PATCH 16/29] actually do set the python tag to py3 to avoid specific python version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fee19352..5dba6704 100644 --- a/setup.py +++ b/setup.py @@ -136,7 +136,7 @@ def finalize_options(self) -> None: def get_tag(self) -> (str, str, str): python, abi, plat = _bdist_wheel.get_tag(self) - return python, "abi3", plat + return "py3", "abi3", plat # add our override to the cmdclass dict so we can inject this behavior cmdclass["bdist_wheel"] = generic_bdist_wheel From d20a9afb1d9b21f87c4ff073f18c1d1a68ab89ac Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 10:12:20 -0400 Subject: [PATCH 17/29] maybe I am overthinking the abi bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5dba6704..14b8a803 100644 --- a/setup.py +++ b/setup.py @@ -136,7 +136,7 @@ def finalize_options(self) -> None: def get_tag(self) -> (str, str, str): python, abi, plat = _bdist_wheel.get_tag(self) - return "py3", "abi3", plat + return "py3", "none", plat # add our override to the cmdclass dict so we can inject this behavior cmdclass["bdist_wheel"] = generic_bdist_wheel From adcf6e787c87d69ecffd6f8a190aa9b00a922102 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 10:17:50 -0400 Subject: [PATCH 18/29] using a different command for tests, I install the tests with the package --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 7f39bc07..e4a2a6a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,11 +39,11 @@ skip = ["*-win32", "*-manylinux_i686", "pypy*"] build-verbosity = 2 before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" -test-command = "pytest spiceypy/tests" +test-command = "pytest --pyargs {project}" [tool.cibuildwheel.macos] # to start just try to get amd64 working, later we can worry about arm archs = ["x86_64"] [tool.cibuildwheel.linux] -archs = ["x86_64"] \ No newline at end of file +archs = ["x86_64"] From ab83162c5140b433e1450f9847af9dc24e7f9082 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 17:54:52 -0400 Subject: [PATCH 19/29] found example from xmlstarlet that may help me --- .github/workflows/ci-build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index a045ea51..e626c462 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -114,6 +114,9 @@ jobs: steps: - name: Checkout ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/checkout@v2 + - name: Setup ๐Ÿ”ฌ๐Ÿฆ๐Ÿ—๏ธ + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1.4.1 - name: Set up Python ๐Ÿ 3.9 uses: actions/setup-python@v2 with: @@ -128,12 +131,12 @@ jobs: - name: Build wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง run: | python -m cibuildwheel --output-dir wheelhouse - - name: Inspect outputs + - name: Inspect outputs for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง run: | ls ./wheelhouse/ -lahtr ls ./ -lahtr python -m zipfile --list ./wheelhouse/*.whl - - name: Upload wheels + - name: Upload wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/upload-artifact@v2 with: name: spiceypy_wheels From 555c8a1f469df40a9675f24d8b0cde3ffb014340 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 18:14:36 -0400 Subject: [PATCH 20/29] okay cibuildwheel tries to build each wheel possible, let's set a single python version for now, otherwise we can just build N wheels --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index e4a2a6a7..e6247280 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,8 @@ requires = ["setuptools >= 42", "wheel"] build-backend = "setuptools.build_meta" [tool.cibuildwheel] +# Only build on CPython 3.9 +build = "cp39-*" # Skip 32-bit builds and pypy skip = ["*-win32", "*-manylinux_i686", "pypy*"] # other options From 57a69c2da6c619b226a6dfcb67cdcbca8cb043b7 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 18:33:45 -0400 Subject: [PATCH 21/29] fix --- .github/workflows/ci-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e626c462..4f1e8b91 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -134,7 +134,6 @@ jobs: - name: Inspect outputs for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง run: | ls ./wheelhouse/ -lahtr - ls ./ -lahtr python -m zipfile --list ./wheelhouse/*.whl - name: Upload wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/upload-artifact@v2 From f24b6e020cddd4bc0ccf0bac7a1d43636f209852 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 18:40:28 -0400 Subject: [PATCH 22/29] okay maybe ls tags are the problem? --- .github/workflows/ci-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 4f1e8b91..eec50099 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -133,7 +133,7 @@ jobs: python -m cibuildwheel --output-dir wheelhouse - name: Inspect outputs for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง run: | - ls ./wheelhouse/ -lahtr + ls ./wheelhouse/ python -m zipfile --list ./wheelhouse/*.whl - name: Upload wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/upload-artifact@v2 From 7e21a0111a2a7d8adfa06bcfb6e371ba024dcb1c Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Tue, 21 Sep 2021 19:02:48 -0400 Subject: [PATCH 23/29] okay running into a silly shell issue, removing the inspect step as the logs for cibuildwheel are verbose enough --- .github/workflows/ci-build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index eec50099..dfd40c04 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -131,10 +131,6 @@ jobs: - name: Build wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง run: | python -m cibuildwheel --output-dir wheelhouse - - name: Inspect outputs for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง - run: | - ls ./wheelhouse/ - python -m zipfile --list ./wheelhouse/*.whl - name: Upload wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/upload-artifact@v2 with: From 96f18419e5ee5c0f7487a44368f8eb98eee73f45 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 22 Sep 2021 10:56:37 -0400 Subject: [PATCH 24/29] adding fix for macos deployment target to match cspice macos 10.11 --- .github/workflows/ci-build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index dfd40c04..28fd2c19 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -107,6 +107,8 @@ jobs: codecov build_wheels: runs-on: ${{ matrix.os }} + env: + MACOSX_DEPLOYMENT_TARGET: "10.11" strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] From 8b7156ecd62bf0e4d1bea525576459bbf4091fb1 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Fri, 24 Sep 2021 07:51:19 -0400 Subject: [PATCH 25/29] try adding coverage/codecov to wheels --- pyproject.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e6247280..921aace0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,10 @@ skip = ["*-win32", "*-manylinux_i686", "pypy*"] build-verbosity = 2 before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" -test-command = "pytest --pyargs {project}" +test-command = [ + "coverage run --source {package} -m pytest --pyargs {project}", + "cd {output_dir} && coverage combine --append {package} && codecov" +] [tool.cibuildwheel.macos] # to start just try to get amd64 working, later we can worry about arm From 7442e70d223adc3ca6b4d3600102f1164432a812 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Fri, 24 Sep 2021 08:01:52 -0400 Subject: [PATCH 26/29] do I really need to modify the coverage report? --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 921aace0..6b649fbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" test-command = [ "coverage run --source {package} -m pytest --pyargs {project}", - "cd {output_dir} && coverage combine --append {package} && codecov" + "(codecov; exit 0)" ] [tool.cibuildwheel.macos] From 1fb77aa021e445535c22f5059bc69bc40401cf55 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Fri, 24 Sep 2021 08:10:47 -0400 Subject: [PATCH 27/29] well that didn't work --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6b649fbe..689d49b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" test-command = [ "coverage run --source {package} -m pytest --pyargs {project}", - "(codecov; exit 0)" + "codecov" ] [tool.cibuildwheel.macos] From 448ee1d12cfac2a16c64d08272e7355ddfc0bde4 Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Fri, 24 Sep 2021 08:50:52 -0400 Subject: [PATCH 28/29] I think this may combine coverage paths without needing to use coverage combine command --- setup.cfg | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 setup.cfg diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..e4ea4f84 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,9 @@ + + +[coverage:run] +relative_files = True + +[coverage:paths] +source = + spiceypy/ + work/SpiceyPy/SpiceyPy/ From 6de43120cc24c150c6b121e2ab307f45bbc6d61c Mon Sep 17 00:00:00 2001 From: Andrew Annex Date: Wed, 29 Sep 2021 16:03:27 -0400 Subject: [PATCH 29/29] moved wheel building to other workflow replacing windows wheel builds, reconfigured to always build sdist and wheels but only upload on pushed tags --- .github/workflows/ci-build.yml | 33 ------- .../publish-to-test-and-live-pypi.yml | 97 +++++++++---------- pyproject.toml | 1 - 3 files changed, 44 insertions(+), 87 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 28fd2c19..b4bea0ed 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -105,37 +105,4 @@ jobs: - name: Upload ๐Ÿ†™ coverage ๐Ÿ“ˆ report to codecov run: | codecov - build_wheels: - runs-on: ${{ matrix.os }} - env: - MACOSX_DEPLOYMENT_TARGET: "10.11" - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - name: Build SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ wheels of ${{ matrix.os }} - steps: - - name: Checkout ๐ŸŒถ๏ธ ๐Ÿฅง - uses: actions/checkout@v2 - - name: Setup ๐Ÿ”ฌ๐Ÿฆ๐Ÿ—๏ธ - if: runner.os == 'Windows' - uses: ilammy/msvc-dev-cmd@v1.4.1 - - name: Set up Python ๐Ÿ 3.9 - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Display Python ๐Ÿ Version - run: python -c "import sys; print(sys.version)" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install -r ci-requirements.txt - python -m pip install cibuildwheel==2.1.2 - - name: Build wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง - run: | - python -m cibuildwheel --output-dir wheelhouse - - name: Upload wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง - uses: actions/upload-artifact@v2 - with: - name: spiceypy_wheels - path: ./wheelhouse/*.whl diff --git a/.github/workflows/publish-to-test-and-live-pypi.yml b/.github/workflows/publish-to-test-and-live-pypi.yml index 71d0f63a..6f40cf32 100644 --- a/.github/workflows/publish-to-test-and-live-pypi.yml +++ b/.github/workflows/publish-to-test-and-live-pypi.yml @@ -1,6 +1,7 @@ name: Publish Python ๐Ÿ distributions ๐Ÿ“ฆ to PyPI and TestPyPI on: + pull_request: push: branches: [ main ] tags: [ 'v*' ] @@ -8,8 +9,8 @@ on: types: [ published ] jobs: - build-n-publish-linux: - name: Build and publish SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ distributions ๐Ÿ“ฆ to PyPI and TestPyPI + build_sdist: + name: Make SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ source distribution runs-on: ubuntu-latest steps: - name: Checkout ๐ŸŒถ๏ธ ๐Ÿฅง @@ -38,69 +39,59 @@ jobs: python setup.py sdist - uses: actions/upload-artifact@v2 with: - name: spiceypy_linux_dist - path: dist/ - - name: Publish distribution ๐Ÿ“ฆ to Test PyPI - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }} - run: | - twine upload --non-interactive --skip-existing --repository testpypi dist/* - - name: Publish distribution ๐Ÿ“ฆ to PyPI - if: startsWith(github.ref, 'refs/tags') && (github.event_name == 'push' || github.event_name == 'release') - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - twine upload --non-interactive --skip-existing dist/* - build-n-publish-windows: - name: Build and publish SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ distributions ๐Ÿ“ฆ to PyPI and TestPyPI on Windows + path: dist/*.tar.gz + build_wheels: + env: + MACOSX_DEPLOYMENT_TARGET: "10.11" strategy: matrix: - include: - - python-version: 3.6 - python-tag: "cp36" - - python-version: 3.7 - python-tag: "cp37" - - python-version: 3.8 - python-tag: "cp38" - - python-version: 3.9 - python-tag: "cp39" - runs-on: windows-latest + os: [ ubuntu-latest, macos-latest, windows-latest ] + name: Build SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ wheels for ${{ matrix.os }} + runs-on: ${{ matrix.os }} steps: - - name: Setup ๐Ÿ”ฌ๐Ÿฆ๐Ÿ—๏ธ - uses: ilammy/msvc-dev-cmd@v1.4.1 - name: Checkout ๐ŸŒถ๏ธ ๐Ÿฅง uses: actions/checkout@v2 - - name: Set up Python ๐Ÿ ${{ matrix.python-version }} + - name: Setup ๐Ÿ”ฌ๐Ÿฆ๐Ÿ—๏ธ + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1.4.1 + - name: Set up Python ๐Ÿ 3.9 uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} - - name: Display Python ๐Ÿ + python-version: 3.9 + - name: Display Python ๐Ÿ Version run: python -c "import sys; print(sys.version)" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r ci-requirements.txt - - name: Install SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง - run: | - python setup.py install - - name: Test ๐Ÿงช with coverage ๐Ÿ“ˆ - run: | - coverage run --source spiceypy -m pytest --pyargs spiceypy - - name: Upload coverage report to codecov - run: | - codecov - - name: Build ๐Ÿ› ๏ธ sdist source - run: | - python setup.py sdist - - name: Build ๐Ÿ› ๏ธ bdist_wheel + python -m pip install -r ci-requirements.txt + python -m pip install cibuildwheel==2.1.2 + - name: Build wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง run: | - python setup.py bdist_wheel --plat-name="win-amd64" --python-tag=${{ matrix.python-tag }} - - uses: actions/upload-artifact@v2 + python -m cibuildwheel --output-dir wheelhouse + - name: Upload wheels for SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง + uses: actions/upload-artifact@v2 + with: + path: ./wheelhouse/*.whl + publish_to_pypi: + name: Publish SpiceyPy ๐ŸŒถ๏ธ ๐Ÿฅง Python ๐Ÿ distributions ๐Ÿ“ฆ to PyPI and TestPyPI + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' + steps: + - uses: actions/download-artifact@v2 + with: + name: artifact + path: dist + - name: Set up Python ๐Ÿ 3.9 + uses: actions/setup-python@v2 with: - name: spiceypy_windows_dist - path: dist/ + python-version: 3.9 + - name: Display Python ๐Ÿ + run: python -c "import sys; print(sys.version)" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install twine - name: Publish distribution ๐Ÿ“ฆ to Test PyPI env: TWINE_USERNAME: __token__ @@ -108,7 +99,7 @@ jobs: run: | twine upload --non-interactive --skip-existing --repository testpypi dist/* - name: Publish distribution ๐Ÿ“ฆ to PyPI - if: startsWith(github.ref, 'refs/tags') && (github.event_name == 'push' || github.event_name == 'release') + if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} diff --git a/pyproject.toml b/pyproject.toml index 689d49b4..87903045 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,6 @@ before-build = "python get_spice.py" before-test = "pip install -r ci-requirements.txt" test-command = [ "coverage run --source {package} -m pytest --pyargs {project}", - "codecov" ] [tool.cibuildwheel.macos]