Skip to content

Commit ed70408

Browse files
authored
Merge pull request #1147 from bdevans/remove_python2
Remove Python 2 support
2 parents 959d61c + 7469bbb commit ed70408

File tree

285 files changed

+613
-5804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+613
-5804
lines changed

.travis.yml

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -46,62 +46,22 @@ matrix:
4646
- python: "3.7"
4747
env: PYTHON="3.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=no CONDA_PY="37" DO_CONDA_BUILD='no' SPLIT_RUN=2 ARCHITECTURE="x86_64" FLOAT_DTYPE_32=yes
4848
os: osx
49-
- python: "2.7"
50-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=yes REPORT_COVERAGE=no SPLIT_RUN=1 ARCHITECTURE="x86_64"
51-
os: linux
52-
- python: "2.7"
53-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=yes REPORT_COVERAGE=no SPLIT_RUN=2 ARCHITECTURE="x86_64"
54-
os: linux
55-
- python: "2.7"
56-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=yes REPORT_COVERAGE=no SPLIT_RUN=1 ARCHITECTURE="x86_64" FLOAT_DTYPE_32=yes
57-
os: linux
58-
- python: "2.7"
59-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=yes REPORT_COVERAGE=no SPLIT_RUN=2 ARCHITECTURE="x86_64" FLOAT_DTYPE_32=yes
60-
os: linux
61-
- python: "2.7"
62-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=no CONDA_PY="27" DO_CONDA_BUILD='yes' SPLIT_RUN=1 ARCHITECTURE="x86_64"
63-
os: linux
64-
- python: "2.7"
65-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=no CONDA_PY="27" DO_CONDA_BUILD='no' SPLIT_RUN=2 ARCHITECTURE="x86_64"
66-
os: linux
67-
- python: "2.7"
68-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=no CONDA_PY="27" DO_CONDA_BUILD='yes' SPLIT_RUN=1 ARCHITECTURE="x86_64"
69-
os: osx
70-
- python: "2.7"
71-
env: PYTHON="2.7" STANDALONE=no CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=no CONDA_PY="27" DO_CONDA_BUILD='no' SPLIT_RUN=2 ARCHITECTURE="x86_64"
72-
os: osx
7349
# test standalone
7450
- python: "3.7"
7551
env: PYTHON="3.7" STANDALONE=yes CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=yes DO_CONDA_BUILD='no' ARCHITECTURE="x86_64"
7652
os: linux
7753
- python: "3.7"
7854
env: PYTHON="3.7" STANDALONE=yes CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=yes DO_CONDA_BUILD='no' ARCHITECTURE="x86_64" FLOAT_DTYPE_32=yes
7955
os: linux
80-
- python: "2.7"
81-
env: PYTHON="2.7" STANDALONE=yes CYTHON=yes MINIMAL_VERSIONS=no REPORT_COVERAGE=no DO_CONDA_BUILD='no' ARCHITECTURE="x86_64"
82-
os: linux
83-
84-
jobs:
85-
allow_failures:
86-
- python: "2.7"
87-
os: osx
8856

8957
# Use miniconda to install binary versions of numpy etc. from continuum
9058
# analytic's repository. Follows an approach described by Dan Blanchard:
9159
# https://gist.github.com/dan-blanchard/7045057
9260
before_install:
93-
- if [ ${PYTHON:0:1} == "2" ]; then
94-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
95-
travis_retry wget http://repo.continuum.io/miniconda/Miniconda2-latest-Linux-$ARCHITECTURE.sh -O miniconda.sh;
96-
else
97-
travis_retry wget http://repo.continuum.io/miniconda/Miniconda2-latest-MacOSX-$ARCHITECTURE.sh -O miniconda.sh;
98-
fi;
99-
else
100-
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
61+
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then
10162
travis_retry wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-$ARCHITECTURE.sh -O miniconda.sh;
102-
else
63+
else
10364
travis_retry wget http://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-$ARCHITECTURE.sh -O miniconda.sh;
104-
fi;
10565
fi
10666
- chmod +x miniconda.sh
10767
# When we are installing the 32 Bit conda on a 64 Bit system, the miniconda
@@ -122,20 +82,11 @@ install:
12282
conda install --yes --quiet anaconda-client conda-build jinja2;
12383
fi
12484
- if [[ $MINIMAL_VERSIONS == 'yes' ]]; then
125-
PYTHON_PACKAGES="python=$PYTHON numpy==1.10 scipy==0.16 libgfortran==1 pytest pytest-xdist sphinx==1.8 ipython sympy==1.2 jinja2==2.7 pyparsing setuptools coverage gsl>1.15 cython future";
126-
else
127-
PYTHON_PACKAGES="python=$PYTHON numpy pytest pytest-xdist sphinx>=1.8 ipython sympy>=1.2 pyparsing jinja2 setuptools coverage gsl>1.15 cython future";
128-
fi
129-
# On Python 2: Install the weave package explicitly
130-
- if [ ${PYTHON:0:1} == "2" ]; then
131-
if [[ $MINIMAL_VERSIONS != 'yes' ]]; then
132-
PYTHON_PACKAGES="$PYTHON_PACKAGES weave scipy";
133-
fi;
134-
PYTHON_PACKAGES="$PYTHON_PACKAGES bsddb";
135-
conda config --set restore_free_channel true;
85+
PYTHON_PACKAGES="python=$PYTHON numpy==1.10 scipy==0.16 libgfortran==1 pytest pytest-xdist sphinx==1.8 ipython sympy==1.2 jinja2==2.7 pyparsing setuptools coverage gsl>1.15 cython";
13686
else
137-
PYTHON_PACKAGES="$PYTHON_PACKAGES scipy";
87+
PYTHON_PACKAGES="python=$PYTHON numpy pytest pytest-xdist sphinx>=1.8 ipython sympy>=1.2 pyparsing jinja2 setuptools coverage gsl>1.15 cython";
13888
fi
89+
- PYTHON_PACKAGES="$PYTHON_PACKAGES scipy";
13990
- if [[ $REPORT_COVERAGE == 'yes' ]]; then PYTHON_PACKAGES="$PYTHON_PACKAGES pytest-cov coveralls"; fi
14091
# Install packages into a new environment
14192
- travis_retry conda create --quiet --yes -n travis_conda $PYTHON_PACKAGES

.travis_long.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

README.rst

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Stimberg, M, Brette, R, Goodman, DFM. “Brian 2, an Intuitive and Efficient Neu
1717

1818

1919

20-
.. image:: https://img.shields.io/pypi/v/Brian2.svg?style=flat-square
20+
.. image:: https://img.shields.io/pypi/v/Brian2.svg
2121
:target: https://pypi.python.org/pypi/Brian2
2222

2323
.. image:: https://img.shields.io/conda/vn/conda-forge/brian2.svg
@@ -48,22 +48,19 @@ Dependencies
4848
------------
4949
The following packages need to be installed to use Brian 2:
5050

51-
* Python 2.7, or >= 3.5
51+
* Python >= 3.5
5252
* NumPy >=1.10
5353
* SymPy >= 1.2
5454
* Cython >= 0.29
5555
* PyParsing
5656
* Jinja2 >= 2.7
57-
* future
5857
* setuptools >= 21
5958
* py-cpuinfo (only required on Windows)
6059

6160
For full functionality, you might also want to install:
6261

6362
* GSL >=1.16
6463
* SciPy >=0.13.3
65-
* weave (only on Python 2)
66-
* bsddb (only on Python 2)
6764
* Matplotlib >= 2.0
6865

6966
To build the documentation:
@@ -78,13 +75,13 @@ To run the test suite:
7875
Testing status for master branch
7976
--------------------------------
8077

81-
.. image:: https://img.shields.io/travis/brian-team/brian2/master.svg?style=flat-square
78+
.. image:: https://img.shields.io/travis/brian-team/brian2/master.svg
8279
:target: https://travis-ci.org/brian-team/brian2?branch=master
8380

84-
.. image:: https://img.shields.io/appveyor/ci/brianteam/brian2/master.svg?style=flat-square
81+
.. image:: https://img.shields.io/appveyor/ci/brianteam/brian2/master.svg
8582
:target: https://ci.appveyor.com/project/brianteam/brian2/branch/master
8683

87-
.. image:: https://img.shields.io/coveralls/brian-team/brian2/master.svg?style=flat-square
84+
.. image:: https://img.shields.io/coveralls/brian-team/brian2/master.svg
8885
:target: https://coveralls.io/r/brian-team/brian2?branch=master
8986

9087
.. image:: https://readthedocs.org/projects/brian2/badge/?version=stable

appveyor.yml

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,6 @@ environment:
2121
platform: x86
2222
STANDALONE: "TRUE"
2323

24-
- PYTHON: "C:\\Miniconda"
25-
PYTHON_VERSION: "2.7"
26-
PYTHON_ARCH: "32"
27-
platform: x86
28-
STANDALONE: "FALSE"
29-
CONDA_PY: "27"
30-
DO_CONDA_BUILD: "TRUE"
31-
SPLIT_RUN: "FALSE"
32-
33-
- PYTHON: "C:\\Miniconda-x64"
34-
PYTHON_VERSION: "2.7"
35-
PYTHON_ARCH: "64"
36-
platform: x64
37-
STANDALONE: "FALSE"
38-
CONDA_PY: "27"
39-
DO_CONDA_BUILD: "TRUE"
40-
SPLIT_RUN: "FALSE"
41-
4224
- PYTHON: "C:\\Miniconda37"
4325
PYTHON_VERSION: "3.7"
4426
PYTHON_ARCH: "32"
@@ -109,11 +91,7 @@ install:
10991
- 'conda config --append channels conda-forge'
11092
# Install the build dependencies of the project via conda
11193
- 'appveyor-retry conda update -c conda-forge --yes conda'
112-
- 'set PYTHON_PACKAGES=pytest "sympy>=1.1.1" pyparsing jinja2 ipython setuptools cython "py-cpuinfo>=3" "gsl>1.15" future sphinx'
113-
# Install the weave package for Python 2
114-
- 'if "%PYTHON_VERSION:~0,1%" == "2" set PYTHON_PACKAGES=%PYTHON_PACKAGES% weave'
115-
# weave 0.16 is the only available version for 32 bit Windows, and it is not compatible with numpy 0.16
116-
- 'if "%platform%" == "x86" (set PYTHON_PACKAGES=%PYTHON_PACKAGES% "numpy<1.16") else (set PYTHON_PACKAGES=%PYTHON_PACKAGES% numpy)'
94+
- 'set PYTHON_PACKAGES=pytest "sympy>=1.1.1" pyparsing jinja2 ipython setuptools cython "py-cpuinfo>=3" "gsl>1.15" sphinx numpy'
11795
# Create the test environment
11896
- 'appveyor-retry conda install --quiet --yes python=%PYTHON_VERSION% %PYTHON_PACKAGES%'
11997
# For faster tests, only build conda packages for the master branch or pull requests

brian2/__init__.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
'''
22
Brian 2
33
'''
4-
# Import setuptools to do some monkey patching of distutils, necessary for
5-
# working weave/Cython on Windows with the Python for C++ compiler
6-
from __future__ import absolute_import
7-
import setuptools as _setuptools
8-
from past.builtins import basestring
94

105

116
def _check_dependencies():
@@ -80,7 +75,7 @@ def _check_dependency_version(name, version):
8075
logger = get_logger(__name__)
8176

8277
module = sys.modules[name]
83-
if not isinstance(module.__version__, basestring): # mocked module
78+
if not isinstance(module.__version__, str): # mocked module
8479
return
8580
if not LooseVersion(module.__version__) >= LooseVersion(version):
8681
message = '%s is outdated (got version %s, need version %s)' % (name,
@@ -150,7 +145,7 @@ def clear_cache(target):
150145
Parameters
151146
----------
152147
target : str
153-
The code generation target (e.g. ``'weave'`` or ``'cython'``)
148+
The code generation target (e.g. ``'cython'``)
154149
155150
Raises
156151
------
@@ -186,13 +181,10 @@ def clear_cache(target):
186181

187182

188183
def _check_caches():
189-
from brian2.codegen.runtime.weave_rt.weave_rt import get_weave_cache_dir
190184
from brian2.codegen.runtime.cython_rt.extension_manager import get_cython_cache_dir
191-
from brian2.codegen.runtime.weave_rt.weave_rt import get_weave_extensions
192185
from brian2.codegen.runtime.cython_rt.extension_manager import get_cython_extensions
193186

194-
for target, (dirname, extensions) in [('weave', (get_weave_cache_dir(), get_weave_extensions())),
195-
('cython', (get_cython_cache_dir(), get_cython_extensions()))]:
187+
for target, (dirname, extensions) in [('cython', (get_cython_cache_dir(), get_cython_extensions()))]:
196188
_cache_dirs_and_extensions[target] = (dirname, extensions)
197189
if prefs.codegen.max_cache_dir_size > 0:
198190
check_cache(target)

brian2/codegen/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Package providing the code generation framework.
33
'''
44
# Import the runtime packages so that they can register their preferences
5-
from __future__ import absolute_import
5+
66
from .runtime import *
77
from . import _prefs
88
from . import cpp_prefs as _cpp_prefs
99

10-
__all__ = ['NumpyCodeObject', 'WeaveCodeObject', 'CythonCodeObject']
10+
__all__ = ['NumpyCodeObject', 'CythonCodeObject']

brian2/codegen/_prefs.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
from __future__ import absolute_import
1+
22
'''
33
Module declaring general code generation preferences.
44
55
Preferences
66
-----------
77
.. document_brian_prefs:: codegen
88
'''
9-
from past.builtins import basestring
10-
119
from brian2.core.preferences import prefs, BrianPreference
1210
from .codeobject import CodeObject
1311

@@ -24,17 +22,14 @@
2422
2523
* ``'auto'`` the default, automatically chose the best code generation
2624
target available.
27-
* ``'weave'`` uses ``scipy.weave`` to generate and compile C++ code,
28-
should work anywhere where ``gcc`` is installed and available at the
29-
command line.
3025
* ``'cython'``, uses the Cython package to generate C++ code. Needs a
3126
working installation of Cython and a C++ compiler.
3227
* ``'numpy'`` works on all platforms and doesn't need a C compiler but
3328
is often less efficient.
3429
3530
Or it can be a ``CodeObject`` class.
3631
''',
37-
validator=lambda target: isinstance(target, basestring) or issubclass(target, CodeObject),
32+
validator=lambda target: isinstance(target, str) or issubclass(target, CodeObject),
3833
),
3934
string_expression_target=BrianPreference(
4035
default='numpy',
@@ -46,7 +41,7 @@
4641
4742
Accepts the same arguments as `codegen.target`, except for ``'auto'``
4843
''',
49-
validator=lambda target: isinstance(target, basestring) or issubclass(target, CodeObject),
44+
validator=lambda target: isinstance(target, str) or issubclass(target, CodeObject),
5045
),
5146
loop_invariant_optimisations=BrianPreference(
5247
default=True,
@@ -61,7 +56,7 @@
6156
max_cache_dir_size=BrianPreference(
6257
default=1000,
6358
docs='''
64-
The size of a directory (in MB) with cached code for weave or Cython that triggers a warning.
59+
The size of a directory (in MB) with cached code for Cython that triggers a warning.
6560
Set to 0 to never get a warning.
6661
'''
6762
)

brian2/codegen/codeobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'''
22
Module providing the base `CodeObject` and related functions.
33
'''
4-
from __future__ import absolute_import
4+
55
import collections
66
import copy
77
import platform

0 commit comments

Comments
 (0)