Skip to content

Commit

Permalink
build: use PEP517/518 conventions (#100)
Browse files Browse the repository at this point in the history
see #100 (comment) for a summary of this PR
  • Loading branch information
deepcharles authored Jan 6, 2021
1 parent a24d4f6 commit 577ea32
Show file tree
Hide file tree
Showing 74 changed files with 162 additions and 288 deletions.
61 changes: 0 additions & 61 deletions .circleci/config.yml

This file was deleted.

11 changes: 3 additions & 8 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Pull Request Docs Check"
name: "Check docs"
on:
- pull_request

Expand All @@ -7,19 +7,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.8'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install ruptures and dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
python setup.py install
python -m pip install .[dev]
- name: Run notebooks
run: |
jupyter nbconvert --inplace --to notebook --ExecutePreprocessor.kernel_name=python --execute $(find ./docs -name '*.ipynb')
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check-linting.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: check-linting
name: Check linting

on:
push:
Expand All @@ -18,7 +18,7 @@ jobs:
- name: Install pre-commit hooks
run: |
python -m pip install --upgrade pip
pip install pre-commit
python -m pip install pre-commit
- name: Run pre-commit hooks
run: |
pre-commit run --all-files
13 changes: 4 additions & 9 deletions .github/workflows/publish-doc-to-remote.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Publish doc to website on new release (or manual trigger)
name: "docs"
# Publish docs to website on new release (or manual trigger)
name: "Publish docs online"

on:
release:
Expand All @@ -14,23 +14,18 @@ jobs:
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.8'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install ruptures and dependecies
run: |
python -m pip install --upgrade pip
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
python setup.py install
python -m pip install .[dev]
- name: Run notebooks
run: |
jupyter nbconvert --inplace --to notebook --ExecutePreprocessor.kernel_name=python --execute $(find ./docs -name '*.ipynb')
- name: Build documentation
run: |
mkdocs build
- name: Publish documentation to remote
- name: Publish documentation to remote repo
uses: selenehyun/gh-push@master
env:
GITHUB_TOKEN: ${{ secrets.DOC_PUSHER_ACCESS_TOKEN }}
Expand Down
22 changes: 9 additions & 13 deletions .github/workflows/run-test-coverage.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# This workflow will install Python dependencies, run tests, generate coverage report and upload it to codecov
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# This workflow will install Python dependencies, run tests, generate coverage
# report and upload it to codecov.
# For more information, see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: coverage
name: Run tests with coverage

on:
push:
Expand All @@ -14,26 +16,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install pytest-cov
- name: Install ruptures
run: |
python setup.py install
python -m pip install --upgrade pip
python -m pip install .[test]
- name: Test with pytest
run: |
pytest --cov-report=xml --cov=ruptures tests/
python -m pytest
- name: Upload to Codecov
run: |
bash <(curl -s https://codecov.io/bash)
- uses: actions/upload-artifact@v2
with:
path: coverage.xml
13 changes: 4 additions & 9 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: build
name: Run tests

on:
push:
Expand All @@ -18,22 +18,17 @@ jobs:
exclude:
- os: windows-latest
python-version: 3.9

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Install ruptures
run: |
python setup.py install
python -m pip install --upgrade pip
python -m pip install .[test]
- name: Test with pytest
run: |
pytest
python -m pytest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish to Pypi (sdist and wheels)
name: Upload package to Pypi

on:
workflow_dispatch:
Expand All @@ -15,7 +15,7 @@ jobs:
bitness: [32, 64]
python: [36, 37, 38, 39]
include:
# Run 32 and 64 bit version in parallel for Linux and Windows
# Run 32 and 64 bits version in parallel for Linux and Windows
- os: windows-latest
bitness: 64
platform_id: win_amd64
Expand Down Expand Up @@ -48,9 +48,7 @@ jobs:
- name: Install cibuildwheel and dependencies
run: |
python -m pip install --upgrade pip
python -m pip install cibuildwheel
pip install -r requirements-dev.txt
pip install setuptools wheel twine
python -m pip install cibuildwheel twine
- name: Build wheels
env:
Expand All @@ -59,7 +57,7 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m cibuildwheel --output-dir wheelhouse
twine upload wheelhouse/*.whl
python -m twine upload wheelhouse/*.whl
- uses: actions/upload-artifact@v2
with:
Expand All @@ -69,26 +67,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.x
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.8'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install setuptools wheel twine
- name: Build
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist
twine upload dist/*.tar.gz
python -m twine upload dist/*.tar.gz
- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,4 @@ docs/build/*
.Trashes
ehthumbs.db
Thumbs.db
site/
ruptures/utils/_utils/convert_path_matrix.c
ruptures/detection/_detection/continuous_linear_cpd.c
ruptures/detection/_detection/ekcpd.c
site/
36 changes: 14 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

In all following steps, it is highly recommended to use a virtual environment.

### Install the requirements

Several packages are needed to compile, format and test the code.
They are listed in `requirements-dev.txt` and can be installed with the following command.

### Install the development version

It is important that you contribute to the latest version of the code.
Expand All @@ -20,33 +15,30 @@ git clone https://github.com/deepcharles/ruptures
cd ruptures
```

Then install the downloaded package.
Then install the downloaded package with `pip`.

```
python -m pip install --verbose --no-build-isolation --editable .
python -m pip install --editable .[dev]
```

#### With pip
```
pip install -r requirements-dev.txt
```
Note that `python -m` can be omitted most of the times, but within virtualenvs, it can prevent certain errors.
Also, in certain terminals (such as zsh), the square brackets must be escaped, e.g. replace `.[dev]` by `.\[dev\]`.

#### With conda
```
conda --file requirements-dev.txt
```

Then run the following command to install the `pre-commit` hooks.
```
pre-commit install
```
In addition to `numpy`, `scipy` and `ruptures`, this command will install all packages needed to develop `ruptures`.
The exact list of librairies can be found in the [`setup.cfg` file](https://github.com/deepcharles/ruptures/blob/master/setup.cfg) (section `[options.extras_require]`).

### Pre-commit hooks

We use `pre-commit` to run Git hooks before submitting the code to review.
These hook scripts perform simple tasks before each commit (code formatting mostly).
To activate the hooks, simply run the following command in your terminal.

```
pre-commit install
```


Note that if you try to commit a non-compliant (i.e. badly formatted) file, `pre-commit` will modify this file and make the commit fail.
If you try to commit a non-compliant (i.e. badly formatted) file, `pre-commit` will modify this file and make the commit fail.
However you need to stage the new changes **yourself** as `pre-commit` will not do that for you (this is by design; see [here](https://github.com/pre-commit/pre-commit/issues/806) or [here](https://github.com/pre-commit/pre-commit/issues/747)).
Fortunately, `pre-commit` outputs useful messages.

Expand All @@ -61,7 +53,7 @@ If you want to manually run all pre-commit hooks on a repository, run `pre-commi
The following command executes the test suite.

```
pytest
python -m pytest
```

### Write docstrings
Expand Down
10 changes: 0 additions & 10 deletions README.rst

This file was deleted.

4 changes: 0 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ nav:
- Binseg: code-reference/detection/binseg-reference.md
- BottomUp: code-reference/detection/bottomup-reference.md
- Window: code-reference/detection/window-reference.md
# - GreedyAR: code-reference/detection/greedyar-reference.md
# - GreedyLinear: code-reference/detection/greedylinear-reference.md
# - Omp: code-reference/detection/omp-reference.md
# - OmpK: code-reference/detection/ompk-reference.md
- Cost functions:
- 'CostL1': code-reference/costs/costl1-reference.md
- 'CostL2': code-reference/costs/costl2-reference.md
Expand Down
Loading

0 comments on commit 577ea32

Please # to comment.