Skip to content

Commit a132c1b

Browse files
authored
Update python version support (#477)
* Add arviz-dependency to requirements * Include InferenceData-object to results * Fix 085 (#465) * add __init__.py to elfi/methods/bsl/ * Update CHANGELOG.rst * Bump version (#466) * Clean up inference data-object wrapper * Update CHANGELOG * Fix typo * Update info on supported Python versions. * Fix error caused by new version of numpy * Enable maxiter option * Remove forgotten print-commands * Remove arviz-elements * Remove arviz dependency * Include setuptools in requirements
1 parent 81514da commit a132c1b

File tree

9 files changed

+22
-20
lines changed

9 files changed

+22
-20
lines changed

.github/workflows/pytest.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ['3.7', '3.8', '3.9', '3.10']
18+
python-version: ['3.9', '3.10', '3.11', '3.12']
1919

2020
steps:
2121
- uses: actions/checkout@v2

CHANGELOG.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Changelog
22
=========
33

4+
- Drop official Python support for 3.7 and 3.8 as GPy is not officially supported for these versions
45
- Enable using `maxiter` in `bo.utils.minimize`
56
- Fix surrogate model copy operation
67
- Fix typo in requirements.txt

CONTRIBUTING.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ Ready to contribute? Here's how to set up `ELFI` for local development.
7272
3. Make sure you have `Python 3 <https://www.python.org/>`_ and
7373
`Anaconda Distribution <https://www.anaconda.com/>`_ installed on your
7474
machine. Check your conda and Python versions. Currently supported Python versions
75-
are 3.7, 3.8, 3.9, 3.10::
75+
are 3.9, 3.10, 3.11, 3.12::
7676

7777
$ conda -V
7878
$ python -V
7979

8080
4. Install your local copy and the development requirements into a conda
81-
environment. You may need to replace "3.7" in the first line with the python
81+
environment. You may need to replace "3.9" in the first line with the python
8282
version printed in the previous step::
8383

84-
$ conda create -n elfi python=3.7 numpy
84+
$ conda create -n elfi python=3.9 numpy
8585
$ source activate elfi
8686
$ cd elfi
8787
$ make dev
@@ -136,7 +136,7 @@ Before you submit a pull request, check that it meets these guidelines:
136136
2. If the pull request adds functionality, the docs should be updated. Put
137137
your new functionality into a function with a docstring, and add the
138138
feature to the list in README.md.
139-
3. The pull request should work for Python 3.7 and later. Check
139+
3. The pull request should work for Python 3.9 and later. Check
140140
https://github.com/elfi-dev/elfi/actions/workflows/pytest.yml
141141
and make sure that the tests pass for all supported Python versions.
142142

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ is preferable.
4444
Installation with pip
4545
---------------------
4646

47-
ELFI requires Python 3.7 or greater. You can install ELFI by typing in your terminal:
47+
ELFI requires Python 3.9 or greater. You can install ELFI by typing in your terminal:
4848

4949
```
5050
pip install elfi
@@ -95,7 +95,7 @@ with your default Python environment and can easily use different versions of Py
9595
in different projects. You can create a virtual environment for ELFI using anaconda with:
9696

9797
```
98-
conda create -n elfi python=3.7 numpy
98+
conda create -n elfi python=3.9 numpy
9999
source activate elfi
100100
pip install elfi
101101
```
@@ -125,7 +125,7 @@ Resolving these may sometimes go wrong:
125125
- If you receive an error about `yaml.load`, install `pyyaml`.
126126
- On OS X with Anaconda virtual environment say `conda install python.app` and then use
127127
`pythonw` instead of `python`.
128-
- Note that ELFI requires Python 3.7 or greater so try `pip3 install elfi`.
128+
- Note that ELFI requires Python 3.9 or greater so try `pip3 install elfi`.
129129
- Make sure your Python installation meets the versions listed in `requirements.txt`.
130130

131131

docs/installation.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Installation
44
============
55

6-
ELFI requires Python 3.7 or greater (see below how to install). To install ELFI, simply
6+
ELFI requires Python 3.9 or greater (see below how to install). To install ELFI, simply
77
type in your terminal:
88

99
.. code-block:: console
@@ -18,16 +18,16 @@ process.
1818
.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/
1919

2020

21-
Installing Python 3.7
21+
Installing Python 3.9
2222
---------------------
2323

2424
If you are new to Python, perhaps the simplest way to install it is with Anaconda_ that
25-
manages different Python versions. After installing Anaconda, you can create a Python 3.7.
25+
manages different Python versions. After installing Anaconda, you can create a Python 3.9.
2626
environment with ELFI:
2727

2828
.. code-block:: console
2929
30-
conda create -n elfi python=3.7 numpy
30+
conda create -n elfi python=3.9 numpy
3131
source activate elfi
3232
pip install elfi
3333
@@ -51,7 +51,7 @@ Resolving these may sometimes go wrong:
5151
* If you receive an error about missing ``numpy``, please install it first.
5252
* If you receive an error about `yaml.load`, install ``pyyaml``.
5353
* On OS X with Anaconda virtual environment say `conda install python.app` and then use `pythonw` instead of `python`.
54-
* Note that ELFI requires Python 3.7 or greater
54+
* Note that ELFI requires Python 3.9 or greater
5555
* In some environments ``pip`` refers to Python 2.x, and you have to use ``pip3`` to use the Python 3.x version
5656
* Make sure your Python installation meets the versions listed in requirements_.
5757

docs/quickstart.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Quickstart
33

44
First ensure you have
55
`installed <http://elfi.readthedocs.io/en/stable/installation.html>`__
6-
Python 3.7 (or greater) and ELFI. After installation you can start using
6+
Python 3.9 (or greater) and ELFI. After installation you can start using
77
ELFI:
88

99
.. code:: ipython3

elfi/examples/bdm.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ def prepare_inputs(*inputs, **kwinputs):
2525
"""
2626
alpha, delta, tau, N = inputs
2727
meta = kwinputs['meta']
28-
2928
# Organize the parameters to an array. The broadcasting works nicely with constant
3029
# arguments.
31-
param_array = np.row_stack(np.broadcast(alpha, delta, tau, N))
30+
param_array = np.row_stack(
31+
[(a, d, t, N) for (a, d, t, N) in np.broadcast(alpha, delta, tau, N)]
32+
)
3233

3334
# Prepare a unique filename for parallel settings
3435
filename = '{model_name}_{batch_index}_{submission_index}.txt'.format(**meta)
@@ -37,7 +38,6 @@ def prepare_inputs(*inputs, **kwinputs):
3738
# Add the filenames to kwinputs
3839
kwinputs['filename'] = filename
3940
kwinputs['output_filename'] = filename[:-4] + '_out.txt'
40-
4141
# Return new inputs that the command will receive
4242
return inputs, kwinputs
4343

@@ -71,7 +71,7 @@ def process_result(completed_process, *inputs, **kwinputs):
7171
def T1(clusters):
7272
"""Summary statistic for BDM."""
7373
clusters = np.atleast_2d(clusters)
74-
return np.sum(clusters > 0, 1) / np.sum(clusters, 1)
74+
return np.sum(clusters > 0, axis=1) / np.sum(clusters, axis=1)
7575

7676

7777
def T2(clusters, n=20):

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dask[distributed]>=2.30.0
2-
numpy>=1.12.1, <1.25
2+
numpy>=1.12.1
33
scipy>=0.19
44
matplotlib>=1.1
55
GPy>=1.0.9
@@ -8,3 +8,4 @@ ipyparallel>=6
88
toolz>=0.8
99
scikit-learn>=0.18.1
1010
numdifftools>=0.9
11+
setuptools>=69

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
long_description=(open('docs/description.rst').read()),
3232
license='BSD',
3333
classifiers=[
34-
'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering',
34+
'Programming Language :: Python :: 3.9', 'Topic :: Scientific/Engineering',
3535
'Topic :: Scientific/Engineering :: Artificial Intelligence',
3636
'Topic :: Scientific/Engineering :: Bio-Informatics',
3737
'Topic :: Scientific/Engineering :: Mathematics', 'Operating System :: OS Independent',

0 commit comments

Comments
 (0)