Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Poetry #1346

Merged
merged 40 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3ca2aab
start using poetry
MaxHalford Oct 22, 2023
ac7c21c
Update pyproject.toml
MaxHalford Oct 22, 2023
3ae3d01
update poetry
MaxHalford Oct 22, 2023
8f72199
Update __version__.py
MaxHalford Oct 22, 2023
51bcb7a
Update unit-tests.yml
MaxHalford Oct 22, 2023
7a02f69
make groups optional
MaxHalford Oct 22, 2023
b32ed6d
no need to source activate
MaxHalford Oct 22, 2023
0ca924e
Update __version__.py
MaxHalford Oct 22, 2023
09e9b5a
Update __version__.py
MaxHalford Oct 22, 2023
f09a45d
bumps
MaxHalford Oct 22, 2023
fba9656
wip
MaxHalford Oct 22, 2023
7598bec
wip
MaxHalford Oct 22, 2023
68a351f
add pytest-xdist[psutil]
MaxHalford Oct 22, 2023
b23865e
Update pyproject.toml
MaxHalford Oct 22, 2023
0c9555b
Update build.py
MaxHalford Nov 2, 2023
85c91d4
wip
MaxHalford Nov 2, 2023
41922be
Update action.yml
MaxHalford Nov 2, 2023
461d3d1
Update unit-tests.yml
MaxHalford Nov 2, 2023
562fba2
Update unit-tests.yml
MaxHalford Nov 2, 2023
5dda7ad
Update unit-tests.yml
MaxHalford Nov 2, 2023
8b0d4d2
Update unit-tests.yml
MaxHalford Nov 2, 2023
433aadc
Update unit-tests.yml
MaxHalford Nov 2, 2023
fcda562
Update build.py
MaxHalford Nov 2, 2023
7541a3f
try this
MaxHalford Nov 2, 2023
0542a40
now try this
MaxHalford Nov 2, 2023
03af139
Update unit-tests.yml
MaxHalford Nov 2, 2023
8d00d56
Update sad.py
MaxHalford Nov 2, 2023
40a93c7
Update sad.py
MaxHalford Nov 2, 2023
e9f8daf
fix tests
MaxHalford Nov 2, 2023
28deb65
stuff
MaxHalford Nov 2, 2023
6ba00c9
Update action.yml
MaxHalford Nov 2, 2023
94d7cf5
Update CONTRIBUTING.md
MaxHalford Nov 2, 2023
b089422
Update action.yml
MaxHalford Nov 2, 2023
61e255a
try adding a build-root param
MaxHalford Nov 2, 2023
6296cf0
wip
MaxHalford Nov 2, 2023
6f8c5ec
Update unit-tests.yml
MaxHalford Nov 2, 2023
746ffa9
wip
MaxHalford Nov 2, 2023
1203075
Update action.yml
MaxHalford Nov 2, 2023
150d9f5
wip
MaxHalford Nov 2, 2023
1b72b44
Update unit-tests.yml
MaxHalford Nov 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
46 changes: 19 additions & 27 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
name: unit-tests

on:
workflow_call:
inputs:
python:
type: string
os:
type: string
pull_request:
branches:
- "*"
push:
branches:
- main

jobs:
test:
runs-on: ${{ inputs.os }}
run:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.12, 3.11, 3.10]

# Instead of using two matrices in the calling Workflow, we can use conditionals here
# if: (inputs.os == 'ubuntu-latest' && inputs.python == '3.11') || github.event_name == 'push'
if: (inputs.python == '3.11') || github.event_name == 'push'
runs-on: ${{ matrix.os }}

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: ${{ inputs.python }}
python-version: "3.12"

- name: Cache River datasets
uses: actions/cache@v3
Expand All @@ -38,18 +39,9 @@ jobs:

- name: Download datasets
run: |
source ~/.venv/bin/activate
python -c "from river import datasets; datasets.CreditCard().download(); datasets.Elec2().download(); datasets.SMSSpam().download()"
python -c "from river import bandit; bandit.datasets.NewsArticles().download()"
poetry run python -c "from river import datasets; datasets.CreditCard().download(); datasets.Elec2().download(); datasets.SMSSpam().download()"
poetry run python -c "from river import bandit; bandit.datasets.NewsArticles().download()"

- name: pytest [Branch]
if: github.event_name == 'pull_request'
- name: pytest
run: |
source ~/.venv/bin/activate
pytest --durations=10 -n logical # Run pytest on all logical CPU cores

- name: pytest [Main]
if: github.event_name == 'push'
run: |
source ~/.venv/bin/activate
pytest -m "not datasets" --durations=10 -n logical # Run pytest on all logical CPU cores
poetry run pytest -m "not datasets" --durations=10 -n logical # Run pytest on all logical CPU cores
Loading