Skip to content

Commit

Permalink
Transition to pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Nov 13, 2024
1 parent 6c456eb commit e392693
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 138 deletions.
30 changes: 10 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,42 +32,32 @@ 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@v4
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@v4
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 .[development]
# We run the tests on the installed package, with all optional dependencies
# Note the use of the -Wa flag to show DeprecationWarnings
- name: Unit tests
- name: Unit tests and doc tests
run: |
python -m pip install .[diffshow]
cd ~
python -Wa -m pytest --pyargs skued --import-mode=importlib
python -Wa -m pytest
- name: Build documentation
run: |
python setup.py build_sphinx
- name: Doctests
run: |
python -m sphinx -b doctest docs build
sphinx-build -M html docs build/docs
release:
Expand All @@ -87,8 +77,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: |
Expand All @@ -97,7 +87,7 @@ jobs:
- name: Create source distribution
run: |
python setup.py sdist
python -m build
- name: Create release
uses: softprops/action-gh-release@v2
Expand Down
6 changes: 4 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ build:

python:
install:
- requirements: requirements.txt
- requirements: dev-requirements.txt
- method: pip
path: .
extra_requirements:
- development
5 changes: 2 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ Once you've fixed all merge conflicts, do:

### Build environment setup

To create an appropriate development environment, you need to install the base requirements (`requirements.txt`) as well as extra, development requirements (`dev-requirements.txt`)
To create an appropriate development environment, you need to install the base requirements as well as extra, development requirements:

pip install -r requirements
pip install -r dev-requirements
pip install .[development]

## Guidelines

Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
include README.md
include CHANGELOG.rst
include LICENSE.txt
include requirements.txt
include dev-requirements.txt

recursive-include skued/baseline/data *
recursive-include skued/simulation/data *
Expand Down
11 changes: 0 additions & 11 deletions dev-requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Installation
Requirements
============

Scikit-ued works on Linux, Mac OS X and Windows. It requires Python 3.7+. Packages requirements are `listed here <https://github.com/LaurentRDC/scikit-ued/blob/master/requirements.txt>`_.
Scikit-ued works on Linux, Mac OS X and Windows. It requires Python 3.7+. Packages requirements are `listed here <https://github.com/LaurentRDC/scikit-ued/blob/master/pyproject.toml>`_.

Install scikit-ued
==================
Expand Down
75 changes: 75 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
[build-system]
requires = ["build", "setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = {attr = "skued.__version__"}

[project]
name = "scikit-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 = "Collection of algorithms and functions for ultrafast electron scattering"
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">=3.7, <4"
dependencies = [
"crystals >= 1.3.1, < 2",
"npstreams >= 1.6.5, < 2",
"numpy >= 1.17, < 3",
"pywavelets >= 1.0.0, < 2",
"scikit-image >= 0.19, < 1",
# See https://github.com/scipy/scipy/issues/17740
"scipy >= 1.5.0, < 2, != 1.10.0",
"pyyaml >= 3.1",
"matplotlib >= 3.5, <4",
]
keywords=["ultrafast electron scattering"]
classifiers = [
"Environment :: Console",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
]

[project.optional-dependencies]
development = [
"Sphinx >= 3, <7",
"sphinx_rtd_theme >= 0.4",
"pytest >= 6",
"black",
]
diffshow = ["pyqtgraph>=0.12,<1", "PyQt5"]

[project.urls]
Documentation = "https://crystals.readthedocs.io/"
Repository = "https://github.com/LaurentRDC/crystals"
"Bug Tracker" = "https://github.com/LaurentRDC/crystals/issues"

[project.scripts]
skued-cli = "skued.__main__:main"

[tool.black]
line-length = 120
include = '\.pyi?$'

[tool.isort]
profile = "black"

[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",
]
9 changes: 0 additions & 9 deletions requirements.txt

This file was deleted.

5 changes: 0 additions & 5 deletions setup.cfg

This file was deleted.

85 changes: 0 additions & 85 deletions setup.py

This file was deleted.

0 comments on commit e392693

Please sign in to comment.