Skip to content

Commit 4b3de91

Browse files
authored
Merge pull request #158 from scikit-learn-contrib/from-conda-to-poetry
Move to poetry
2 parents d2d985d + 3a320f7 commit 4b3de91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+8115
-1890
lines changed

.flake8

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
name: Publish Package on PYPI
1+
name: Publish Package on PyPI
22

33
on:
44
release:
55
types: [published]
66

7-
87
jobs:
98
deploy:
10-
119
runs-on: ubuntu-latest
1210

1311
steps:
@@ -16,14 +14,19 @@ jobs:
1614
uses: actions/setup-python@v4
1715
with:
1816
python-version: '3.10'
17+
- name: Install Poetry
18+
run: |
19+
curl -sSL https://install.python-poetry.org | python3 -
20+
echo "$HOME/.local/bin" >> $GITHUB_PATH
1921
- name: Install dependencies
2022
run: |
21-
python -m pip install --upgrade pip
22-
pip install setuptools wheel twine
23+
poetry install
2324
- name: Build package
24-
run: python setup.py sdist bdist_wheel
25+
run: |
26+
poetry build
2527
- name: Publish package
26-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
27-
with:
28-
user: __token__
29-
password: ${{ secrets.PYPI_API_TOKEN }}
28+
env:
29+
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
30+
run: |
31+
poetry config pypi-token.pypi $PYPI_TOKEN
32+
poetry publish

.github/workflows/test.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ name: Unit tests
33
on:
44
push:
55
branches:
6-
-dev
7-
-main
6+
- "**"
87
pull_request:
98
types: [opened, synchronize, reopened, ready_for_review]
109
workflow_dispatch:
1110

1211
jobs:
13-
build-linux:
12+
check:
1413
if: github.event.pull_request.draft == false
1514
runs-on: ${{matrix.os}}
1615
strategy:
@@ -22,24 +21,23 @@ jobs:
2221
shell: bash -l {0}
2322

2423
steps:
25-
- name: Git clone
24+
- name: Checkout
2625
uses: actions/checkout@v3
27-
- name: Set up venv for ci
28-
uses: conda-incubator/setup-miniconda@v2
26+
- name: Python
27+
uses: actions/setup-python@v4
2928
with:
30-
python-version: ${{matrix.python-version}}
31-
environment-file: environment.ci.yml
32-
- name: Lint with flake8
33-
run: |
34-
flake8
35-
- name: Test with pytest
36-
run: |
37-
make coverage
38-
- name: typing with mypy
39-
run: |
40-
mypy qolmat
41-
echo you should uncomment mypy qolmat and delete this line
42-
- name: Upload coverage reports to Codecov
29+
python-version: ${{ matrix.python-version }}
30+
- name: Poetry
31+
uses: snok/install-poetry@v1
32+
with:
33+
version: 1.8.3
34+
- name: Lock
35+
run: poetry lock --no-update
36+
- name: Install
37+
run: poetry install
38+
- name: Checkers
39+
run: make checkers
40+
- name: Codecov
4341
uses: codecov/codecov-action@v3
4442
env:
4543
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/test_quick.yml

Lines changed: 0 additions & 68 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,8 @@ repos:
88
exclude: (docs/)
99
- id: trailing-whitespace
1010
exclude: (docs/)
11-
- repo: https://github.com/psf/black
12-
rev: 22.8.0
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.3.3
1313
hooks:
14-
- id: black
15-
args:
16-
- "-l 99"
17-
# Flake8
18-
- repo: https://github.com/PyCQA/flake8
19-
rev: 4.0.1
20-
hooks:
21-
- id: flake8
22-
- repo: https://github.com/pre-commit/mirrors-mypy
23-
rev: v1.1.1
24-
hooks:
25-
- id: mypy
26-
args: [--ignore-missing-imports]
27-
additional_dependencies: [types-requests]
14+
- id: ruff
15+
- id: ruff-format

CONTRIBUTING.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,11 @@ You can create a virtual environment via `conda`:
2929

3030
.. code:: sh
3131
32-
$ conda env create -f environment.dev.yml
33-
$ conda activate env_qolmat_dev
34-
35-
If you need to use pytorch, enter the command:
36-
37-
.. code:: sh
38-
39-
$ pip install -e .[pytorch]
32+
$ pip install poetry
33+
$ poetry config virtualenvs.in-project true
34+
$ poetry lock
35+
$ poetry install
36+
$ poetry shell
4037
4138
Once the environment is installed, pre-commit is installed, but need to be activated using the following command:
4239

@@ -78,7 +75,7 @@ These tests absolutely have to pass.
7875

7976
.. code:: sh
8077
81-
$ mypy qolmat
78+
$ make check-types
8279
8380
Unit test
8481
^^^^^^^^^
@@ -88,4 +85,4 @@ The coverage should on new features must be above 95%.
8885

8986
.. code:: sh
9087
91-
$ pytest -vs --cov-branch --cov=qolmat --pyargs tests --cov-report term-missing
88+
$ make check-coverage

Makefile

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1-
coverage:
2-
pytest --cov-branch --cov=qolmat --cov-report=xml tests
31

4-
doctest:
5-
pytest --doctest-modules --pyargs qolmat
2+
check-coverage:
3+
poetry run pytest --cov-branch --cov=qolmat/ --cov-report=xml tests/
64

7-
doc:
8-
make html -C docs
5+
check-poetry:
6+
poetry check --lock
7+
8+
check-quality:
9+
poetry run ruff check qolmat/ tests/
10+
11+
check-security:
12+
poetry run bandit --recursive --configfile=pyproject.toml qolmat/
13+
14+
check-tests:
15+
poetry run pytest tests/
16+
17+
check-types:
18+
poetry run mypy qolmat/ tests/
19+
20+
checkers: check-coverage check-types
921

1022
clean:
1123
rm -rf .mypy_cache .pytest_cache .coverage*
1224
rm -rf **__pycache__
1325
make clean -C docs
26+
27+
coverage:
28+
poetry run pytest --cov-branch --cov=qolmat --cov-report=xml tests
29+
30+
doc:
31+
make html -C docs
32+
33+
doctest:
34+
poetry run pytest --doctest-modules --pyargs qolmat

environment.ci.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

environment.dev.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

environment.doc.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)