diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 278104d73..000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Build - -on: [push, pull_request] - -jobs: - build: - name: Build - runs-on: ubuntu-latest - env: - PYTHON_VERSION: '3.11' - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-python@v4 - name: Install Python - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Display version - run: | - python --version - pip --version - - - name: Install pypa/build pypa/twine - run: | - pip install build twine - - - name: Build a binary wheel and a source tarball - run: | - python -m build - - - name: Display content dist folder - run: | - ls -l dist/ - - - name: Run twin check - run: | - twine check dist/* - - - uses: actions/upload-artifact@v3 - with: - path: ./dist/* - name: dist - - test: - name: Test Packaging - needs: build - runs-on: ubuntu-latest - env: - PYTHON_VERSION: '3.11' - steps: - - uses: actions/setup-python@v4 - name: Install Python - with: - python-version: ${{ env.PYTHON_VERSION }} - - - uses: actions/download-artifact@v3 - - - name: Display content working folder - run: | - ls -R - - - name: Install distribution - run: | - pip install --pre --find-links dist exspy[tests] - - - name: Test distribution - run: | - pytest --pyargs exspy diff --git a/.github/workflows/package_and_test.yml b/.github/workflows/package_and_test.yml new file mode 100644 index 000000000..b29f9f44f --- /dev/null +++ b/.github/workflows/package_and_test.yml @@ -0,0 +1,8 @@ +name: Package & Test + +on: [push, pull_request] + +jobs: + package_and_test: + # Use the "reusable workflow" from the hyperspy organisation + uses: hyperspy/.github/.github/workflows/package_and_test.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7662cf974..287196fe8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,8 @@ name: Release +# Reusable workflow are not supported with trusted publisher +# https://github.com/pypa/gh-action-pypi-publish/issues/166 +# copy and paste +# 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 repository, the wheels will be uploaded to pypi ; @@ -10,41 +14,30 @@ on: - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 jobs: - build_wheels: - name: Build wheels + build: + name: Build wheel and sdist runs-on: ubuntu-latest - env: - CIBW_TEST_COMMAND: "pytest --pyargs exspy" - CIBW_TEST_EXTRAS: "tests" - steps: - - uses: actions/checkout@v3 - - - name: Build wheels - uses: pypa/cibuildwheel@v2.14.0 - - - uses: actions/upload-artifact@v3 - with: - name: wheels - path: ./wheelhouse/*.whl - if-no-files-found: error + - uses: actions/checkout@v4 - make_sdist: - name: Make SDist - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + - name: Run build + run: | + pipx run build - - name: Build SDist - run: pipx run build --sdist + - name: Display built files + run: | + ls -shR + working-directory: dist - uses: actions/upload-artifact@v3 with: - path: dist/*.tar.gz + path: dist/* + name: artifacts upload_to_pypi: - needs: [build_wheels, make_sdist] + needs: [build] runs-on: ubuntu-latest + name: Upload to pypi permissions: # IMPORTANT: this permission is mandatory for trusted publishing id-token: write @@ -52,34 +45,29 @@ jobs: - name: Download dist uses: actions/download-artifact@v3 with: - name: artifact - path: dist - - - name: Download wheels - uses: actions/download-artifact@v3 - with: - name: wheels + name: artifacts path: dist - - name: Display structure of downloaded files - run: ls -R + - name: Display downloaded files + run: | + ls -shR working-directory: dist - uses: pypa/gh-action-pypi-publish@release/v1 - if: github.repository_owner == 'hyperspy' + if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }} # See https://docs.pypi.org/trusted-publishers/using-a-publisher/ - create_release: - # TODO: once we are happy with the workflow - # setup zenodo to create a DOI automatically + 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 steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create Release - id: create_release + if: ${{ startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'hyperspy' }} uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9333cb5d9..5387835a0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,13 +13,15 @@ jobs: fail-fast: false matrix: os: [ubuntu, windows, macos] - PYTHON_VERSION: ['3.9', '3.10'] + PYTHON_VERSION: ['3.9', '3.11'] LABEL: [''] include: - os: ubuntu PYTHON_VERSION: '3.8' - os: ubuntu - PYTHON_VERSION: '3.11' + PYTHON_VERSION: '3.10' + - os: ubuntu + PYTHON_VERSION: '3.12' steps: - uses: actions/checkout@v3 diff --git a/CHANGES.rst b/CHANGES.rst index 22b1c4f8e..c075fced1 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -13,6 +13,12 @@ https://holospy.readthedocs.io/en/latest/changes.html (`HyperSpy #3082 `_) - Add functionality to fit the :ref:`EELS fine structure ` using components, e.g. :py:class:`hyperspy.api.model.components1D.Gaussian`. (`HyperSpy #3206 `_) - Use reusable workflow from the hyperspy organisation for the doc workflow (`#13 `_) +- Consolidate packaging metadata in ``pyproject.toml``. (`#4 `_, `#10 `_) +- Use ``setuptools_scm`` to set holospy version at build time (`#10 `_) +- Add package and test workflow (`#10 `_) +- Add python 3.12 (`#10 `_) +- Add release workflow (`#10 `_) + Initiation (2023-10-28) ======================= diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..8950e39b4 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +prune exspy/tests/drawing/plot_model +prune exspy/tests/drawing/plot_spectra_markers \ No newline at end of file diff --git a/exspy/__init__.py b/exspy/__init__.py index 3751b05a4..61271b919 100644 --- a/exspy/__init__.py +++ b/exspy/__init__.py @@ -1,10 +1,23 @@ +from pathlib import Path + from . import components from . import data from . import models from . import signals from .misc import material from ._defaults_parser import preferences -from ._version import __version__ + + +if Path(__file__).parent.parent.name == "site-packages": # pragma: no cover + # Tested in the "build" workflow on GitHub CI + from importlib.metadata import version + + __version__ = version("rosettasciio") +else: + # Editable install + from setuptools_scm import get_version + + __version__ = get_version(Path(__file__).parent.parent) __all__ = [ diff --git a/exspy/_version.py b/exspy/_version.py deleted file mode 100644 index f102a9cad..000000000 --- a/exspy/_version.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.0.1" diff --git a/exspy/components/eels_double_power_law.py b/exspy/components/eels_double_power_law.py index dadf12f2f..9d44ca7b7 100644 --- a/exspy/components/eels_double_power_law.py +++ b/exspy/components/eels_double_power_law.py @@ -72,7 +72,7 @@ def __init__( left_cutoff=0.0, module="numexpr", compute_gradients=False, - **kwargs + **kwargs, ): super().__init__( expression="where(x > left_cutoff, \ diff --git a/exspy/components/volume_plasmon_drude.py b/exspy/components/volume_plasmon_drude.py index f39d4dda4..9d3b60def 100644 --- a/exspy/components/volume_plasmon_drude.py +++ b/exspy/components/volume_plasmon_drude.py @@ -61,7 +61,7 @@ def __init__( fwhm=1.5, module="numexpr", compute_gradients=False, - **kwargs + **kwargs, ): super().__init__( expression="where(x > 0, intensity * (pe2 * x * fwhm) \ diff --git a/exspy/models/edsmodel.py b/exspy/models/edsmodel.py index b808037cc..e2657ba7e 100644 --- a/exspy/models/edsmodel.py +++ b/exspy/models/edsmodel.py @@ -344,7 +344,7 @@ def fit_background( end_energy=None, windows_sigma=(4.0, 3.0), kind="single", - **kwargs + **kwargs, ): """ Fit the background in the energy range containing no X-ray line. @@ -849,7 +849,7 @@ def get_lines_intensity( plot_result=False, only_one=True, only_lines=("a",), - **kwargs + **kwargs, ): """ Return the fitted intensity of the X-ray lines. diff --git a/exspy/signals/eds_sem.py b/exspy/signals/eds_sem.py index 5f0e271f1..59714d284 100644 --- a/exspy/signals/eds_sem.py +++ b/exspy/signals/eds_sem.py @@ -312,7 +312,7 @@ def create_model(self, auto_background=True, auto_add_lines=True, *args, **kwarg auto_background=auto_background, auto_add_lines=auto_add_lines, *args, - **kwargs + **kwargs, ) return model diff --git a/exspy/test/__init__.py b/exspy/tests/__init__.py similarity index 100% rename from exspy/test/__init__.py rename to exspy/tests/__init__.py diff --git a/exspy/test/components/__init__.py b/exspy/tests/components/__init__.py similarity index 100% rename from exspy/test/components/__init__.py rename to exspy/tests/components/__init__.py diff --git a/exspy/test/components/test_EELSarctan.py b/exspy/tests/components/test_EELSarctan.py similarity index 100% rename from exspy/test/components/test_EELSarctan.py rename to exspy/tests/components/test_EELSarctan.py diff --git a/exspy/test/components/test_ceels_cl_edge.py b/exspy/tests/components/test_ceels_cl_edge.py similarity index 100% rename from exspy/test/components/test_ceels_cl_edge.py rename to exspy/tests/components/test_ceels_cl_edge.py diff --git a/exspy/test/components/test_double_power_law.py b/exspy/tests/components/test_double_power_law.py similarity index 100% rename from exspy/test/components/test_double_power_law.py rename to exspy/tests/components/test_double_power_law.py diff --git a/exspy/test/components/test_pes_core_line_shape.py b/exspy/tests/components/test_pes_core_line_shape.py similarity index 100% rename from exspy/test/components/test_pes_core_line_shape.py rename to exspy/tests/components/test_pes_core_line_shape.py diff --git a/exspy/test/components/test_pes_see.py b/exspy/tests/components/test_pes_see.py similarity index 100% rename from exspy/test/components/test_pes_see.py rename to exspy/tests/components/test_pes_see.py diff --git a/exspy/test/components/test_pes_voigt.py b/exspy/tests/components/test_pes_voigt.py similarity index 100% rename from exspy/test/components/test_pes_voigt.py rename to exspy/tests/components/test_pes_voigt.py diff --git a/exspy/test/components/test_volume_plasmon_drude.py b/exspy/tests/components/test_volume_plasmon_drude.py similarity index 100% rename from exspy/test/components/test_volume_plasmon_drude.py rename to exspy/tests/components/test_volume_plasmon_drude.py diff --git a/exspy/test/data/test_data.py b/exspy/tests/data/test_data.py similarity index 100% rename from exspy/test/data/test_data.py rename to exspy/tests/data/test_data.py diff --git a/exspy/test/data/test_eelsdb.py b/exspy/tests/data/test_eelsdb.py similarity index 100% rename from exspy/test/data/test_eelsdb.py rename to exspy/tests/data/test_eelsdb.py diff --git a/exspy/test/drawing/__init__.py b/exspy/tests/drawing/__init__.py similarity index 100% rename from exspy/test/drawing/__init__.py rename to exspy/tests/drawing/__init__.py diff --git a/exspy/test/drawing/data/Cr_L_cl.hspy b/exspy/tests/drawing/data/Cr_L_cl.hspy similarity index 100% rename from exspy/test/drawing/data/Cr_L_cl.hspy rename to exspy/tests/drawing/data/Cr_L_cl.hspy diff --git a/exspy/test/drawing/data/Cr_L_ll.hspy b/exspy/tests/drawing/data/Cr_L_ll.hspy similarity index 100% rename from exspy/test/drawing/data/Cr_L_ll.hspy rename to exspy/tests/drawing/data/Cr_L_ll.hspy diff --git a/exspy/test/drawing/plot_model/test_fit_EELS_convolved_False.png b/exspy/tests/drawing/plot_model/test_fit_EELS_convolved_False.png similarity index 100% rename from exspy/test/drawing/plot_model/test_fit_EELS_convolved_False.png rename to exspy/tests/drawing/plot_model/test_fit_EELS_convolved_False.png diff --git a/exspy/test/drawing/plot_model/test_fit_EELS_convolved_True.png b/exspy/tests/drawing/plot_model/test_fit_EELS_convolved_True.png similarity index 100% rename from exspy/test/drawing/plot_model/test_fit_EELS_convolved_True.png rename to exspy/tests/drawing/plot_model/test_fit_EELS_convolved_True.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-False.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-False.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-False.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-False.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-True.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-True.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-True.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-False-True.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-False.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-False.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-False.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-False.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-True.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-True.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-True.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_False-True-True.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-False.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-False.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-False.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-False.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-True.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-True.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-True.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-False-True.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-False.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-False.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-False.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-False.png diff --git a/exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-True.png b/exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-True.png similarity index 100% rename from exspy/test/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-True.png rename to exspy/tests/drawing/plot_model/test_plot_gaussian_EELSSpectrum_True-True-True.png diff --git a/exspy/test/drawing/plot_spectra_markers/test_plot_eds_lines.png b/exspy/tests/drawing/plot_spectra_markers/test_plot_eds_lines.png similarity index 100% rename from exspy/test/drawing/plot_spectra_markers/test_plot_eds_lines.png rename to exspy/tests/drawing/plot_spectra_markers/test_plot_eds_lines.png diff --git a/exspy/test/drawing/plot_spectra_markers/test_plot_eels_labels.png b/exspy/tests/drawing/plot_spectra_markers/test_plot_eels_labels.png similarity index 100% rename from exspy/test/drawing/plot_spectra_markers/test_plot_eels_labels.png rename to exspy/tests/drawing/plot_spectra_markers/test_plot_eels_labels.png diff --git a/exspy/test/drawing/test_plot_model.py b/exspy/tests/drawing/test_plot_model.py similarity index 100% rename from exspy/test/drawing/test_plot_model.py rename to exspy/tests/drawing/test_plot_model.py diff --git a/exspy/test/drawing/test_plot_spectra_markers.py b/exspy/tests/drawing/test_plot_spectra_markers.py similarity index 100% rename from exspy/test/drawing/test_plot_spectra_markers.py rename to exspy/tests/drawing/test_plot_spectra_markers.py diff --git a/exspy/test/misc/__init__.py b/exspy/tests/misc/__init__.py similarity index 100% rename from exspy/test/misc/__init__.py rename to exspy/tests/misc/__init__.py diff --git a/exspy/test/misc/test_eds.py b/exspy/tests/misc/test_eds.py similarity index 100% rename from exspy/test/misc/test_eds.py rename to exspy/tests/misc/test_eds.py diff --git a/exspy/test/misc/test_eds_utils.py b/exspy/tests/misc/test_eds_utils.py old mode 100755 new mode 100644 similarity index 100% rename from exspy/test/misc/test_eds_utils.py rename to exspy/tests/misc/test_eds_utils.py diff --git a/exspy/test/misc/test_eels.py b/exspy/tests/misc/test_eels.py old mode 100755 new mode 100644 similarity index 100% rename from exspy/test/misc/test_eels.py rename to exspy/tests/misc/test_eels.py diff --git a/exspy/test/misc/test_gos.py b/exspy/tests/misc/test_gos.py similarity index 100% rename from exspy/test/misc/test_gos.py rename to exspy/tests/misc/test_gos.py diff --git a/exspy/test/misc/test_material.py b/exspy/tests/misc/test_material.py similarity index 100% rename from exspy/test/misc/test_material.py rename to exspy/tests/misc/test_material.py diff --git a/exspy/test/models/__init__.py b/exspy/tests/models/__init__.py similarity index 100% rename from exspy/test/models/__init__.py rename to exspy/tests/models/__init__.py diff --git a/exspy/test/models/test_edsmodel.py b/exspy/tests/models/test_edsmodel.py similarity index 100% rename from exspy/test/models/test_edsmodel.py rename to exspy/tests/models/test_edsmodel.py diff --git a/exspy/test/models/test_eelsmodel.py b/exspy/tests/models/test_eelsmodel.py similarity index 100% rename from exspy/test/models/test_eelsmodel.py rename to exspy/tests/models/test_eelsmodel.py diff --git a/exspy/test/models/test_linear_model.py b/exspy/tests/models/test_linear_model.py similarity index 100% rename from exspy/test/models/test_linear_model.py rename to exspy/tests/models/test_linear_model.py diff --git a/exspy/test/signals/__init__.py b/exspy/tests/signals/__init__.py similarity index 100% rename from exspy/test/signals/__init__.py rename to exspy/tests/signals/__init__.py diff --git a/exspy/test/signals/data/EELS_LL_linescan_simulated_thickness_variation.hspy b/exspy/tests/signals/data/EELS_LL_linescan_simulated_thickness_variation.hspy similarity index 100% rename from exspy/test/signals/data/EELS_LL_linescan_simulated_thickness_variation.hspy rename to exspy/tests/signals/data/EELS_LL_linescan_simulated_thickness_variation.hspy diff --git a/exspy/test/signals/data/EELS_ZLP_linescan_simulated_thickness_variation.hspy b/exspy/tests/signals/data/EELS_ZLP_linescan_simulated_thickness_variation.hspy similarity index 100% rename from exspy/test/signals/data/EELS_ZLP_linescan_simulated_thickness_variation.hspy rename to exspy/tests/signals/data/EELS_ZLP_linescan_simulated_thickness_variation.hspy diff --git a/exspy/test/signals/test_assign_subclass.py b/exspy/tests/signals/test_assign_subclass.py similarity index 100% rename from exspy/test/signals/test_assign_subclass.py rename to exspy/tests/signals/test_assign_subclass.py diff --git a/exspy/test/signals/test_binned.py b/exspy/tests/signals/test_binned.py similarity index 100% rename from exspy/test/signals/test_binned.py rename to exspy/tests/signals/test_binned.py diff --git a/exspy/test/signals/test_edges_range.py b/exspy/tests/signals/test_edges_range.py similarity index 100% rename from exspy/test/signals/test_edges_range.py rename to exspy/tests/signals/test_edges_range.py diff --git a/exspy/test/signals/test_eds_sem.py b/exspy/tests/signals/test_eds_sem.py similarity index 100% rename from exspy/test/signals/test_eds_sem.py rename to exspy/tests/signals/test_eds_sem.py diff --git a/exspy/test/signals/test_eds_tem.py b/exspy/tests/signals/test_eds_tem.py similarity index 100% rename from exspy/test/signals/test_eds_tem.py rename to exspy/tests/signals/test_eds_tem.py diff --git a/exspy/test/signals/test_eels.py b/exspy/tests/signals/test_eels.py similarity index 100% rename from exspy/test/signals/test_eels.py rename to exspy/tests/signals/test_eels.py diff --git a/exspy/test/signals/test_kramers_kronig_transform.py b/exspy/tests/signals/test_kramers_kronig_transform.py similarity index 100% rename from exspy/test/signals/test_kramers_kronig_transform.py rename to exspy/tests/signals/test_kramers_kronig_transform.py diff --git a/exspy/test/test_non-uniform_not-implemented.py b/exspy/tests/test_non-uniform_not-implemented.py similarity index 100% rename from exspy/test/test_non-uniform_not-implemented.py rename to exspy/tests/test_non-uniform_not-implemented.py diff --git a/pyproject.toml b/pyproject.toml index 07370abbe..21fb67d88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,92 @@ [build-system] -requires = ["setuptools>=40.8.0", "wheel"] +requires = ["setuptools>=64", "setuptools_scm>=8", "wheel"] build-backend = "setuptools.build_meta" +[project] +name = "exspy" +description = "EELS and EDS analysis with the HyperSpy framework" +requires-python = ">=3.8" +readme = "README.md" +keywords=[ + "data analysis", + "microscopy", + "electron microscopy", + "electron energy loss spectroscopy", + "X-ray energy-dispersive spectroscopy" +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "Topic :: Software Development :: Libraries", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "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 = [ + "dask[array]", + "hyperspy>=2.0rc0", + "matplotlib", + "numexpr", + "numpy", + "pint", + "pooch", + "prettytable", + "requests", + "scipy", + "traits", +] +dynamic = ["version"] + +[project.entry-points."hyperspy.extensions"] +exspy = "exspy" + +[project.license] +file = "LICENSE" + +[project.optional-dependencies] +"gui-jupyter" = [ + "hyperspy_gui_ipywidgets @ https://github.com/hyperspy/hyperspy_gui_ipywidgets/archive/hyperspy2.0.zip", +] +"gui-traitsui" = [ + "hyperspy_gui_traitsui @ https://github.com/hyperspy/hyperspy_gui_traitsui/archive/hyperspy2.0.zip", +] +"doc" = [ + "numpydoc", + "pydata-sphinx-theme>=0.13", + "sphinx", + "sphinx-copybutton", + "sphinx-design", + "sphinx-favicon", + "sphinx-gallery", +] +"tests" = [ + "pytest >= 5.0", + "pytest-mpl", + "pytest-cov >= 2.8.1", + "pytest-xdist", + "setuptools-scm", +] +"dev" = ["black"] +"all" = [ + "exspy[gui-jupyter]", + "exspy[gui-traitsui]" +] + +[project.urls] +"Homepage" = "https://hyperspy.org/exspy" +"Bug Reports" = "https://github.com/hyperspy/exspy/issues" +"Source" = "https://github.com/hyperspy/exspy" + [tool.black] force-exclude = ''' exspy/misc/eds/ffast_mac.py @@ -10,4 +95,18 @@ force-exclude = ''' [tool.pytest.ini_options] addopts = "-ra -n auto --dist loadfile" -testpaths = ["hyperspy/tests", ] +testpaths = ["exspy/tests", ] + +[tool.setuptools.packages.find] +include = ["exspy*"] +# Excluding rsciio.tests.data folder is done in MANIFEST.in +# because setuptools doesn't support it in pyproject.toml + +[tool.setuptools.package-data] +"*" = [ + "*hspy", + "*.yaml" + ] + +[tool.setuptools_scm] +# Presence enables setuptools_scm, the version will be determine at build time from git diff --git a/releasing_guide.md b/releasing_guide.md index e49f0b764..b211bc212 100644 --- a/releasing_guide.md +++ b/releasing_guide.md @@ -6,9 +6,6 @@ To publish a new exSpy release do the following steps: - Create a new PR to the 'main' branch for the release process, e.g. `release_v0.1.1` - Make sure to have the code ready, including changelog -- Set the correct version number in `exSpy/release_info.py` (increase the third - digit for a patch release, the second digit for a regular minor release, the - first digit for a major release) - Let that PR collect comments for a day to ensure that other maintainers are comfortable with releasing - Set correct date and version number in `CHANGES.rst` @@ -18,13 +15,12 @@ To publish a new exSpy release do the following steps: - Create a tag e.g. `git tag -a v0.1.1 -m "exSpy version 0.1.1"` - Push tag to user fork for a test run `git push origin v0.1.1`. Will run the release workflow without uploading to PyPi -- Push tag to HoloSpy repository to trigger release `git push upstream v0.1.1` +- Push tag to exSpy repository to trigger release `git push upstream v0.1.1` (this triggers the GitHub action to create the sdist and wheel and upload to PyPi automatically). :warning: this is a point of no return :warning: ## Post-release action -- Increment the version and set it back to dev: `vx.y.zdev0` - Update version in other branches if necessary - Prepare `CHANGES.rst` for development by adding `UNRELEASED` headline - Merge the PR diff --git a/setup.py b/setup.py deleted file mode 100644 index dace3ea1a..000000000 --- a/setup.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright 2016-2023 The exspy developers -# -# This file is part of exspy. -# -# exspy is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# exspy is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with exspy. If not, see . - -from setuptools import setup, find_packages - - -extra_feature_requirements = { - "gui-jupyter": [ - "hyperspy_gui_ipywidgets @ https://github.com/hyperspy/hyperspy_gui_ipywidgets/archive/hyperspy2.0.zip", - ], - "gui-traitsui": [ - "hyperspy_gui_traitsui @ https://github.com/hyperspy/hyperspy_gui_traitsui/archive/hyperspy2.0.zip", - ], - "doc": [ - "numpydoc", - "pydata-sphinx-theme>=0.13", - "sphinx", - "sphinx-copybutton", - "sphinx-design", - "sphinx-favicon", - "sphinx-gallery", - ], - "tests": [ - "pytest >= 5.0", - "pytest-mpl", - "pytest-cov >= 2.8.1", - "pytest-xdist", - ], - "dev": ["black"], - "all": ["exspy[gui-jupyter]", "exspy[gui-traitsui]"], -} - - -version = {} -with open("exspy/_version.py") as fp: - exec(fp.read(), version) - - -setup( - name="exspy", - version=version["__version__"], - description="EELS and EDS analysis with the HyperSpy framework", - license="LICENSE", - url="https://github.com/pyxem/pyxem", - long_description=open("README.md").read(), - long_description_content_type="text/markdown", - keywords=[ - "data analysis", - "microscopy", - "electron microscopy", - ], - classifiers=[ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Development Status :: 4 - Beta", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Natural Language :: English", - "Operating System :: OS Independent", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Physics", - ], - entry_points={"hyperspy.extensions": "exspy = exspy"}, - packages=find_packages(), - package_dir={"exspy": "exspy"}, - extras_require=extra_feature_requirements, - install_requires=[ - "dask[array]", - "hyperspy @ https://github.com/hyperspy/hyperspy/archive/RELEASE_next_major.zip", - "matplotlib", - "numexpr", - "numpy", - "pint", - "pooch", - "prettytable", - "requests", - "scipy", - "traits", - ], - python_requires="~=3.8", - package_data={ - "": ["LICENSE", "README.md"], - "exspy": [ - "data/*hspy", - "test/drawing/data/*hspy", - "test/signals/data/*hspy", - "hyperspy_extension.yaml", - ], - }, -)