From 441828dc3a6dc47c549eacbdef058f593b18d438 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 11:49:22 +0000 Subject: [PATCH 01/22] update contributing --- .github/workflows/arviz_compat.yml | 11 +++++++-- .github/workflows/pytest.yml | 7 +++++- CONTRIBUTING.md | 37 +++++++++++------------------- environment-dev.yml | 15 ------------ 4 files changed, 28 insertions(+), 42 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index af5b31d5ee..49eb1ffb12 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -38,8 +38,15 @@ jobs: channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - - run: | + - name: Install pymc3 + run: | conda activate testenv - conda remove arviz -y + pip install -e . + - name: Install latest arviz + run: | + conda activate testenv + pip uninstall 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 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 1d88c2cd4d..92951235d4 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -78,7 +78,12 @@ jobs: channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - - run: | + - name: Install-pymc3 + run: | + conda activate testenv + pip install -e . + - name: Run tests + run: | conda activate testenv python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET - name: Upload coverage to Codecov diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b905f6a30..c581369c9d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 + $ conda env create -f environment-dev.yml + $ conda activate testenv + $ pip install -e . + ``` + + _Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run: ```bash - $ pip install -r requirements.txt + $ 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/.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 diff --git a/environment-dev.yml b/environment-dev.yml index c4ea7693cb..b968620b60 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -13,24 +13,9 @@ dependencies: - 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 From 34ea30806d4e9725444b3074e63ce6376597d852 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 12:20:56 +0000 Subject: [PATCH 02/22] rename --- .github/workflows/arviz_compat.yml | 6 +++--- .github/workflows/pytest.yml | 6 +++--- CONTRIBUTING.md | 2 +- environment-dev.yml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index 49eb1ffb12..d67a461399 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -34,17 +34,17 @@ jobs: hashFiles('environment-dev.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: testenv + activate-environment: pymc3-dev channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - name: Install pymc3 run: | - conda activate testenv + conda activate pymc3-dev pip install -e . - name: Install latest arviz run: | - conda activate testenv + conda activate pymc3-dev pip uninstall arviz -y pip install git+git://github.com/arviz-devs/arviz.git - name: Run tests diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 92951235d4..6c34b91299 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -74,17 +74,17 @@ jobs: hashFiles('environment-dev.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: testenv + activate-environment: pymc3-dev channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - name: Install-pymc3 run: | - conda activate testenv + conda activate pymc3-dev pip install -e . - name: Run tests run: | - conda activate testenv + conda activate pymc3-dev 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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c581369c9d..67d9d50d19 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito ```bash $ conda env create -f environment-dev.yml - $ conda activate testenv + $ conda activate pymc3-dev $ pip install -e . ``` diff --git a/environment-dev.yml b/environment-dev.yml index b968620b60..7d3edf1ad0 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -1,4 +1,4 @@ -name: testenv +name: pymc3-dev channels: - conda-forge - defaults From 98a88a3f464be3f76a0f09e69ee15d69f710deef Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 12:29:58 +0000 Subject: [PATCH 03/22] put watermark back in (minimal impact anyway) --- environment-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment-dev.yml b/environment-dev.yml index 7d3edf1ad0..ccdf586110 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -21,3 +21,4 @@ dependencies: - mkl-service - dill - libblas=*=*mkl + - watermark From d9d9bf079416abdae3e0221e7eb2eb30b0148404 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 13:19:16 +0000 Subject: [PATCH 04/22] keep graphviz in --- environment-dev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment-dev.yml b/environment-dev.yml index ccdf586110..611d7b745e 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -13,12 +13,13 @@ dependencies: - fastprogress>=0.2 - h5py>=2.7 - typing-extensions>=3.7 + - python-graphviz - ipython>=7.16 - pytest-cov>=2.5 - pytest>=3.0 + - watermark - dataclasses # python_version < 3.7 - contextvars # python_version < 3.7 - mkl-service - dill - libblas=*=*mkl - - watermark From 1f772c239dfcd8bf7dd77d04ce7f8ac9a81dff73 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 13:24:56 +0000 Subject: [PATCH 05/22] failfast --- .github/workflows/arviz_compat.yml | 1 + .github/workflows/pytest.yml | 1 + pymc3/tests/test_sampling.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index d67a461399..c1b0091ad8 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -14,6 +14,7 @@ jobs: floatx: [float64] test-subset: - pymc3/tests/test_sampling.py + fail-fast: false runs-on: ${{ matrix.os }} env: TEST_SUBSET: ${{ matrix.test-subset }} diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 6c34b91299..ddd31c787b 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -54,6 +54,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 }} diff --git a/pymc3/tests/test_sampling.py b/pymc3/tests/test_sampling.py index 2185542f17..5b9c452bab 100644 --- a/pymc3/tests/test_sampling.py +++ b/pymc3/tests/test_sampling.py @@ -30,6 +30,10 @@ import pytest +def test_failure(): + raise + + @pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32") @pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32") class TestSample(SeededTest): From aea778ea4252324f5865fb338c9227fcd64e0c6d Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 13:58:20 +0000 Subject: [PATCH 06/22] add failing test --- CONTRIBUTING.md | 3 ++- environment-dev.yml | 1 - pymc3/tests/test_examples.py | 1 + pymc3/tests/test_sampling.py | 4 ---- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 67d9d50d19..a5120641d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,8 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito 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 - $ conda env create -f environment-dev.yml + $ conda create -n pymc3-dev python=3.6 # check setup.py for which versions of Python you can use + $ conda env update -f environment-dev.yml $ conda activate pymc3-dev $ pip install -e . ``` diff --git a/environment-dev.yml b/environment-dev.yml index 611d7b745e..1f2cbb686e 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -3,7 +3,6 @@ channels: - conda-forge - defaults dependencies: - - python>=3.6 - arviz>=0.9 - theano-pymc==1.0.11 - numpy>=1.13 diff --git a/pymc3/tests/test_examples.py b/pymc3/tests/test_examples.py index d31b2bfd3a..69aa1db585 100644 --- a/pymc3/tests/test_examples.py +++ b/pymc3/tests/test_examples.py @@ -70,6 +70,7 @@ def build_model(self): return model def test_run(self): + 1 / 0 model = self.build_model() with model: pm.sample(50, tune=50) diff --git a/pymc3/tests/test_sampling.py b/pymc3/tests/test_sampling.py index 5b9c452bab..2185542f17 100644 --- a/pymc3/tests/test_sampling.py +++ b/pymc3/tests/test_sampling.py @@ -30,10 +30,6 @@ import pytest -def test_failure(): - raise - - @pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32") @pytest.mark.xfail(condition=(theano.config.floatX == "float32"), reason="Fails on float32") class TestSample(SeededTest): From 116e993ce08431bd4ba342319fa188518d5a06fa Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 14:18:16 +0000 Subject: [PATCH 07/22] fail fast --- .github/workflows/pytest.yml | 2 +- CONTRIBUTING.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ddd31c787b..10d06322fc 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -86,7 +86,7 @@ jobs: - name: Run tests run: | conda activate pymc3-dev - python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET + python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET -x - name: Upload coverage to Codecov uses: codecov/codecov-action@v1 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5120641d4..20b4ff081f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,6 +47,7 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito ```bash $ conda create -n pymc3-dev python=3.6 # check setup.py for which versions of Python you can use + $ conda activate pymc3-dev $ conda env update -f environment-dev.yml $ conda activate pymc3-dev $ pip install -e . From 11a048b245f2726cbd4d8a54fef58c6beeb1e714 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 14:27:58 +0000 Subject: [PATCH 08/22] don't fail a test on purpose --- pymc3/tests/test_examples.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pymc3/tests/test_examples.py b/pymc3/tests/test_examples.py index 69aa1db585..d31b2bfd3a 100644 --- a/pymc3/tests/test_examples.py +++ b/pymc3/tests/test_examples.py @@ -70,7 +70,6 @@ def build_model(self): return model def test_run(self): - 1 / 0 model = self.build_model() with model: pm.sample(50, tune=50) From fe9350ba70724e0b5c451c732524a4a138144e98 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 14:30:22 +0000 Subject: [PATCH 09/22] indent --- CONTRIBUTING.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 20b4ff081f..4d2f706003 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,13 +45,13 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito 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 - $ conda create -n pymc3-dev python=3.6 # check setup.py for which versions of Python you can use - $ conda activate pymc3-dev - $ conda env update -f environment-dev.yml - $ conda activate pymc3-dev - $ pip install -e . - ``` + ```bash + $ conda create -n pymc3-dev python=3.6 # check setup.py for which versions of Python you can use + $ conda activate pymc3-dev + $ conda env update -f environment-dev.yml + $ conda activate pymc3-dev + $ pip install -e . + ``` _Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run: From 64712989f6b2bb947bb531c57350e84927e7e22f Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 14:31:12 +0000 Subject: [PATCH 10/22] indent --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4d2f706003..e123b706bb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,14 +53,14 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito $ pip install -e . ``` - _Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run: + _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 ``` - Yet another alternative is 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: From f7db5dfd36f411ad09dcfc9183dff9f391ca6779 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 14:59:35 +0000 Subject: [PATCH 11/22] remove -x --- .github/workflows/pytest.yml | 2 +- environment-dev.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 10d06322fc..ddd31c787b 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -86,7 +86,7 @@ jobs: - name: Run tests run: | conda activate pymc3-dev - python -m pytest -vv --cov=pymc3 --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET -x + 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 with: diff --git a/environment-dev.yml b/environment-dev.yml index 1f2cbb686e..8d6b3618a3 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -8,7 +8,6 @@ dependencies: - numpy>=1.13 - scipy>=0.18 - pandas >=0.18 - - patsy>=0.5 - fastprogress>=0.2 - h5py>=2.7 - typing-extensions>=3.7 From ad6ffbaf31939a60828a64d06c948c2fcf69ee6d Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 15:00:22 +0000 Subject: [PATCH 12/22] remove arviz with conda --- .github/workflows/arviz_compat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index c1b0091ad8..5f697f56f9 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -46,7 +46,7 @@ jobs: - name: Install latest arviz run: | conda activate pymc3-dev - pip uninstall arviz -y + conda remove arviz -y pip install git+git://github.com/arviz-devs/arviz.git - name: Run tests run: | From 6fe30d003e3652f565bde01d24dfc5929c7ab0d0 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 15:01:35 +0000 Subject: [PATCH 13/22] dont remove patsy --- environment-dev.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/environment-dev.yml b/environment-dev.yml index 8d6b3618a3..1f2cbb686e 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -8,6 +8,7 @@ dependencies: - numpy>=1.13 - scipy>=0.18 - pandas >=0.18 + - patsy>=0.5 - fastprogress>=0.2 - h5py>=2.7 - typing-extensions>=3.7 From df6bd8675d04fb8adb9f3c4788ae96a729decc51 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 15:24:29 +0000 Subject: [PATCH 14/22] try using python version correctly --- .github/workflows/arviz_compat.yml | 2 ++ .github/workflows/pytest.yml | 3 +++ CONTRIBUTING.md | 12 ++++++++++++ environment-dev.yml | 2 -- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index 5f697f56f9..ec6e9ec053 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -39,10 +39,12 @@ jobs: channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + python-version: ${{ matrix.python-version }} - name: Install pymc3 run: | conda activate pymc3-dev pip install -e . + python --version - name: Install latest arviz run: | conda activate pymc3-dev diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ddd31c787b..8bfe1ce5a9 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -79,10 +79,13 @@ jobs: channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + python-version: ${{ matrix.python-version }} - name: Install-pymc3 run: | conda activate pymc3-dev + conda install -c conda-forge dataclasses contextvars pip install -e . + python --version - name: Run tests run: | conda activate pymc3-dev diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e123b706bb..1c39450114 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -53,6 +53,12 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito $ pip install -e . ``` + If you use Python3.6, you will also need to install `dataclasses` and `contextvars`: + + ```bash + conda install -c conda-forge dataclasses contextvars + ``` + _Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run: ```bash @@ -60,6 +66,12 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito $ pip install -r requirements-dev.txt ``` + If you use Python3.6, you will still need to install `dataclasses` and `contextvars`: + + ```bash + pip install dataclasses contextvars + ``` + 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: diff --git a/environment-dev.yml b/environment-dev.yml index 1f2cbb686e..888ab86085 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -17,8 +17,6 @@ dependencies: - pytest-cov>=2.5 - pytest>=3.0 - watermark - - dataclasses # python_version < 3.7 - - contextvars # python_version < 3.7 - mkl-service - dill - libblas=*=*mkl From 337d43909737800a97db87c2a1e70d1db8cf9118 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 16:00:42 +0000 Subject: [PATCH 15/22] move non-theano non-optional dependencies out of environment-dev.yml --- .github/workflows/arviz_compat.yml | 1 + .github/workflows/pytest.yml | 3 ++- environment-dev.yml | 7 ------- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index ec6e9ec053..62f0337144 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -35,6 +35,7 @@ jobs: hashFiles('environment-dev.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: + auto-update-conda: true activate-environment: pymc3-dev channel-priority: strict environment-file: environment-dev.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 8bfe1ce5a9..4401df6284 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -75,6 +75,7 @@ jobs: hashFiles('environment-dev.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: + auto-update-conda: true activate-environment: pymc3-dev channel-priority: strict environment-file: environment-dev.yml @@ -83,7 +84,7 @@ jobs: - name: Install-pymc3 run: | conda activate pymc3-dev - conda install -c conda-forge dataclasses contextvars + pip install dataclasses contextvars pip install -e . python --version - name: Run tests diff --git a/environment-dev.yml b/environment-dev.yml index 888ab86085..a4a4b449b4 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -3,20 +3,13 @@ channels: - conda-forge - defaults dependencies: - - 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 - pytest-cov>=2.5 - pytest>=3.0 - watermark - mkl-service - - dill - libblas=*=*mkl From c895d32a909dcafb590ddde31a992e8a9c5391da Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 16:14:07 +0000 Subject: [PATCH 16/22] keep python in environment-dev.yml, that's a separate issue --- .github/workflows/arviz_compat.yml | 4 ---- .github/workflows/pytest.yml | 5 ----- CONTRIBUTING.md | 16 +--------------- environment-dev.yml | 11 ++++++++++- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index 62f0337144..99bbe970bf 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -9,7 +9,6 @@ jobs: pytest: strategy: matrix: - python-version: ["3.8"] os: [ubuntu-18.04] floatx: [float64] test-subset: @@ -35,17 +34,14 @@ jobs: hashFiles('environment-dev.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: - auto-update-conda: true activate-environment: pymc3-dev channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - python-version: ${{ matrix.python-version }} - name: Install pymc3 run: | conda activate pymc3-dev pip install -e . - python --version - name: Install latest arviz run: | conda activate pymc3-dev diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 4401df6284..afc7d66b12 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -9,7 +9,6 @@ jobs: pytest: strategy: matrix: - python-version: ["3.6"] os: [ubuntu-18.04] floatx: [float32, float64] test-subset: @@ -75,18 +74,14 @@ jobs: hashFiles('environment-dev.yml') }} - uses: conda-incubator/setup-miniconda@v2 with: - auto-update-conda: true activate-environment: pymc3-dev channel-priority: strict environment-file: environment-dev.yml use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - python-version: ${{ matrix.python-version }} - name: Install-pymc3 run: | conda activate pymc3-dev - pip install dataclasses contextvars pip install -e . - python --version - name: Run tests run: | conda activate pymc3-dev diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1c39450114..f3017dcfa1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,19 +46,11 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito 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 - $ conda create -n pymc3-dev python=3.6 # check setup.py for which versions of Python you can use - $ conda activate pymc3-dev - $ conda env update -f environment-dev.yml + $ conda env create -f environment-dev.yml $ conda activate pymc3-dev $ pip install -e . ``` - If you use Python3.6, you will also need to install `dataclasses` and `contextvars`: - - ```bash - conda install -c conda-forge dataclasses contextvars - ``` - _Alternatively_ you may (probably in a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/)) run: ```bash @@ -66,12 +58,6 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito $ pip install -r requirements-dev.txt ``` - If you use Python3.6, you will still need to install `dataclasses` and `contextvars`: - - ```bash - pip install dataclasses contextvars - ``` - 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: diff --git a/environment-dev.yml b/environment-dev.yml index a4a4b449b4..9d78f31b3c 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -3,13 +3,22 @@ channels: - conda-forge - defaults dependencies: + - python3.6 + - arviz>=0.9 - theano-pymc==1.0.11 - - patsy>=0.5 + - numpy>=1.13 + - scipy>=0.18 + - pandas >=0.18 + - fastprogress>=0.2 - h5py>=2.7 + - typing-extensions>=3.7 - python-graphviz - ipython>=7.16 - pytest-cov>=2.5 - pytest>=3.0 - watermark + - dataclasses # python_version < 3.7 + - contextvars # python_version < 3.7 - mkl-service + - dill - libblas=*=*mkl From eb4749551fa6c2990e8ac982c46ecb99ab2bf936 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 16:16:03 +0000 Subject: [PATCH 17/22] typo --- environment-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment-dev.yml b/environment-dev.yml index 9d78f31b3c..8e8edc2ef0 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -3,7 +3,7 @@ channels: - conda-forge - defaults dependencies: - - python3.6 + - python=3.6 - arviz>=0.9 - theano-pymc==1.0.11 - numpy>=1.13 From d7bf529126e9576c47e4b25409ce387003d50834 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Mon, 30 Nov 2020 16:43:59 +0000 Subject: [PATCH 18/22] put patsy back; final commit? --- environment-dev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/environment-dev.yml b/environment-dev.yml index 8e8edc2ef0..c78b1460af 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -8,7 +8,8 @@ dependencies: - 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 From abe5c3f15f9a32113fc71dc16608d166bbc70ae4 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Tue, 1 Dec 2020 09:20:09 +0000 Subject: [PATCH 19/22] make separate env files --- .github/workflows/arviz_compat.yml | 13 ++++++------ .github/workflows/pytest.yml | 12 +++++------ conda-envs/environment-dev-py36.yml | 31 +++++++++++++++++++++++++++++ conda-envs/environment-dev-py37.yml | 29 +++++++++++++++++++++++++++ conda-envs/environment-dev-py38.yml | 29 +++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 conda-envs/environment-dev-py36.yml create mode 100644 conda-envs/environment-dev-py37.yml create mode 100644 conda-envs/environment-dev-py38.yml diff --git a/.github/workflows/arviz_compat.yml b/.github/workflows/arviz_compat.yml index 99bbe970bf..be5450e003 100644 --- a/.github/workflows/arviz_compat.yml +++ b/.github/workflows/arviz_compat.yml @@ -26,25 +26,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-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: pymc3-dev + 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! - name: Install pymc3 run: | - conda activate pymc3-dev + conda activate pymc3-dev-py38 pip install -e . + python --version - name: Install latest arviz run: | - conda activate pymc3-dev + conda activate pymc3-dev-py38 conda remove arviz -y pip install git+git://github.com/arviz-devs/arviz.git - name: Run tests diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index afc7d66b12..5e7866abac 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -66,25 +66,25 @@ 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: pymc3-dev + 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! - name: Install-pymc3 run: | - conda activate pymc3-dev + conda activate pymc3-dev-py36 pip install -e . - name: Run tests run: | - conda activate pymc3-dev + 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 diff --git a/conda-envs/environment-dev-py36.yml b/conda-envs/environment-dev-py36.yml new file mode 100644 index 0000000000..77c11267a2 --- /dev/null +++ b/conda-envs/environment-dev-py36.yml @@ -0,0 +1,31 @@ +name: pymc3-dev-py36 +channels: + - conda-forge + - defaults +dependencies: + - python=3.6 + - 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 + - dataclasses # python_version < 3.7 + - contextvars # python_version < 3.7 + - mkl-service + - dill + - libblas=*=*mkl diff --git a/conda-envs/environment-dev-py37.yml b/conda-envs/environment-dev-py37.yml new file mode 100644 index 0000000000..17bd6a90a1 --- /dev/null +++ b/conda-envs/environment-dev-py37.yml @@ -0,0 +1,29 @@ +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 diff --git a/conda-envs/environment-dev-py38.yml b/conda-envs/environment-dev-py38.yml new file mode 100644 index 0000000000..2eac820ced --- /dev/null +++ b/conda-envs/environment-dev-py38.yml @@ -0,0 +1,29 @@ +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 From 72f8e08b6b1c6a3f7d1ac87774d4b939fabc63c6 Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Tue, 1 Dec 2020 09:23:03 +0000 Subject: [PATCH 20/22] show python version --- .github/workflows/pytest.yml | 1 + CONTRIBUTING.md | 2 +- environment-dev.yml | 25 ------------------------- 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 environment-dev.yml diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 5e7866abac..5a7433e428 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -82,6 +82,7 @@ jobs: run: | conda activate pymc3-dev-py36 pip install -e . + python --version - name: Run tests run: | conda activate pymc3-dev-py36 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f3017dcfa1..9d77bbaf21 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,7 +46,7 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito 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 - $ conda env create -f environment-dev.yml + $ conda env create -f conda-envs/environment-dev-py36.yml # or py37 or py38 $ conda activate pymc3-dev $ pip install -e . ``` diff --git a/environment-dev.yml b/environment-dev.yml deleted file mode 100644 index c78b1460af..0000000000 --- a/environment-dev.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: pymc3-dev -channels: - - conda-forge - - defaults -dependencies: - - python=3.6 - - 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 - - pytest-cov>=2.5 - - pytest>=3.0 - - watermark - - dataclasses # python_version < 3.7 - - contextvars # python_version < 3.7 - - mkl-service - - dill - - libblas=*=*mkl From f4cd31941afd1d5cb133fdbd9398a1f601c4d8cb Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Tue, 1 Dec 2020 09:37:54 +0000 Subject: [PATCH 21/22] update env name in contributing.md --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d77bbaf21..05173c1e97 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ The preferred workflow for contributing to PyMC3 is to fork the [GitHub reposito ```bash $ conda env create -f conda-envs/environment-dev-py36.yml # or py37 or py38 - $ conda activate pymc3-dev + $ conda activate pymc3-dev-py36 $ pip install -e . ``` From 9ada7167efbbfbcad39e01241ec6864326d3116f Mon Sep 17 00:00:00 2001 From: MarcoGorelli Date: Tue, 1 Dec 2020 10:14:16 +0000 Subject: [PATCH 22/22] redistribute tests --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 5a7433e428..eeeb5c322f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -35,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 @@ -46,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