-
Notifications
You must be signed in to change notification settings - Fork 15
packaging: setuptools_scm + pyproject.toml + cibuildwheels
#43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
2480bbf
Revert "move scipy/matplotlib/skimage into sub-func (#41)"
jhkennedy f504f15
switch to pyproject.toml and dynamic version number via setuptools_scm
jhkennedy eb7b19e
Fix (ish) build
jhkennedy e29f48d
fix readme spelling
jhkennedy 1ac4dbe
add explination of editable install
jhkennedy b00c5b4
update pypi workflow; add dependabot to keep actions up to date
jhkennedy b7def2d
Fix typo; more restrictive for pushes
jhkennedy c14ffe0
Add git to circleci
jhkennedy 8f31f58
Update fortran build
jhkennedy d314a1f
don't fail fast for builds
jhkennedy a92827f
add comments on f2py
yunjunz 51a93cc
Update README.md
yunjunz 50d06e3
use PYPI_API_TOKEN
yunjunz 034e261
pyproject.toml: indentation adjustment
yunjunz d769e93
Update build-and-publish-to-pypi.yml
yunjunz 73ceb4f
setuptools_scm: set version/local_scheme
yunjunz efc8a17
build/publish to pypi: skip windows
yunjunz 093291f
deps: update requirements.txt
yunjunz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "daily" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| name: Publish 📦 to PyPI | ||
|
|
||
| # Build on every branch push, tag push, and pull request change: | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| tags: | ||
| - v* | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build_wheels: | ||
| name: Build Python 🐍 wheels on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-20.04, macos-11] #windows-2019 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Provide gfortran (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| # https://github.com/actions/virtual-environments/issues/2524 | ||
| # https://github.com/cbg-ethz/dce/blob/master/.github/workflows/pkgdown.yaml | ||
| sudo ln -s /usr/local/bin/gfortran-11 /usr/local/bin/gfortran | ||
| sudo mkdir /usr/local/gfortran | ||
| sudo ln -s /usr/local/Cellar/gcc@11/*/lib/gcc/11 /usr/local/gfortran/lib | ||
| gfortran --version | ||
|
|
||
| - name: Provide gfortran (Windows) | ||
| if: runner.os == 'Windows' | ||
| uses: msys2/setup-msys2@v2 | ||
|
|
||
| - name: Tell distutils to use mingw (Windows) | ||
| if: runner.os == 'Windows' | ||
| run: | | ||
| echo "[build]`ncompiler=mingw32" | Out-File -Encoding ASCII ~/pydistutils.cfg | ||
|
|
||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@v2.11.2 | ||
| env: | ||
| # Disable building for PyPy and 32bit. | ||
| CIBW_SKIP: pp* *-win32 *-manylinux_i686 | ||
| # Package the DLL dependencies in the wheel for windows (done by default for the other platforms). | ||
| # delvewheel cannot mangle the libraries, stripping does not work. | ||
| CIBW_BEFORE_BUILD_WINDOWS: pip install delvewheel | ||
| CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel show {wheel} && delvewheel repair -w {dest_dir} {wheel} --no-mangle-all" | ||
|
|
||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| path: ./wheelhouse/*.whl | ||
|
|
||
| build_sdist: | ||
| name: Build Python 🐍 source distribution | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Build sdist | ||
| run: pipx run build --sdist | ||
|
|
||
| - uses: actions/upload-artifact@v3 | ||
| with: | ||
| path: dist/*.tar.gz | ||
|
|
||
| upload_pypi: | ||
| needs: [build_wheels, build_sdist] | ||
| runs-on: ubuntu-latest | ||
| if: github.repository_owner == 'insarlab' && github.event_name == 'push' | ||
| steps: | ||
| - uses: actions/download-artifact@v3 | ||
| with: | ||
| # unpacks default artifact into dist/ | ||
| # if `name: artifact` is omitted, the action will create extra parent dir | ||
| name: artifact | ||
| path: dist | ||
|
|
||
| - name: Publish developed version 📦 to Test PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1.5.0 | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
| repository_url: https://test.pypi.org/legacy/ | ||
| skip_existing: false | ||
| verbose: true | ||
|
|
||
| - name: Publish released version 📦 to PyPI | ||
| uses: pypa/gh-action-pypi-publish@v1.5.0 | ||
| if: startsWith(github.ref, 'refs/tags/v') | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.PYPI_API_TOKEN }} | ||
| verbose: true |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=61.0", "setuptools_scm[toml]>=6.2", "numpy", "wheel"] | ||
|
|
||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "pysolid" | ||
| authors = [ | ||
| {name="Zhang Yunjun", email="yunjunzgeo@gmail.com"}, | ||
| {name="Dennis Milbert"}, | ||
| ] | ||
| description = "A Python wrapper for solid to compute solid Earth tides" | ||
| readme = "README.md" | ||
| requires-python = ">=3.8" | ||
| keywords = ["solid Earth tides", "deformation", "geodesy", "geophysics"] | ||
| license = {text = "GPL-3.0-or-later"} | ||
| classifiers=[ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Science/Research", | ||
| "Topic :: Scientific/Engineering", | ||
| "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python :: 3", | ||
| ] | ||
| dependencies = [ | ||
| "numpy", | ||
| "scipy", | ||
| "matplotlib", | ||
| "scikit-image", | ||
| ] | ||
| dynamic = ["version"] | ||
|
|
||
| [project.urls] | ||
| "Homepage" = "https://github.com/insarlab/PySolid" | ||
| "Bug Tracker" = "https://github.com/insarlab/PySolid/issues" | ||
|
|
||
| [tool.setuptools] | ||
| include-package-data = true | ||
| zip-safe = false | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["src"] | ||
|
|
||
| [tool.setuptools.package-data] | ||
| pysolid = ["*.for"] | ||
|
|
||
| [tool.setuptools_scm] | ||
| version_scheme = "post-release" | ||
| local_scheme = "no-local-version" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,11 @@ | ||
| # for running | ||
| numpy | ||
| scipy | ||
| matplotlib | ||
| scikit-image | ||
| # for packaging and installation | ||
| #fortran-compiler # Fortran compiler across platforms through conda-forge channel | ||
| pip | ||
| setuptools | ||
| setuptools_scm | ||
| wheel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,13 @@ | ||
| # Author: Zhang Yunjun, Jan 2021 | ||
| # Copyright 2020, by the California Institute of Technology. | ||
| # Note by Yunjun, Oct 2022: "pip install pysolid" does not work, | ||
| # because a Fortran compiler is required but not available via pip | ||
|
|
||
|
|
||
| import os | ||
| import sys | ||
|
|
||
| # always prefer setuptools over distutils | ||
| import setuptools | ||
| from numpy.distutils.core import setup, Extension | ||
|
|
||
| # Grab from pysolid.version: version | ||
| # link: https://stackoverflow.com/questions/53648900 | ||
| sys.path.append(os.path.join(os.path.dirname(__file__), 'src')) | ||
| from pysolid.version import version | ||
|
|
||
| # Grab from README file: long_description | ||
| with open("README.md", "r") as f: | ||
| long_description = f.read() | ||
|
|
||
| setup( | ||
| name='pysolid', | ||
| version=version, | ||
| description="A Python wrapper for solid to compute solid Earth tides", | ||
| url="https://github.com/insarlab/PySolid", | ||
| download_url=("https://github.com/insarlab/PySolid/archive/v{}.tar.gz".format(version)), | ||
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| author="Zhang Yunjun, Dennis Milbert", | ||
| author_email="yunjunzgeo@gmail.com", | ||
| license="GPL-3.0-or-later", | ||
| license_files=("LICENSE",), | ||
|
|
||
| classifiers=[ | ||
| "Development Status :: 4 - Beta", | ||
| "Intended Audience :: Science/Research", | ||
| "Topic :: Scientific/Engineering", | ||
| "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", | ||
| "Operating System :: OS Independent", | ||
| "Programming Language :: Python :: 3", | ||
| ], | ||
| keywords="solid Eartth tides, deformation, geodesy, geophysics", | ||
|
|
||
| project_urls={ | ||
| "Bug Reports": "https://github.com/insarlab/PySolid/issues", | ||
| "Source": "https://github.com/insarlab/PySolid", | ||
| }, | ||
|
|
||
| # package discovery | ||
| packages=setuptools.find_packages("src"), # include all packages under src | ||
| package_dir={"": "src"}, # tell distutils packages are under src | ||
|
|
||
| # build fortran deps with numpy.f2py | ||
| # fortran extensions to build with numpy.f2py | ||
| ext_modules=[ | ||
| Extension(name='pysolid.solid', sources=['src/pysolid/solid.for']), | ||
| ], | ||
|
|
||
| # dependencies | ||
| python_requires=">=3.6", | ||
| install_requires=[ | ||
| 'numpy', | ||
| 'scipy', | ||
| 'matplotlib', | ||
| 'scikit-image', | ||
| ], | ||
|
|
||
| # data files | ||
| include_package_data=True, | ||
| package_data={ | ||
| "pysolid": ["solid.for"], | ||
| }, | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.