diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fc5534..d02e9e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,41 +32,34 @@ jobs: if: startsWith(runner.os, 'Linux') with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} - uses: actions/cache@v2 if: startsWith(runner.os, 'macOS') with: path: ~/Library/Caches/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} - uses: actions/cache@v2 if: startsWith(runner.os, 'Windows') with: path: ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('**/*requirements.txt') }} + key: ${{ runner.os }}-py${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install numpy wheel - pip install -r requirements.txt - pip install -r dev-requirements.txt + pip install build + pip install .[development] # Note the use of the -Wa flag to show DeprecationWarnings - - name: Unit tests + - name: Unit tests and doctests run: | - python setup.py install - cd ~ - python -Wa -m pytest --pyargs iris + python -Wa -m pytest - name: Build documentation - run: | - python setup.py build_sphinx - - - name: Doctests - run: | - python -m sphinx -b doctest docs build + run: + sphinx-build -M html docs build/docs release: @@ -86,8 +79,8 @@ jobs: - name: Install dependencies run: | - pip install -r requirements.txt - pip install -r dev-requirements.txt + pip install build + pip install .[development] - name: Create release description run: | @@ -96,7 +89,7 @@ jobs: - name: Create source distribution run: | - python setup.py sdist + python -m build - name: Create release uses: softprops/action-gh-release@v2 diff --git a/.readthedocs.yml b/.readthedocs.yml index 32bc207..6862b15 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,5 +14,7 @@ build: python: install: - - requirements: requirements.txt - - requirements: dev-requirements.txt \ No newline at end of file + - method: pip + path: . + extra_requirements: + - development \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index b293f2b..1444da0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,8 +1,6 @@ include README.md include CHANGELOG.rst include LICENSE.txt -include requirements.txt -include dev-requirements.txt include iris_screen.png recursive-exclude docs * diff --git a/dev-requirements.txt b/dev-requirements.txt deleted file mode 100644 index f3900f5..0000000 --- a/dev-requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -setuptools; python_version >= '3.12' -# The ability to build documentation using `python setup.py build_sphinx` -# has been removed as of Sphinx v7. -# Until the setup script `setup.py` has been changed to setup.cfg -# we cannot use sphinx 7+ -Sphinx >= 3, <7 -sphinx_rtd_theme >= 0.4 -pytest >= 6,<8 -flaky >= 3,<4 -black -isort -wheel \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 061cbaa..e800de0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,74 @@ +[build-system] +requires = ["build", "setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["iris"] + +[tool.setuptools.dynamic] +version = {attr = "iris.__version__"} + +[project] +name = "iris-ued" +dynamic = ["version"] +authors = [ + { name="Laurent P. René de Cotret", email="laurent.decotret@outlook.com" }, +] +maintainers = [ + { name="Laurent P. René de Cotret", email="laurent.decotret@outlook.com" }, +] +description = "Ultrafast electron diffraction data exploration" +readme = "README.md" +license = {file = "LICENSE"} +requires-python = ">=3.7, <4" +dependencies = [ + "numpy >= 1.22,< 3", + "scipy >= 1.0.0", + "h5py >= 2.10.0, < 4", + "PyQt5 >=5.15, <6", + "crystals >= 1.3.0, < 2", + "scikit-ued >= 2.1.4, < 3", + "qdarkstyle >= 2.8, < 3", + "pyqtgraph >= 0.11", + "npstreams >= 1.6.5, < 2", + "packaging >= 20", +] +keywords=["crystallography", "material science", "structural biology"] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Science/Research", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", + "Topic :: Scientific/Engineering :: Chemistry", + "Topic :: Scientific/Engineering :: Visualization", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Natural Language :: English", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: Implementation :: CPython", +] + +[project.optional-dependencies] +development = [ + "Sphinx >= 3", + "sphinx_rtd_theme >= 0.4", + "pytest >= 6", + "black", + "isort", +] + +[project.urls] +Documentation = "https://iris-ued.readthedocs.io/" +Repository = "https://github.com/LaurentRDC/iris-ued" +"Bug Tracker" = "https://github.com/LaurentRDC/iris-ued/issues" + +[project.scripts] +iris-cli = "iris.__main__:main" + [tool.black] line-length = 120 include = '\.pyi?$' @@ -5,3 +76,13 @@ include = '\.pyi?$' [tool.isort] profile = "black" src_paths = ["iris/**/*.py"] + +[tool.pytest.ini_options] +minversion = "6.0" +log_cli_level = "INFO" +# Very cool ability for pytest to also run doctests on package contents with `-doctest-modules` +addopts = [ + "--doctest-modules", + "--ignore=iris/tests/broken_plugin.py", +] +testpaths = ["iris/tests"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9b550cf..0000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -numpy >= 1.22,< 3 -scipy >= 1.0.0 -h5py >= 2.10.0, < 4 -PyQt5 >=5.15, <6 -crystals >= 1.3.0, < 2 -scikit-ued >= 2.1.4, < 3 -qdarkstyle >= 2.8, < 3 -pyqtgraph >= 0.11 -npstreams >= 1.6.5, < 2 -packaging >= 20 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c9f4cae..0000000 --- a/setup.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[flake8] -exclude=./tests/* -max-line-length=120 - -[bdist_wheel] -universal = 0 - -[metadata] -description-file = README.rst \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index ef3c221..0000000 --- a/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -* -import os -import re -from glob import glob -from pathlib import Path - -from setuptools import find_packages, setup - -# To upload to pypi.org: -# >>> python setup.py sdist -# >>> twine upload dist/iris-x.x.x.tar.gz - -PACKAGE_NAME = "iris-ued" -DESCRIPTION = "Ultrafast electron diffraction data exploration" -URL = "http://iris-ued.readthedocs.io" -DOWNLOAD_URL = "http://github.com/LaurentRDC/iris-ued" -AUTHOR = "Laurent P. René de Cotret" -AUTHOR_EMAIL = "laurent.renedecotret@mail.mcgill.ca" -BASE_PACKAGE = "iris" - -base_path = Path(__file__).parent -with open(base_path / BASE_PACKAGE / "__init__.py") as f: - module_content = f.read() - VERSION = re.compile(r".*__version__ = \"(.*?)\"", re.S).match(module_content).group(1) - LICENSE = re.compile(r".*__license__ = \"(.*?)\"", re.S).match(module_content).group(1) - -with open("README.md") as f: - README = f.read() - -with open("requirements.txt") as f: - REQUIREMENTS = [line for line in f.read().split("\n") if len(line.strip())] - -exclude = {"exclude": ["docs", "*cache"]} -PACKAGES = [BASE_PACKAGE + "." + x for x in find_packages(str(base_path / BASE_PACKAGE), **exclude)] -if BASE_PACKAGE not in PACKAGES: - PACKAGES.append(BASE_PACKAGE) - -if __name__ == "__main__": - setup( - name=PACKAGE_NAME, - description=DESCRIPTION, - long_description=README, - long_description_content_type="text/markdown", - license=LICENSE, - url=URL, - download_url=DOWNLOAD_URL, - version=VERSION, - author=AUTHOR, - author_email=AUTHOR_EMAIL, - maintainer=AUTHOR, - maintainer_email=AUTHOR_EMAIL, - install_requires=REQUIREMENTS, - keywords=["ultrafast electron diffraction visualization pyqtgraph"], - packages=PACKAGES, - data_files=[("iris\\gui\\images", glob("iris\\gui\\images\\*.png"))], - entry_points={"gui_scripts": ["iris = iris.__main__:main"]}, - include_package_data=True, - project_urls={ - "Documentation": "http://iris-ued.readthedocs.io/en/master/", - "Source": "https://github.com/LaurentRDC/iris-ued", - "Tracker": "https://github.com/LaurentRDC/iris-ued/issues", - "Home": "http://www.physics.mcgill.ca/siwicklab/software.html", - }, - python_requires=">= 3.8", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "Topic :: Scientific/Engineering", - "Topic :: Scientific/Engineering :: Physics", - "Topic :: Scientific/Engineering :: Chemistry", - "Topic :: Scientific/Engineering :: Visualization", - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - "Natural Language :: English", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: Implementation :: CPython", - ], - )