From dbcc49e60aa92214889f66e657af47bc30952f2f Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Mon, 14 Dec 2020 16:11:18 +0000 Subject: [PATCH] Support Python 3.9, drop Python 3.6 (#4332) * :arrow_up: support py39, drop py36 * :memo: add release note --- .github/workflows/pytest.yml | 12 ++++++------ .pre-commit-config.yaml | 3 ++- CONTRIBUTING.md | 4 ++-- README.rst | 2 +- RELEASE-NOTES.md | 4 +++- ...ronment-dev-py36.yml => environment-dev-py39.yml} | 6 ++---- pymc3/backends/tracetab.py | 2 +- pymc3/data.py | 2 +- pymc3/model.py | 2 +- pyproject.toml | 3 --- requirements.txt | 2 -- setup.py | 4 ++-- 12 files changed, 21 insertions(+), 25 deletions(-) rename conda-envs/{environment-dev-py36.yml => environment-dev-py39.yml} (81%) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 905128ca0f..a4f7eced28 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -70,12 +70,12 @@ jobs: - name: Cache conda uses: actions/cache@v1 env: - # Increase this value to reset cache if environment-dev-py36.yml has not changed + # Increase this value to reset cache if environment-dev-py39.yml has not changed CACHE_NUMBER: 0 with: path: ~/conda_pkgs_dir key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ - hashFiles('conda-envs/environment-dev-py36.yml') }} + hashFiles('conda-envs/environment-dev-py39.yml') }} - name: Cache multiple paths uses: actions/cache@v2 env: @@ -90,18 +90,18 @@ jobs: hashFiles('requirements.txt') }} - uses: conda-incubator/setup-miniconda@v2 with: - activate-environment: pymc3-dev-py36 + activate-environment: pymc3-dev-py39 channel-priority: strict - environment-file: conda-envs/environment-dev-py36.yml + environment-file: conda-envs/environment-dev-py39.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-py36 + conda activate pymc3-dev-py39 pip install -e . python --version - name: Run tests run: | - conda activate pymc3-dev-py36 + conda activate pymc3-dev-py39 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/.pre-commit-config.yaml b/.pre-commit-config.yaml index 803776da37..ba4232796b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,6 +22,7 @@ repos: additional_dependencies: [isort==5.6.4] - id: nbqa-pyupgrade additional_dependencies: [pyupgrade==2.7.4] + args: [--py37-plus] - repo: https://github.com/PyCQA/isort rev: 5.6.4 hooks: @@ -31,7 +32,7 @@ repos: rev: v2.7.4 hooks: - id: pyupgrade - args: [--py36-plus] + args: [--py37-plus] - repo: https://github.com/psf/black rev: 20.8b1 hooks: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d56fc4e8a..335faf1017 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,8 +48,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 conda-envs/environment-dev-py36.yml # or py37 or py38 - $ conda activate pymc3-dev-py36 + $ conda env create -f conda-envs/environment-dev-py37.yml # or py38 or py39 + $ conda activate pymc3-dev-py37 $ pip install -e . ``` diff --git a/README.rst b/README.rst index 70a37dd4f7..f04a618810 100644 --- a/README.rst +++ b/README.rst @@ -120,7 +120,7 @@ Dependencies ============ PyMC3 is tested on Python 3.6, 3.7, and 3.8 and depends on `Theano-PyMC `__, -NumPy, SciPy, and Pandas +NumPy, SciPy, and pandas (see `requirements.txt `__ for version information). diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 2a7b8f5796..8858828c06 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,6 +1,8 @@ # Release Notes -## PyMC3 3.10.1 (on deck) +## PyMC3 4.0.0 (on deck) + +This is the first release to support Python3.9 and to drop Python3.6. ### Maintenance - Fixed bug whereby partial traces returns after keyboard interrupt during parallel sampling had fewer draws than would've been available [#4318](https://github.com/pymc-devs/pymc3/pull/4318) diff --git a/conda-envs/environment-dev-py36.yml b/conda-envs/environment-dev-py39.yml similarity index 81% rename from conda-envs/environment-dev-py36.yml rename to conda-envs/environment-dev-py39.yml index 6f6bf11a88..6f6db58e67 100644 --- a/conda-envs/environment-dev-py36.yml +++ b/conda-envs/environment-dev-py39.yml @@ -1,10 +1,8 @@ -name: pymc3-dev-py36 +name: pymc3-dev-py39 channels: - conda-forge - defaults dependencies: -- contextvars -- dataclasses - h5py>=2.7 - ipython>=7.16 - libblas=*=*mkl @@ -15,7 +13,7 @@ dependencies: - pytest-cov>=2.5 - pytest>=3.0 - python-graphviz -- python=3.6 +- python=3.9 - recommonmark>=0.4 - sphinx-autobuild>=0.7 - sphinx>=1.5 diff --git a/pymc3/backends/tracetab.py b/pymc3/backends/tracetab.py index ab8a6e379f..f39f9eead1 100644 --- a/pymc3/backends/tracetab.py +++ b/pymc3/backends/tracetab.py @@ -26,7 +26,7 @@ def trace_to_dataframe(trace, chains=None, varnames=None, include_transformed=False): - """Convert trace to Pandas DataFrame. + """Convert trace to pandas DataFrame. Parameters ---------- diff --git a/pymc3/data.py b/pymc3/data.py index 78ab794c52..01327a1aa2 100644 --- a/pymc3/data.py +++ b/pymc3/data.py @@ -462,7 +462,7 @@ class Data: A value to associate with this variable dims: {str, tuple of str}, optional, default=None Dimension names of the random variables (as opposed to the shapes of these - random variables). Use this when `value` is a Pandas Series or DataFrame. The + random variables). Use this when `value` is a pandas Series or DataFrame. The `dims` will then be the name of the Series / DataFrame's columns. See ArviZ documentation for more information about dimensions and coordinates: https://arviz-devs.github.io/arviz/notebooks/Introduction.html diff --git a/pymc3/model.py b/pymc3/model.py index 015c089f5e..14d7244278 100644 --- a/pymc3/model.py +++ b/pymc3/model.py @@ -1682,7 +1682,7 @@ def init_value(self): def pandas_to_array(data): - """Convert a Pandas object to a NumPy array. + """Convert a pandas object to a NumPy array. XXX: When `data` is a generator, this will return a Theano tensor! diff --git a/pyproject.toml b/pyproject.toml index c75a682c1a..76e8fad2a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,6 +12,3 @@ exclude_lines = [ isort = 1 black = 1 pyupgrade = 1 - -[tool.nbqa.addopts] -pyupgrade = ["--py36-plus"] diff --git a/requirements.txt b/requirements.txt index ff947e26f8..1e29e212ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ arviz>=0.9.0 -contextvars; python_version < '3.7' -dataclasses; python_version < '3.7' dill fastprogress>=0.2.0 numpy>=1.13.0 diff --git a/setup.py b/setup.py index 72ff10c0a3..114d774fdc 100755 --- a/setup.py +++ b/setup.py @@ -30,9 +30,9 @@ "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "License :: OSI Approved :: Apache Software License", "Intended Audience :: Science/Research", "Topic :: Scientific/Engineering", @@ -82,7 +82,7 @@ def get_version(): # package_data={'docs': ['*']}, include_package_data=True, classifiers=classifiers, - python_requires=">=3.6", + python_requires=">=3.7", install_requires=install_reqs, tests_require=test_reqs, test_suite="nose.collector",