Skip to content

Commit

Permalink
update to use pyproject.toml; update workflows and docs to use
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwilby authored and tom-andersson committed Jan 15, 2025
1 parent 191dfd7 commit 8699fca
Show file tree
Hide file tree
Showing 15 changed files with 98 additions and 104 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## :white_check_mark: Checklist before requesting a review
(See the contributing guide for more details on these steps.)
- [ ] I have installed developer dependencies with `pip install -r requirements/requirements.dev.txt` and running `pre-commit install` (or alternatively, manually running `ruff format` before commiting)
- [ ] I have installed developer dependencies with `pip install .[dev]` and running `pre-commit install` (or alternatively, manually running `ruff format` before commiting)

If changing or adding source code:
- [ ] tests are included and are passing (run `pytest`).
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ jobs:
- name: "Upgrade pip"
run: pip install --upgrade pip
- name: "Install dependencies"
run: pip install -r requirements/requirements.txt
- name: "Install jupyterbook"
run: pip install -r requirements/requirements.docs.txt
run: pip install .[docs]
- name: "Run jupyterbook"
run: jupyter-book build docs --all
- name: "Deploy"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel twine
pip install -U setuptools wheel twine build
- name: Build and publish
run: |
python setup.py sdist bdist_wheel
run: python -m build

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/requirements.txt
pip install -r requirements/requirements.dev.txt
pip install .[dev,testing]
pip install tox-gh-actions
- name: Test with tox
run: tox
- name: Run coveralls
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ command to edit previous commit messages, combine multiple commits into one, or
commits that are no longer necessary.

Make sure you're using the developer dependencies.
If you're working locally on the source code, *before* commiting, please run `pip install -r requirements/requirements.dev.txt` to install some useful dependencies just for development.
If you're working locally on the source code, *before* commiting, please run `pip install .[dev]` to install some useful dependencies just for development.
This includes `pre-commit` and `ruff` which are used to check and format your code style when you run `git commit`, so that you don't have to.

Using pre-commit:
Expand Down Expand Up @@ -151,7 +151,7 @@ One easy way to contribute to the documentation is to provide feedback in [this

Another way to contribute is to directly edit or add to the documentation and open a PR:
* Follow all the forking instructions above
* Install the documentation requirements: `pip install -r requirements/requirements.docs.txt`
* Install the documentation requirements: `pip install deepsensor[docs]`
* Option A: Editing a markdown file
* Simply make your edits!
* Option B: Editing a jupyter notebook file
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ over the US. First, pip install the package. In this case we will use the PyTorc
want GPU support).

```bash
pip install deepsensor
pip install torch
pip install deepsensor[torch]
```

We can go from imports to predictions with a trained model in less than 30 lines of code!
Expand Down
16 changes: 16 additions & 0 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ This method will create a `DeepSensor` directory on your machine which will cont
```bash
pip install -v -e .
```

```{note}
If you intend on contributing to the source code of DeepSensor, install DeepSensor with its development dependencies using
````{bash}
pip install -v -e .[dev]
````
```

## Install PyTorch or TensorFlow

The next step, if you intend to use any of DeepSensor's deep learning modelling functionality,
Expand All @@ -60,3 +68,11 @@ To install `pytorch` via pip:
```bash
pip install torch
```

To install DeepSensor as well as a deep learning library at the same time use:

```bash
pip install deepsensor[tf] # for tensorflow and tensorflow_probability
# or
pip install deepsensor[torch] # for pytorch
```
3 changes: 0 additions & 3 deletions docs/requirements.txt

This file was deleted.

72 changes: 72 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
[build-system]
requires = ["setuptools>=61"]
build-backend = "setuptools.build_meta"

[project]
name = "deepsensor"
version = "0.4.2"
authors = [
{name = "Tom R. Andersson", email="[email protected]"},
]
description = "A Python package for modelling xarray and pandas data with neural processes."
readme = "README.md"
license = {text="MIT"}
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent"
]
requires-python = ">=3.8"
dependencies = [
"backends",
"backends-matrix",
"dask",
"distributed",
"gcsfs",
"matplotlib",
"neuralprocesses>=0.2.7",
"numpy",
"pandas",
"pooch",
"pyshp",
"seaborn",
"tqdm",
"xarray",
"zarr"
]

[tool.setuptools]
packages = ["deepsensor"]

[project.urls]
Source = "https://github.com/alan-turing-institute/deepsensor"
Bug_Tracker = "https://github.com/alan-turing-institute/deepsensor/issues"

[project.optional-dependencies]
torch = ["torch>=2"]
tf = ["tensorflow", "tensorflow_probability[tf]"]
dev = [
"coveralls",
"parameterized",
"pre-commit",
"pytest",
"ruff",
]
docs = [
"jupyter-book",
"matplotlib",
"numpy",
]
testing = [
"mypy",
"parameterized",
"pytest",
"pytest-cov",
"tox",
]
rioxarray = [
"rioxarray"
]

[tool.setuptools.package-data]
deepsensor = ["py.typed"]

[tool.pytest.ini_options]
addopts = "--cov=deepsensor"
testpaths = [
Expand Down
9 changes: 0 additions & 9 deletions requirements/requirements.dev.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/requirements.docs.txt

This file was deleted.

22 changes: 0 additions & 22 deletions requirements/requirements.txt

This file was deleted.

49 changes: 0 additions & 49 deletions setup.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions setup.py

This file was deleted.

3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ python =
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements/requirements.txt
-r{toxinidir}/requirements/requirements.dev.txt
.[tf,torch,testing]
commands =
pytest --basetemp={envtmpdir}

0 comments on commit 8699fca

Please sign in to comment.