-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from ericpre/consolidate_package_metadata
Consolidate package metadata
- Loading branch information
Showing
9 changed files
with
179 additions
and
222 deletions.
There are no files selected for viewing
This file contains 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,9 @@ | ||
name: Package & Test | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
package_and_test: | ||
name: Package and Test | ||
# Use the "reusable workflow" from the hyperspy organisation | ||
uses: hyperspy/.github/.github/workflows/package_and_test.yml@main |
This file contains 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,96 +1,55 @@ | ||
name: Release | ||
# Reusable workflow are not supported with trusted publisher | ||
# https://github.com/pypa/gh-action-pypi-publish/issues/166 | ||
# copy and paste most of | ||
# https://github.com/hyperspy/.github/blob/main/.github/workflows/release_pure_python.yml | ||
|
||
# This workflow builds the wheels "on tag". | ||
# If run from the hyperspy/hyperspy_gui_ipywidgets repository, the wheels will be | ||
# uploaded to pypi; otherwise, the wheels will be available as a github artifact. | ||
# This workflow overwrite the version in `hyperspy_gui_ipywidgets/version.py` | ||
# with the tag | ||
# If run from the hyperspy/hyperspy repository, the wheels will be uploaded to pypi ; | ||
# otherwise, the wheels will be available as a github artifact. | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
jobs: | ||
create_release: | ||
package_and_test: | ||
name: Package and Test | ||
# Use the "reusable workflow" from the hyperspy organisation | ||
uses: hyperspy/.github/.github/workflows/package_and_test.yml@main | ||
|
||
upload_to_pypi: | ||
needs: [package_and_test] | ||
runs-on: ubuntu-latest | ||
name: Upload to pypi | ||
permissions: | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
id-token: write | ||
steps: | ||
- name: Download dist | ||
uses: actions/download-artifact@v3 | ||
|
||
- name: Display downloaded files | ||
run: | | ||
ls -shR | ||
working-directory: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }} | ||
# See https://docs.pypi.org/trusted-publishers/using-a-publisher/ | ||
|
||
create_github_release: | ||
# If zenodo is setup to create a DOI automatically on a GitHub release, | ||
# this step will trigger the mining of the DOI | ||
needs: upload_to_pypi | ||
permissions: | ||
contents: write | ||
name: Create Release | ||
name: Create GitHub Release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
VERSION: ${{ env.VERSION }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Get version (on tag) | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV | ||
build_wheels_linux: | ||
name: Wheels on ubuntu-latest | ||
needs: create_release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install release dependencies | ||
run: | | ||
python -m pip install twine wheel | ||
- name: Overwrite `version.py` with tag | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
version_file: hyperspy_gui_ipywidgets/version.py | ||
VERSION: ${{ needs.create_release.outputs.VERSION }} | ||
run: | | ||
echo '__version__ = "${{ env.VERSION }}"' > ${{ env.version_file }} | ||
- name: Build source distribution | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
- name: Display content dist folder | ||
run: | | ||
ls dist/ | ||
- name: Install and test distribution | ||
env: | ||
MPLBACKEND: agg | ||
run: | | ||
pip install --find-links dist hyperspy_gui_ipywidgets[tests] | ||
pytest --pyargs hyperspy_gui_ipywidgets | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
path: | | ||
./dist/*.whl | ||
./dist/*.tar.gz | ||
- name: Publish wheels to PyPI | ||
if: github.repository_owner == 'hyperspy' | ||
env: | ||
# Github secret set in the hyperspy/hyperspy_gui_ipywidgets repository | ||
# Not available from fork or pull request | ||
# Secrets are not passed to workflows that are triggered by a pull request from a fork | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
twine upload dist/*.whl --verbose | ||
twine upload dist/*.tar.gz --verbose | ||
if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }} | ||
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 |
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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 was deleted.
Oops, something went wrong.
This file contains 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,93 @@ | ||
[build-system] | ||
requires = ["setuptools>=64", "setuptools_scm>=8", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "hyperspy_gui_ipywidgets" | ||
description = "ipywidgets GUI elements for the HyperSpy framework." | ||
requires-python = ">=3.8" | ||
readme = "README.md" | ||
keywords=[ | ||
"data analysis", | ||
"microscopy", | ||
"ipywidgets", | ||
"hyperspy", | ||
"multi-dimensional", | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Software Development :: Libraries", | ||
"Topic :: Scientific/Engineering", | ||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: POSIX", | ||
"Operating System :: Unix", | ||
"Operating System :: MacOS", | ||
] | ||
dependencies = [ | ||
"hyperspy>=2.0rc0", | ||
"ipywidgets>=7.0", | ||
"link_traits", | ||
] | ||
dynamic = ["version"] | ||
|
||
[project.entry-points."hyperspy.extensions"] | ||
hyperspy-gui-ipywidgets = "hyperspy_gui_ipywidgets" | ||
|
||
[project.license] | ||
file = "LICENSE" | ||
|
||
[project.optional-dependencies] | ||
tests = [ | ||
"pytest", | ||
"pytest-cov", | ||
"pytest-rerunfailures", | ||
"setuptools-scm", | ||
] | ||
dev = [ | ||
"black", | ||
"hyperspy-gui-ipywidgets[doc]", | ||
"hyperspy-gui-ipywidgets[tests]" | ||
] | ||
|
||
[project.urls] | ||
"Homepage" = "https://github.com/hyperspy/hyperspy_gui_ipywidgets" | ||
"Bug Reports" = "https://github.com/hyperspy/hyperspy_gui_ipywidgets/issues" | ||
"Source" = "https://github.com/hyperspy/hyperspy_gui_ipywidgets" | ||
"Conda-Forge" = "https://anaconda.org/conda-forge/hyperspy-gui-ipywidgets" | ||
"Support" = "https://gitter.im/hyperspy/hyperspy" | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
source = ["hyperspy_gui_ipywidgets"] | ||
omit = [ | ||
"hyperspy_gui_ipywidgets/tests/*", | ||
"hyperspy_gui_ipywidgets/conftest.py", | ||
] | ||
|
||
[tool.coverage.report] | ||
precision = 2 | ||
|
||
[tool.pytest.ini_options] | ||
# "-ra", # Display summary: "all except passes" | ||
addopts = "-ra" | ||
minversion = "6.0" | ||
testpaths = [ | ||
"hyperspy_gui_ipywidgets/tests", | ||
] | ||
|
||
[tool.setuptools.packages.find] | ||
include = ["hyperspy_gui_ipywidgets*"] | ||
|
||
[tool.setuptools.package-data] | ||
"*" = ["*.yaml"] | ||
|
||
[tool.setuptools_scm] | ||
# Presence enables setuptools_scm, the version will be determine at build time from git |
Oops, something went wrong.