Skip to content

Commit 7ff2f49

Browse files
authored
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
1 parent 162fd92 commit 7ff2f49

File tree

6 files changed

+103
-49
lines changed

6 files changed

+103
-49
lines changed

.github/workflows/arviz_compat.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
pytest:
1010
strategy:
1111
matrix:
12-
python-version: ["3.8"]
1312
os: [ubuntu-18.04]
1413
floatx: [float64]
1514
test-subset:
1615
- pymc3/tests/test_sampling.py
16+
fail-fast: false
1717
runs-on: ${{ matrix.os }}
1818
env:
1919
TEST_SUBSET: ${{ matrix.test-subset }}
@@ -26,20 +26,28 @@ jobs:
2626
- name: Cache conda
2727
uses: actions/cache@v1
2828
env:
29-
# Increase this value to reset cache if environment-dev.yml has not changed
29+
# Increase this value to reset cache if environment-dev-py38.yml has not changed
3030
CACHE_NUMBER: 0
3131
with:
3232
path: ~/conda_pkgs_dir
3333
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
34-
hashFiles('environment-dev.yml') }}
34+
hashFiles('conda-envs/environment-dev-py38.yml') }}
3535
- uses: conda-incubator/setup-miniconda@v2
3636
with:
37-
activate-environment: testenv
37+
activate-environment: pymc3-dev-py38
3838
channel-priority: strict
39-
environment-file: environment-dev.yml
39+
environment-file: conda-envs/environment-dev-py38.yml
4040
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
41-
- run: |
42-
conda activate testenv
41+
- name: Install pymc3
42+
run: |
43+
conda activate pymc3-dev-py38
44+
pip install -e .
45+
python --version
46+
- name: Install latest arviz
47+
run: |
48+
conda activate pymc3-dev-py38
4349
conda remove arviz -y
4450
pip install git+git://github.com/arviz-devs/arviz.git
51+
- name: Run tests
52+
run: |
4553
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET

.github/workflows/pytest.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ jobs:
99
pytest:
1010
strategy:
1111
matrix:
12-
python-version: ["3.6"]
1312
os: [ubuntu-18.04]
1413
floatx: [float32, float64]
1514
test-subset:
@@ -36,7 +35,6 @@ jobs:
3635
pymc3/tests/test_dist_math.py
3736
pymc3/tests/test_distribution_defaults.py
3837
pymc3/tests/test_distributions_random.py
39-
pymc3/tests/test_distributions_timeseries.py
4038
pymc3/tests/test_parallel_sampling.py
4139
pymc3/tests/test_random.py
4240
pymc3/tests/test_shared.py
@@ -47,13 +45,15 @@ jobs:
4745
pymc3/tests/test_posteriors.py
4846
pymc3/tests/test_quadpotential.py
4947
- |
48+
pymc3/tests/test_distributions_timeseries.py
5049
pymc3/tests/test_shape_handling.py
5150
pymc3/tests/test_updates.py
5251
pymc3/tests/test_variational_inference.py
5352
- |
5453
pymc3/tests/test_distributions.py
5554
pymc3/tests/test_gp.py
5655
pymc3/tests/test_sampling.py
56+
fail-fast: false
5757
runs-on: ${{ matrix.os }}
5858
env:
5959
TEST_SUBSET: ${{ matrix.test-subset }}
@@ -66,20 +66,26 @@ jobs:
6666
- name: Cache conda
6767
uses: actions/cache@v1
6868
env:
69-
# Increase this value to reset cache if environment-dev.yml has not changed
69+
# Increase this value to reset cache if environment-dev-py36.yml has not changed
7070
CACHE_NUMBER: 0
7171
with:
7272
path: ~/conda_pkgs_dir
7373
key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{
74-
hashFiles('environment-dev.yml') }}
74+
hashFiles('conda-envs/environment-dev-py36.yml') }}
7575
- uses: conda-incubator/setup-miniconda@v2
7676
with:
77-
activate-environment: testenv
77+
activate-environment: pymc3-dev-py36
7878
channel-priority: strict
79-
environment-file: environment-dev.yml
79+
environment-file: conda-envs/environment-dev-py36.yml
8080
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
81-
- run: |
82-
conda activate testenv
81+
- name: Install-pymc3
82+
run: |
83+
conda activate pymc3-dev-py36
84+
pip install -e .
85+
python --version
86+
- name: Run tests
87+
run: |
88+
conda activate pymc3-dev-py36
8389
python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET
8490
- name: Upload coverage to Codecov
8591
uses: codecov/codecov-action@v1

CONTRIBUTING.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,27 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito
3838
3. Create a ``feature`` branch to hold your development changes:
3939

4040
```bash
41-
$ git checkout -b my-feature
41+
$ git switch -c my-feature
4242
```
4343

4444
Always use a ``feature`` branch. It's good practice to never routinely work on the ``master`` branch of any repository.
4545

46-
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:
46+
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):
4747

4848
```bash
49-
$ pip install -r requirements.txt
49+
$ conda env create -f conda-envs/environment-dev-py36.yml # or py37 or py38
50+
$ conda activate pymc3-dev-py36
51+
$ pip install -e .
52+
```
53+
54+
_Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run:
55+
56+
```bash
57+
$ pip install -e .
5058
$ pip install -r requirements-dev.txt
5159
```
5260

53-
Alternatively, there is a script to create a docker environment for development. See: [Developing in Docker](#Developing-in-Docker).
61+
Yet another alternative is to create a docker environment for development. See: [Developing in Docker](#Developing-in-Docker).
5462

5563
5. Develop the feature on your feature branch. Add changed files using ``git add`` and then ``git commit`` files:
5664

@@ -103,26 +111,7 @@ tools:
103111
$ pytest --cov=pymc3 pymc3/tests/<name of test>.py
104112
```
105113

106-
* No `pyflakes` warnings, check with:
107-
108-
```bash
109-
$ pip install pyflakes
110-
$ pyflakes path/to/module.py
111-
```
112-
113-
* No PEP8 warnings, check with:
114-
115-
```bash
116-
$ pip install pycodestyle
117-
$ pycodestyle path/to/module.py
118-
```
119-
120-
* AutoPEP8 can help you fix some of the easy redundant errors:
121-
122-
```bash
123-
$ pip install autopep8
124-
$ autopep8 path/to/pep8.py
125-
```
114+
* 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.
126115

127116
## Developing in Docker
128117

environment-dev.yml renamed to conda-envs/environment-dev-py36.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
1-
name: testenv
1+
name: pymc3-dev-py36
22
channels:
33
- conda-forge
44
- defaults
55
dependencies:
6-
- python>=3.6
6+
- python=3.6
77
- arviz>=0.9
88
- theano-pymc==1.0.11
99
- numpy>=1.13
1010
- scipy>=0.18
11-
- pandas >=0.18
11+
- pandas>=0.18
1212
- patsy>=0.5
1313
- fastprogress>=0.2
1414
- h5py>=2.7
1515
- typing-extensions>=3.7
16-
- bokeh>=0.12
17-
- coverage>=5.1
1816
- python-graphviz
1917
- ipython>=7.16
2018
- nbsphinx>=0.4
21-
- nose>=1.3
22-
- nose-parameterized>=0.6
2319
- numpydoc>=0.9
2420
- pre-commit>=2.8.0
2521
- pytest-cov>=2.5
2622
- pytest>=3.0
2723
- recommonmark>=0.4
28-
- seaborn>=0.8
2924
- sphinx-autobuild>=0.7
3025
- sphinx>=1.5
3126
- watermark
32-
- parameterized
33-
- ipywidgets
3427
- dataclasses # python_version < 3.7
3528
- contextvars # python_version < 3.7
3629
- mkl-service

conda-envs/environment-dev-py37.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: pymc3-dev-py37
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- python=3.7
7+
- arviz>=0.9
8+
- theano-pymc==1.0.11
9+
- numpy>=1.13
10+
- scipy>=0.18
11+
- pandas>=0.18
12+
- patsy>=0.5
13+
- fastprogress>=0.2
14+
- h5py>=2.7
15+
- typing-extensions>=3.7
16+
- python-graphviz
17+
- ipython>=7.16
18+
- nbsphinx>=0.4
19+
- numpydoc>=0.9
20+
- pre-commit>=2.8.0
21+
- pytest-cov>=2.5
22+
- pytest>=3.0
23+
- recommonmark>=0.4
24+
- sphinx-autobuild>=0.7
25+
- sphinx>=1.5
26+
- watermark
27+
- mkl-service
28+
- dill
29+
- libblas=*=*mkl

conda-envs/environment-dev-py38.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: pymc3-dev-py38
2+
channels:
3+
- conda-forge
4+
- defaults
5+
dependencies:
6+
- python=3.8
7+
- arviz>=0.9
8+
- theano-pymc==1.0.11
9+
- numpy>=1.13
10+
- scipy>=0.18
11+
- pandas>=0.18
12+
- patsy>=0.5
13+
- fastprogress>=0.2
14+
- h5py>=2.7
15+
- typing-extensions>=3.7
16+
- python-graphviz
17+
- ipython>=7.16
18+
- nbsphinx>=0.4
19+
- numpydoc>=0.9
20+
- pre-commit>=2.8.0
21+
- pytest-cov>=2.5
22+
- pytest>=3.0
23+
- recommonmark>=0.4
24+
- sphinx-autobuild>=0.7
25+
- sphinx>=1.5
26+
- watermark
27+
- mkl-service
28+
- dill
29+
- libblas=*=*mkl

0 commit comments

Comments
 (0)