Skip to content

Commit

Permalink
⭐ optional dep in pyproject.toml (Cloud-Drift#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippemiron authored Jun 11, 2024
1 parent 8ea5ef0 commit 19c16ef
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
python=${{ matrix.python-version }}
pytest
coverage
matplotlib-base
matplotlib
cartopy
- name: Run unit tests
shell: bash -l {0}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
python -m build
pip install dist/*.whl
pushd docs
pip install -r requirements.txt
pip install clouddrift[docs]
make html
- name: Upload HTML artificat
uses: actions/upload-artifact@v4
Expand Down
20 changes: 10 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ examples:
⚡ improve dataset loading time
⭐ include new ibtracs dataset
🐛 x feature doesn't work on windows
🐛 x feature doesn't work on windows
Common emojis to use are as follow:
Expand Down Expand Up @@ -111,13 +111,13 @@ conda activate clouddrift
with pip:

```
pip install pytest matplotlib cartopy coverage
pip install clouddrift[dev,plotting]
```

with conda:

```
conda install pytest matplotlib-base cartopy coverage
conda install pytest matplotlib cartopy coverage
```

3. Run the test suite:
Expand All @@ -133,15 +133,15 @@ pytest tests/*_tests.py tests/adapters/*_tests.py

4. Run the test suite (with coverage):
```
coverage run -m pytest tests/*_tests.py tests/adapters/*_tests.py
coverage run -m pytest tests/*_tests.py tests/adapters/*_tests.py
```

5. Read the report:
```
coverage report
```

### Building locally and installing
### Building locally and installing
This can be useful for understanding how the package is built, testing the process, and can be leveraged for testing
experimental versions of the library from a users perspective.

Expand All @@ -159,12 +159,12 @@ pip install .

The Clouddrift project uses the [`ruff`](https://github.com/astral-sh/ruff) tool for formatting the code and linting. We also leverage [`mypy`](https://github.com/python/mypy) for static typing. Please see the section on [Automated Processes](#automated-processes) to learn about how these tools are used prior to accepting pull requests.

1. Install development dependencies
1. Install development dependencies

with pip:

```
pip install ruff mypy
pip install clouddrift[dev]
```

with conda:
Expand Down Expand Up @@ -205,7 +205,7 @@ the process will fail and will block pull requests from being merged.
### Building documentation locally
This is useful if you want to inspect the documentation that gets generated

* pre-requisite step: [Building locally and installing](#building-locally-and-installing) necessary for sphinx to find class/module references
* pre-requisite step: [Building locally and installing](#building-locally-and-installing) necessary for sphinx to find class/module references


1. Go into the docs directory:
Expand All @@ -215,7 +215,7 @@ cd docs

2. Install the Sphinx documentation generation dependencies:
```
pip install -r requirements.txt
pip install clouddrift[docs]
```

3. Generate the new documentation:
Expand All @@ -237,7 +237,7 @@ To make an `clouddrift` release you must do it as part of a pull request:
* Be sure to increase the version number in `pyproject.toml` in accordance with the [Semantic Versioning Specification](https://semver.org/)
* Once the PR is merged locally update your local main branch
* `git checkout main`
* `git pull`
* `git pull`
* Tag the release with the new version number as so: vX.Y.Z (e.g. - v0.32.0, v1.10.0, etc...)
* `git tag vX.Y.Z` (e.g. - `git tag v0.32.0`)
* Push the tag up (origin here is the remote repository for the `clouddrift` repository of the `Cloud-Drift` organization on GitHub)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ To install optional dependencies needed by the `clouddrift.plotting` module,
type:

```
conda install matplotlib-base cartopy
conda install matplotlib cartopy
```

#### Development branch:
Expand Down
70 changes: 65 additions & 5 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,71 @@
Installation
============

Required dependencies
---------------------

CloudDrift requires the following dependencies:

- `python <https://github.com/python>`_ (3.10 or later)
- `aiohttp <https://github.com/aio-libs/aiohttp>`_ (3.8.4 or later)
- `awkward <https://github.com/scikit-hep/awkward>`_ (2.0.0 or later)
- `fsspec <https://github.com/fsspec/filesystem_spec>`_ (2022.3.0 or later)
- `netcdf4 <https://github.com/Unidata/netcdf4-python>`_ (1.6.4 or later)
- `h5netcdf <https://github.com/h5netcdf/h5netcdf>`_ (1.3.0 or later)
- `numpy <https://github.com/numpy/numpy>`_ (1.22.4 or later)
- `pandas <https://github.com/pandas-dev/pandas>`_ (1.3.4 or later)
- `pyarrow <https://github.com/apache/arrow>`_ (8.0.0 or later)
- `tqdm <https://github.com/tqdm/tqdm>`_ (4.64.0 or later)
- `requests <https://github.com/psf/requests>`_ (2.31.0 or later)
- `scipy <https://github.com/scipy/scipy>`_ (1.11.2 or later)
- `xarray <https://github.com/pydata/xarray>`_ (2023.5.0 or later)
- `zarr <https://github.com/zarr-developers/zarr-python>`_ (2.14.2 or later)
- `tenacity <https://github.com/jd/tenacity>`_ (8.2.3 or later)

if you install CloudDrift using pip or Conda, these dependencies will be installed automatically.

Optional dependencies
---------------------

For plotting
^^^^^^^^^^^^

- `cartopy <https://github.com/SciTools/cartopy>`_
- `matplotlib <https://github.com/matplotlib/matplotlib>`_

For development and testing
^^^^^^^^^^^^^^^^^^^^^^^^^^^

- `build <https://github.com/pypa/build>`_
- `coverage <https://github.com/nedbat/coveragepy>`_
- `docutils <https://github.com/docutils/docutils>`_
- `pytest <https://github.com/pytest-dev/pytest>`_
- `mypy <https://github.com/python/mypy>`_
- `ruff <https://github.com/astral-sh/ruff>`_
- `twine <https://github.com/pypa/twine>`_

For building the documentation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- `sphinx <https://github.com/sphinx-doc/sphinx>`_
- `sphinx-book-theme <https://github.com/executablebooks/sphinx-book-theme>`_
- `sphinx-copybutton <https://github.com/executablebooks/sphinx-copybutton>`_

Note: If you are using pip to install xarray, optional dependencies can be installed by specifying extras, such as:

.. code-block:: text
pip install clouddrift[plotting] clouddrift[dev] clouddrift[docs]
There is also `clouddrift[all]` to install automatically all optional dependencies.

Installation instructions
-------------------------

You can install the latest release of CloudDrift using pip or Conda.
You can also install the latest development (unreleased) version from GitHub.

pip
---
^^^

In your virtual environment, type:

Expand All @@ -20,10 +80,10 @@ type:

.. code-block:: text
pip install matplotlib-base cartopy
pip install clouddrift[plotting]
Conda
-----
^^^^^

First add ``conda-forge`` to your channels in your Conda environment:

Expand All @@ -43,10 +103,10 @@ type:

.. code-block:: text
conda install matplotlib-base cartopy
conda install matplotlib cartopy
Developers
----------
^^^^^^^^^^

If you need the latest development version, get it from GitHub using pip:

Expand Down
3 changes: 0 additions & 3 deletions docs/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ dependencies:
- requests>=2.31.0
- scipy>=1.11.2
- zarr>=2.14.2
- tenacity>=8.2.3
- tenacity>=8.2.3
25 changes: 23 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "clouddrift"
version = "0.35.1"
version = "0.36.0"
authors = [
{ name="Shane Elipot", email="selipot@miami.edu" },
{ name="Philippe Miron", email="philippemiron@gmail.com" },
Expand Down Expand Up @@ -37,6 +37,27 @@ dependencies = [
"tenacity>=8.2.3"
]

[project.optional-dependencies]
all = ["clouddrift[dev,docs,plotting]"]
dev = [
"build",
"coverage",
"docutils",
"pytest",
"mypy",
"ruff",
"twine",
]
docs = [
"sphinx",
"sphinx-book-theme",
"sphinx-copybutton",
]
plotting = [
"matplotlib",
"cartopy",
]

[project.urls]
Homepage = "https://github.com/Cloud-Drift/clouddrift"
Documentation = "https://cloud-drift.github.io/clouddrift"
Expand Down Expand Up @@ -70,4 +91,4 @@ module = [
"tests.pairs_tests",
"tests.plotting_tests",
]
ignore_errors = true
ignore_errors = true

0 comments on commit 19c16ef

Please sign in to comment.