Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python version support #477

Merged
merged 19 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changelog
=========

- Drop official Python support for 3.7 and 3.8 as GPy is not officially supported for these versions
- Enable using `maxiter` in `bo.utils.minimize`
- Fix surrogate model copy operation
- Fix typo in requirements.txt
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ Ready to contribute? Here's how to set up `ELFI` for local development.
3. Make sure you have `Python 3 <https://www.python.org/>`_ and
`Anaconda Distribution <https://www.anaconda.com/>`_ installed on your
machine. Check your conda and Python versions. Currently supported Python versions
are 3.7, 3.8, 3.9, 3.10::
are 3.9, 3.10, 3.11, 3.12::

$ conda -V
$ python -V

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

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

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ is preferable.
Installation with pip
---------------------

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

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

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


Expand Down
10 changes: 5 additions & 5 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Installation
============

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

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


Installing Python 3.7
Installing Python 3.9
---------------------

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

.. code-block:: console

conda create -n elfi python=3.7 numpy
conda create -n elfi python=3.9 numpy
source activate elfi
pip install elfi

Expand All @@ -51,7 +51,7 @@ Resolving these may sometimes go wrong:
* If you receive an error about missing ``numpy``, please install it first.
* If you receive an error about `yaml.load`, install ``pyyaml``.
* On OS X with Anaconda virtual environment say `conda install python.app` and then use `pythonw` instead of `python`.
* Note that ELFI requires Python 3.7 or greater
* Note that ELFI requires Python 3.9 or greater
* In some environments ``pip`` refers to Python 2.x, and you have to use ``pip3`` to use the Python 3.x version
* Make sure your Python installation meets the versions listed in requirements_.

Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Quickstart

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

.. code:: ipython3
Expand Down
8 changes: 4 additions & 4 deletions elfi/examples/bdm.py
uremes marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ def prepare_inputs(*inputs, **kwinputs):
"""
alpha, delta, tau, N = inputs
meta = kwinputs['meta']

# Organize the parameters to an array. The broadcasting works nicely with constant
# arguments.
param_array = np.row_stack(np.broadcast(alpha, delta, tau, N))
param_array = np.row_stack(
[(a, d, t, N) for (a, d, t, N) in np.broadcast(alpha, delta, tau, N)]
)

# Prepare a unique filename for parallel settings
filename = '{model_name}_{batch_index}_{submission_index}.txt'.format(**meta)
Expand All @@ -37,7 +38,6 @@ def prepare_inputs(*inputs, **kwinputs):
# Add the filenames to kwinputs
kwinputs['filename'] = filename
kwinputs['output_filename'] = filename[:-4] + '_out.txt'

# Return new inputs that the command will receive
return inputs, kwinputs

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


def T2(clusters, n=20):
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dask[distributed]>=2.30.0
numpy>=1.12.1, <1.25
numpy>=1.12.1
scipy>=0.19
matplotlib>=1.1
GPy>=1.0.9
Expand All @@ -8,3 +8,4 @@ ipyparallel>=6
toolz>=0.8
scikit-learn>=0.18.1
numdifftools>=0.9
setuptools>=69
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
long_description=(open('docs/description.rst').read()),
license='BSD',
classifiers=[
'Programming Language :: Python :: 3.7', 'Topic :: Scientific/Engineering',
'Programming Language :: Python :: 3.9', 'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Artificial Intelligence',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Mathematics', 'Operating System :: OS Independent',
Expand Down
Loading