Skip to content

Commit

Permalink
Merge pull request #121 from aai-institute/cleanup/dev-dependencies
Browse files Browse the repository at this point in the history
Split dependencies only into standard and dev.
  • Loading branch information
samuelburbulla authored Apr 15, 2024
2 parents dc36423 + 934fc82 commit abd6559
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
cache: "pip"
- name: Install
run: |
pip install ".[docs]"
pip install ".[dev]"
- run: mkdocs gh-deploy --force
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
cache: "pip"
- name: Install
run: |
pip install ".[testing]"
pip install ".[dev]"
- name: Run pytest
run: |
pytest -v
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
cache: "pip"
- name: Install
run: |
pip install ".[testing]"
pip install ".[dev]"
- name: Install missing system dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
Expand All @@ -86,7 +86,7 @@ jobs:
cache: "pip"
- name: Install
run: |
pip install ".[testing]"
pip install ".[dev]"
- name: Run tests and collect coverage
run: pytest --cov src
- name: Upload coverage to Codecov
Expand Down
49 changes: 31 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ bug reports and feature requests.

## Local development

This project uses [black](https://github.com/psf/black) to format code and
[pre-commit](https://pre-commit.com/) to invoke it as a git pre-commit hook.

Run the following to set up the pre-commit git hook to run before pushes:
In order to contribute to the library, you will need to set up your local
development environment. First, clone the repository:

```bash
pre-commit install --hook-type pre-push
```shell
git clone https://github.com/aai-institute/continuiti.git
cd continuiti
```

## Setting up your environment
### Setting up your environment

We strongly suggest using some form of virtual environment for working with the
library, e.g., with venv:
Expand All @@ -27,25 +26,35 @@ python3 -m venv ./venv
source venv/bin/activate
```

### Installing in editable mode

A very convenient way of working with your library during development is to
install it in editable mode into your environment by running
install it in editable mode into your environment by running:

```shell
pip install -e .
pip install -e .[dev]
```

## Build documentation
The `[dev]` extra installs all dependencies needed for development, including
testing, documentation and benchmarking.

API documentation and examples from notebooks are built with
[mkdocs](https://www.mkdocs.org/).
Notebooks are an integral part of the documentation as well.
### Pre-commit hooks

Install the documentation dependencies:
This project uses [black](https://github.com/psf/black) to format code and
[pre-commit](https://pre-commit.com/) to invoke it as a git pre-commit hook.

Run the following to set up the pre-commit git hook to run before pushes:

```bash
pip install -e ".[docs]"
pre-commit install
```

## Build documentation

API documentation and examples from notebooks are built with
[mkdocs](https://www.mkdocs.org/).
Notebooks are an integral part of the documentation as well.

You can use this command to continuously rebuild documentation
on changes to the `docs` and `src` folder:

Expand All @@ -64,10 +73,14 @@ by [CI pipelines](#CI). Before pushing your changes to the remote we recommend
to execute `pytest` locally in order to detect mistakes early on and to avoid
failing pipelines.

For testing, install the testing dependencies:
To run all tests, use:
```shell
pytest
```

```bash
pip install -e ".[testing]"
To run specific tests, use:
```shell
pytest -k test_pattern
```

Slow tests (> 5s) are marked by the `@pytest.mark.slow` decorator.
Expand Down
8 changes: 0 additions & 8 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Benchmarks

## Prerequisites

The benchmarks require optional dependencies:

```bash
pip install -e ".[benchmark]"
```

## Run

Run the `run_all.py` script to run all benchmarks.
Expand Down
27 changes: 7 additions & 20 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ dependencies = [
"flake8", # code analysis
"isort", # import sorting

# --------- loggers --------- #
# wandb
# neptune-client
# mlflow
# comet-ml
# tensorboard

# --------- linters --------- #
"pre-commit", # hooks for applying linters on commit
"pudb", # debugger
Expand All @@ -43,25 +36,25 @@ dependencies = [
"python-dotenv", # loading env variables from .env file
"rich", # beautiful text formatting in terminal
"sh", # for running bash commands in some tests
# dvc # data version control

# --------- dependencies --------- #
"torch>=2.1.0,<3.0.0",
"matplotlib",
"pandas",
"numpy",
"scipy",
"dvc",
"dvc-gdrive",
"mlflow",
"optuna>=3.5.0,<4.0.0",
]

[project.optional-dependencies]
testing = [
dev = [
"setuptools",
"pytest",
"pytest-cov",
"nbmake",
"gmsh",
"mlflow",
]
docs = [
"markdown-captions",
"mike",
"mkdocs==1.5.2",
Expand All @@ -78,13 +71,7 @@ docs = [
"mknotebooks>=0.8.0",
"neoteroi-mkdocs",
"pygments",
]
benchmark = [
"dvc",
"dvc-gdrive",
"mlflow",
"optuna>=3.5.0,<4.0.0",
"scipy",
"gmsh",
]

[tool.setuptools.dynamic]
Expand Down

0 comments on commit abd6559

Please sign in to comment.