Unverified Commit 7ff2f499 authored by Marco Gorelli's avatar Marco Gorelli Committed by GitHub

Update contributing guide, fail fast (#4280)

* update contributing

* rename

* put watermark back in (minimal impact anyway)

* keep graphviz in

* failfast

* add failing test

* fail fast

* don't fail a test on purpose

* indent

* indent

* remove -x

* remove arviz with conda

* dont remove patsy

* try using python version correctly

* move non-theano non-optional dependencies out of environment-dev.yml

* keep python in environment-dev.yml, that's a separate issue

* typo

* put patsy back; final commit?

* make separate env files

* show python version

* update env name in contributing.md

* redistribute tests
parent 162fd92d
......@@ -9,11 +9,11 @@ jobs:
pytest:
strategy:
matrix:
python-version: ["3.8"]
os: [ubuntu-18.04]
floatx: [float64]
test-subset:
- pymc3/tests/test_sampling.py
fail-fast: false
runs-on: ${{ matrix.os }}
env:
TEST_SUBSET: ${{ matrix.test-subset }}
......@@ -26,20 +26,28 @@ jobs:
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if environment-dev.yml has not changed
# Increase this value to reset cache if environment-dev-py38.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('environment-dev.yml') }}
hashFiles('conda-envs/environment-dev-py38.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: testenv
activate-environment: pymc3-dev-py38
channel-priority: strict
environment-file: environment-dev.yml
environment-file: conda-envs/environment-dev-py38.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- run: |
conda activate testenv
- name: Install pymc3
run: |
conda activate pymc3-dev-py38
pip install -e .
python --version
- name: Install latest arviz
run: |
conda activate pymc3-dev-py38
conda remove arviz -y
pip install git+git://github.com/arviz-devs/arviz.git
- name: Run tests
run: |
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
......@@ -9,7 +9,6 @@ jobs:
pytest:
strategy:
matrix:
python-version: ["3.6"]
os: [ubuntu-18.04]
floatx: [float32, float64]
test-subset:
......@@ -36,7 +35,6 @@ jobs:
pymc3/tests/test_dist_math.py
pymc3/tests/test_distribution_defaults.py
pymc3/tests/test_distributions_random.py
pymc3/tests/test_distributions_timeseries.py
pymc3/tests/test_parallel_sampling.py
pymc3/tests/test_random.py
pymc3/tests/test_shared.py
......@@ -47,6 +45,7 @@ jobs:
pymc3/tests/test_posteriors.py
pymc3/tests/test_quadpotential.py
- |
pymc3/tests/test_distributions_timeseries.py
pymc3/tests/test_shape_handling.py
pymc3/tests/test_updates.py
pymc3/tests/test_variational_inference.py
......@@ -54,6 +53,7 @@ jobs:
pymc3/tests/test_distributions.py
pymc3/tests/test_gp.py
pymc3/tests/test_sampling.py
fail-fast: false
runs-on: ${{ matrix.os }}
env:
TEST_SUBSET: ${{ matrix.test-subset }}
......@@ -66,20 +66,26 @@ jobs:
- name: Cache conda
uses: actions/cache@v1
env:
# Increase this value to reset cache if environment-dev.yml has not changed
# Increase this value to reset cache if environment-dev-py36.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
hashFiles('environment-dev.yml') }}
hashFiles('conda-envs/environment-dev-py36.yml') }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: testenv
activate-environment: pymc3-dev-py36
channel-priority: strict
environment-file: environment-dev.yml
environment-file: conda-envs/environment-dev-py36.yml
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- run: |
conda activate testenv
- name: Install-pymc3
run: |
conda activate pymc3-dev-py36
pip install -e .
python --version
- name: Run tests
run: |
conda activate pymc3-dev-py36
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
......
......@@ -38,19 +38,27 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito
3. Create a ``feature`` branch to hold your development changes:
```bash
$ git checkout -b my-feature
$ git switch -c my-feature
```
Always use a ``feature`` branch. It's good practice to never routinely work on the ``master`` branch of any repository.
4. Project requirements are in ``requirements.txt``, and libraries used for development are in ``requirements-dev.txt``. To set up a development environment, you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run:
4. Project requirements are in ``requirements.txt``, and libraries used for development are in ``requirements-dev.txt``. The easiest (and recommended) way to set up a development environment is via [miniconda](https://docs.conda.io/en/latest/miniconda.html):
```bash
$ pip install -r requirements.txt
$ conda env create -f conda-envs/environment-dev-py36.yml # or py37 or py38
$ conda activate pymc3-dev-py36
$ pip install -e .
```
_Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run:
```bash
$ pip install -e .
$ pip install -r requirements-dev.txt
```
Alternatively, there is a script to create a docker environment for development. See: [Developing in Docker](#Developing-in-Docker).
Yet another alternative is to create a docker environment for development. See: [Developing in Docker](#Developing-in-Docker).
5. Develop the feature on your feature branch. Add changed files using ``git add`` and then ``git commit`` files:
......@@ -103,26 +111,7 @@ tools:
$ pytest --cov=pymc3 pymc3/tests/<name of test>.py
```
* No `pyflakes` warnings, check with:
```bash
$ pip install pyflakes
$ pyflakes path/to/module.py
```
* No PEP8 warnings, check with:
```bash
$ pip install pycodestyle
$ pycodestyle path/to/module.py
```
* AutoPEP8 can help you fix some of the easy redundant errors:
```bash
$ pip install autopep8
$ autopep8 path/to/pep8.py
```
* No `pre-commit` errors: see the [Python code style](https://github.com/pymc-devs/pymc3/wiki/PyMC3-Python-Code-Style) and [Jupyter Notebook style](https://github.com/pymc-devs/pymc3/wiki/PyMC's-Jupyter-Notebook-Style) page from our Wiki on how to install and run it.
## Developing in Docker
......
name: testenv
name: pymc3-dev-py36
channels:
- conda-forge
- defaults
dependencies:
- python>=3.6
- python=3.6
- arviz>=0.9
- theano-pymc==1.0.11
- numpy>=1.13
- scipy>=0.18
- pandas >=0.18
- pandas>=0.18
- patsy>=0.5
- fastprogress>=0.2
- h5py>=2.7
- typing-extensions>=3.7
- bokeh>=0.12
- coverage>=5.1
- python-graphviz
- ipython>=7.16
- nbsphinx>=0.4
- nose>=1.3
- nose-parameterized>=0.6
- numpydoc>=0.9
- pre-commit>=2.8.0
- pytest-cov>=2.5
- pytest>=3.0
- recommonmark>=0.4
- seaborn>=0.8
- sphinx-autobuild>=0.7
- sphinx>=1.5
- watermark
- parameterized
- ipywidgets
- dataclasses # python_version < 3.7
- contextvars # python_version < 3.7
- mkl-service
......
name: pymc3-dev-py37
channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- arviz>=0.9
- theano-pymc==1.0.11
- numpy>=1.13
- scipy>=0.18
- pandas>=0.18
- patsy>=0.5
- fastprogress>=0.2
- h5py>=2.7
- typing-extensions>=3.7
- python-graphviz
- ipython>=7.16
- nbsphinx>=0.4
- numpydoc>=0.9
- pre-commit>=2.8.0
- pytest-cov>=2.5
- pytest>=3.0
- recommonmark>=0.4
- sphinx-autobuild>=0.7
- sphinx>=1.5
- watermark
- mkl-service
- dill
- libblas=*=*mkl
name: pymc3-dev-py38
channels:
- conda-forge
- defaults
dependencies:
- python=3.8
- arviz>=0.9
- theano-pymc==1.0.11
- numpy>=1.13
- scipy>=0.18
- pandas>=0.18
- patsy>=0.5
- fastprogress>=0.2
- h5py>=2.7
- typing-extensions>=3.7
- python-graphviz
- ipython>=7.16
- nbsphinx>=0.4
- numpydoc>=0.9
- pre-commit>=2.8.0
- pytest-cov>=2.5
- pytest>=3.0
- recommonmark>=0.4
- sphinx-autobuild>=0.7
- sphinx>=1.5
- watermark
- mkl-service
- dill
- libblas=*=*mkl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment