Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/online-ml/river
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Nov 2, 2023
2 parents 869c33e + 49daad3 commit 3adc83a
Show file tree
Hide file tree
Showing 14 changed files with 5,917 additions and 204 deletions.
53 changes: 53 additions & 0 deletions .github/actions/install-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Install env

inputs:
python-version:
description: "Python version to use"
required: true
build-root:
default: "true"
options:
- true
- false

runs:
using: "composite"
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Python
id: set-up-python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: Load cached Poetry installation
uses: actions/cache@v3
with:
path: ~/.local # the path depends on the OS
key: poetry-1 # increment to reset cache

- name: Install poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Load cached virtual env
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.set-up-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
shell: bash
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-ansi --no-root

- name: Build
shell: bash
if: ${{ inputs.build-root == 'true' }}
run: poetry install --no-interaction --no-ansi
71 changes: 0 additions & 71 deletions .github/workflows/build-river.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/ci.yml

This file was deleted.

28 changes: 6 additions & 22 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,13 @@ jobs:
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
- name: Build River
uses: ./.github/actions/install-env
with:
python-version: 3.11

- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && rustup show
if: matrix.os == 'ubuntu-latest'

- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -e ".[dev]"
python-version: "3.12"
build-root: false

- name: Run pre-commit on all files
run: pre-commit run --all-files
run: poetry run pre-commit run --all-files
2 changes: 1 addition & 1 deletion .github/workflows/delete-caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
my-job:
name: Delete all caches
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Clear caches
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/docs.yml → .github/workflows/dev-docs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: docs

on:
workflow_call:
push:
branches:
- main

jobs:
docs:
Expand All @@ -10,21 +12,25 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Retrieve the environment and the River build
uses: ./.github/actions/retrieve-env
- name: Build River
uses: ./.github/actions/install-env
with:
python: "3.11"
python-version: "3.12"
build-root: false

- name: Install Ubuntu dependencies
- name: Install extra Ubuntu dependencies
run: sudo apt-get install graphviz pandoc

- name: Install extra Python dependencies
run: |
poetry install --with docs
- name: Build docs
run: |
source ~/.venv/bin/activate
make doc
- name: Deploy docs
if: github.event_name == 'push'
env:
GH_TOKEN: ${{ secrets.GitHubToken }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
arch: alt

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: set up rust
if: matrix.os != 'ubuntu-latest'
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,20 @@ jobs:
ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Install Ubuntu dependencies
run: sudo apt-get install graphviz pandoc

- name: Set up Python
uses: actions/setup-python@v4
- name: Build River
uses: ./.github/actions/install-env
with:
python-version: "3.9"
python-version: "3.12"

- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && rustup show
if: matrix.os == 'ubuntu-latest'
- name: Install extra Ubuntu dependencies
run: sudo apt-get install graphviz pandoc

- name: Install Python dependencies
- name: Install extra Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pip install -e ".[compat,dev,docs]"
poetry install --with compat --with docs
pip install rich
python -m spacy download en_core_web_sm
Expand Down
24 changes: 10 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,33 +18,29 @@ The typical workflow for contributing to River is:

## Local setup

We encourage you to use a virtual environment. You'll want to activate it every time you want to work on River.
Start by cloning the repository:

```sh
python -m venv .venv
source .venv/bin/activate
git clone https://github.com/online-ml/river
```

You can also create a virtual environment via `conda`:
Next, you'll need a Python environment. A nice way to manage your Python versions is to use pyenv, which can installed [here](https://github.com/pyenv/pyenv-installer). Once you have pyenv, you can install the latest Python version River supports:

```sh
conda create -n river -y python=3.9
conda activate river
pyenv install -v $(cat .python-version)
```

Yet another option is to use `pyenv`:
You need a `Rust` compiler you can install it by following this [link](https://www.rust-lang.org/fr/tools/install). You'll also need [Poetry](https://python-poetry.org/):

```sh
pyenv virtualenv 3.10 river310
pyenv activate river310
curl -sSL https://install.python-poetry.org | python3 -
```

You need a `Rust` compiler you can install it by following this [link](https://www.rust-lang.org/fr/tools/install)

Then, navigate to your cloned fork and install River and the required dependencies in [development mode](https://stackoverflow.com/questions/19048732/python-setup-py-develop-vs-install):
Now you're set to install River and activate the virtual environment:

```sh
pip install -e ".[dev]"
poetry install
poetry shell
```

Finally, install the [pre-commit](https://pre-commit.com/) push hooks. This will run some code quality checks every time you push to GitHub.
Expand Down Expand Up @@ -100,7 +96,7 @@ If you're adding a class or a function, then you'll need to add a docstring. We
To build the documentation, you need to install some extra dependencies:

```sh
pip install -e ".[docs]"
poetry install --with docs
pip install git+https://github.com/MaxHalford/yamp
```

Expand Down
Loading

0 comments on commit 3adc83a

Please sign in to comment.