Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port infrastructure to pyproject.toml #29

Merged
merged 8 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
with:
python-version: 3.10.9
- name: Install and build
run: pip install .
run: pip install -r requirements-dev.txt
- name: Run tests
run: pytest
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with arcs, and create simulations.

You can access our documentation below or at [https://imperialcollegelondon.github.io/wsi](https://barneydobson.github.io/wsi).

*Requires*: Python 3 (tested on versions >=3.7), [tqdm](https://tqdm.github.io/), [PyYAML](https://pyyaml.org/)
*Requires*: Python 3 (tested on versions >=3.7), [tqdm](https://tqdm.github.io/), [PyYAML](https://pyyaml.org/), [dill](https://dill.readthedocs.io/en/latest/)

*Optional requirements to run demos*: [Pandas](https://pandas.pydata.org/), [GeoPandas](https://geopandas.org/en/stable/), [Matplotlib](https://matplotlib.org/), [Shapely](https://shapely.readthedocs.io/en/stable/manual.html)

Expand Down Expand Up @@ -52,37 +52,27 @@ and consists of:
8. [Coverage](https://barneydobson.github.io/wsi/coverage/)

## Installation
Create and activate new conda environment
```
conda create --name wsimod python=3.10
conda activate wsimod
```

Install a GUI if you like
```
conda install spyder -c conda-forge
```

Install WSIMOD directly from GitHub
```
pip install https://github.com/barneydobson/wsi/archive/refs/heads/main.zip
pip install https://github.com/ImperialCollegeLondon/wsi/archive/refs/heads/main.zip
```

Use `[demos]` to include the demos and tutorials.
```
pip install https://github.com/barneydobson/wsi/archive/refs/heads/main.zip
pip install https://github.com/ImperialCollegeLondon/wsi/archive/refs/heads/main.zip
pip install wsimod[demos]
```

If you want to make changes WSIMOD you can download/clone this folder, navigate to it, and run:
If you want to make changes to WSIMOD you can download/clone this folder, navigate to it, and run:
```
python setup.py develop
pip install -e .[dev]
```

or (with demos)

```
python setup.py develop easy_install "wsimod[demos]"
pip install -e .[dev,demos]
```

## How to cite WSIMOD
Expand Down
51 changes: 51 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[tool.setuptools.packages.find]
exclude = ["htmlcov"] # Exclude the coverage report file from setuptools package finder

[project]
name = "wsimod"
description = "WSIMOD is for simulating water quality and quantity"
readme = "README.md"
version = "0.2.0"
license = {file = "LICENSE"}
authors = [
{ name = "Barnaby Dobson", email = "[email protected]" },
{ name = "Imperial College London RSE Team", email = "[email protected]" }
]
requires-python = ">=3.9"
dependencies = [
"PyYAML",
"tqdm",
"dill"
]

[project.optional-dependencies]
dev = [
"pytest"
]

demos = [
"pandas==1.5.2",
"geopandas",
"matplotlib",
"shapely"
]

doc = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that when requiring to install the documentation requirements you should install both the demo and doc requirements. See

wsi/setup.py

Line 11 in 741500a

docs_requires = f.read().splitlines() + demos_requires

I'm not totally sure how to make this work here for a tool that is not in pypi (yet). Maybe try:

doc = [
    "mkdocs",
    ...
    "wsimod[demos]"
]

This is OK for pypi hosted tools, but I'm not totally sure this will work for wsimod yet. Maybe ".[demos]" would do the trick?

If this is changed, the requirements-doc.txt file will need to be recreated.

"mkdocs",
"mkdocstrings[python]",
"mkdocs-material",
"mkdocs-autorefs",
"mkdocs-bibtex",
"mkdocs-coverage",
"mkdocs-jupyter",
"mkdocs-material-extensions",
"pypandoc",
"wsimod[demos]"
]

[tool.pytest.ini_options]
addopts = "-v -p no:warnings"
82 changes: 82 additions & 0 deletions requirements-demos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=demos --output-file=requirements-demos.txt
#
attrs==23.1.0
# via fiona
certifi==2023.7.22
# via
# fiona
# pyproj
click==8.1.7
# via
# click-plugins
# cligj
# fiona
click-plugins==1.1.1
# via fiona
cligj==0.7.2
# via fiona
colorama==0.4.6
# via
# click
# tqdm
contourpy==1.1.1
# via matplotlib
cycler==0.12.1
# via matplotlib
dill==0.3.7
# via wsimod (pyproject.toml)
fiona==1.9.5
# via geopandas
fonttools==4.43.1
# via matplotlib
geopandas==0.14.0
# via wsimod (pyproject.toml)
kiwisolver==1.4.5
# via matplotlib
matplotlib==3.8.1
# via wsimod (pyproject.toml)
numpy==1.26.1
# via
# contourpy
# matplotlib
# pandas
# shapely
packaging==23.2
# via
# geopandas
# matplotlib
pandas==1.5.2
# via
# geopandas
# wsimod (pyproject.toml)
pillow==10.1.0
# via matplotlib
pyparsing==3.1.1
# via matplotlib
pyproj==3.6.1
# via geopandas
python-dateutil==2.8.2
# via
# matplotlib
# pandas
pytz==2023.3.post1
# via pandas
pyyaml==6.0.1
# via wsimod (pyproject.toml)
shapely==2.0.2
# via
# geopandas
# wsimod (pyproject.toml)
six==1.16.0
# via
# fiona
# python-dateutil
tqdm==4.66.1
# via wsimod (pyproject.toml)

# The following packages are considered to be unsafe in a requirements file:
# setuptools
24 changes: 24 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --extra=dev --output-file=requirements-dev.txt
#
colorama==0.4.6
# via
# pytest
# tqdm
dill==0.3.7
# via wsimod (pyproject.toml)
iniconfig==2.0.0
# via pytest
packaging==23.2
# via pytest
pluggy==1.3.0
# via pytest
pytest==7.4.3
# via wsimod (pyproject.toml)
pyyaml==6.0.1
# via wsimod (pyproject.toml)
tqdm==4.66.1
# via wsimod (pyproject.toml)
Loading
Loading