diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bd90bf7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Publish to PyPI + +# Workflow runs a release job on every published tag. +on: + release: + types: [published] + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "release" + cancel-in-progress: false + +env: + UV_SYSTEM_PYTHON: true + +jobs: + release: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/mpes + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Install dependencies + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + uv pip install build + - name: Build package + run: | + git reset --hard HEAD + python -m build + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true \ No newline at end of file diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/MANIFEST.in b/MANIFEST.in index 3d387c3..d449aa3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,4 @@ -include README.md -include requirements.txt \ No newline at end of file +prune * +exclude * +recursive-include mpes *.py +include pyproject.toml README.md \ No newline at end of file diff --git a/mpes/fprocessing.py b/mpes/fprocessing.py index 7a2d98f..b05c836 100644 --- a/mpes/fprocessing.py +++ b/mpes/fprocessing.py @@ -17,7 +17,6 @@ from .visualization import grid_histogram from . import utils as u, bandstructure as bs, base as b from . import dask_tps as tpsd -import igor.igorpy as igor import pandas as pd import os import re @@ -330,11 +329,7 @@ def readIgorBinFile(fdir, **kwds): errmsg = "Error in file loading, please check the file format." if ftype == 'pxp': - - try: - igfile = igor.load(fdir) - except IOError: - print(errmsg) + raise NotImplementedError("PXP file format is not supported.") elif ftype == 'ibw': @@ -970,11 +965,11 @@ def saveDict(dct={}, processor=None, dictname='', form='h5', save_addr='./histog raise NotImplementedError('The output format is undefined for data \ with higher than three dimensions!') - elif form == 'ibw': # Save as Igor wave + # elif form == 'ibw': # Save as Igor wave - from igorwriter import IgorWave - wave = IgorWave(dct[bdn], name=bdn) - wave.save(save_addr) + # from igorwriter import IgorWave + # wave = IgorWave(dct[bdn], name=bdn) + # wave.save(save_addr) else: raise NotImplementedError('Not implemented output format!') diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1b449e9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,107 @@ +[build-system] +requires = ["setuptools>=64.0.1", "setuptools-scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["mpes"] + +[tool.setuptools_scm] + +[project] +name = "mpes" +dynamic = ["version"] +authors = [ + {name = "R. Patrick Xian, Laurenz Rettig"}, +] +description = "Distributed data processing routines for multidimensional photoemission spectroscopy (MPES)" +readme = "README.md" +license-files = ["LICENSE"] +requires-python = ">=3.9,<3.13" +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3", +] +dependencies = [ + "numpy<2.0", + "pandas", + "scipy", + "matplotlib", + "bokeh<3.0.0", + "scikit-image", + "nose", + "lmfit", + "h5py>=2.9.0", + "dask[dataframe]", + "fastparquet", + "tqdm", + "natsort", + "funcy", + "imageio", + "numba", + "opencv-python", + "xarray", + "astropy", + "photutils<2.0", + "symmetrize", + "silx", + "deepdish", + "fastdtw", + "threadpoolctl", +] + +[project.urls] +Homepage = "https://github.com/mpes-kit/mpes" + +[project.optional-dependencies] +dev = [ + "ruff>=0.1.7", + "mypy>=1.6.0", + "pre-commit>=3.0.0", + "coverage", + "sphinx", +] + +examples = [ + "ipywidgets", + "ipykernel", +] + +[tool.pydocstyle] +convention = "google" + +[tool.coverage.report] +exclude_lines = [ + "raise NotImplementedError", + "pragma: no cover", +] + +[tool.ruff] +include = ["src/*.py", "tests/*.py"] +lint.select = [ + "E", # pycodestyle + "W", # pycodestyle + "PL", # pylint + "F841", # unused variable + "F401", # unused imports + "ARG", # unused arguments +] +lint.ignore = [ + "E701", # Multiple statements on one line (colon) + "PLR0911", # Too many return statements + "PLR0912", # Too many branches + "PLR0913", # Too many arguments in function definition + "PLR0915", # Too many statements + "PLR2004", # Magic value used instead of constant + "PLR5501", # else-if-used + "PLW2901", # redefined-loop-name +] +lint.fixable = ["ALL"] +line-length = 120 # change the default line length number or characters. + +[tool.mypy] +strict = false +ignore_missing_imports = true +follow_imports = "silent" +no_strict_optional = true +disable_error_code = "import, annotation-unchecked" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 425058a..0000000 --- a/requirements.txt +++ /dev/null @@ -1,30 +0,0 @@ -# Dev/Deployment -numpy -pandas -scipy<1.9.0 -matplotlib -bokeh<3.0.0 -scikit-image -sphinx -nose -coverage -igor -lmfit -h5py>=2.9.0 -#tifffile -dask[complete] -fastparquet -tqdm -natsort -funcy -imageio -numba -opencv-python -xarray -astropy -photutils -symmetrize -silx -deepdish -fastdtw -threadpoolctl diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 4a7ba6d..0000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[bdist_wheel] -universal=1 - -[metadata] -description-file=README.md -long_description_content_type=text/markdown \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 967dd48..0000000 --- a/setup.py +++ /dev/null @@ -1,41 +0,0 @@ -from setuptools import setup, find_packages -from codecs import open -from os import path - -__version__ = '1.1.4' - -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the README file -with open(path.join(here, 'README.md')) as f: - long_description = f.read() - -# get the dependencies and installs -with open(path.join(here, 'requirements.txt'), encoding='utf-8') as f: - all_reqs = f.read().split('\n') - -install_requires = [x.strip() for x in all_reqs if 'git+' not in x] -dependency_links = [x.strip().replace('git+', '') for x in all_reqs if x.startswith('git+')] - -setup( - name='mpes', - version=__version__, - description='Distributed data processing routines for multidimensional photoemission spectroscopy (MPES)', - long_description=long_description, - long_description_content_type='text/markdown', - url='https://github.com/mpes-kit/mpes', - download_url='https://github.com/mpes-kit/mpes/tarball/' + __version__, - license='MIT', - classifiers=[ - 'Development Status :: 3 - Alpha', - 'Intended Audience :: Developers', - 'Programming Language :: Python :: 3', - ], - keywords='', - packages=find_packages(exclude=['docs', 'tests*']), - include_package_data=True, - author='R. Patrick Xian, Laurenz Rettig', - install_requires=install_requires, - dependency_links=dependency_links, - author_email='xrpatrick@gmail.com, rettig@fhi-berlin.mpg.de' -)