Skip to content

Commit

Permalink
Port infrastructure to pyproject.toml (#29)
Browse files Browse the repository at this point in the history
* Switch to pyproject.toml

* Fix syntax errors

* New requirements files

* Point to new requirements file

* Add dill requirement

* Add __init__.py

* Update install instructions

* Minor requested changes, rebuiding requirements files
  • Loading branch information
tsmbland authored Nov 2, 2023
1 parent 741500a commit 8d5bbcb
Show file tree
Hide file tree
Showing 11 changed files with 515 additions and 160 deletions.
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 = [
"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

0 comments on commit 8d5bbcb

Please sign in to comment.