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

Python 3 #249

Merged
merged 109 commits into from May 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
1c62e2b
clear the graveyard
sdrave May 4, 2016
a144809
[pyhton3] apply 2to3
sdrave May 4, 2016
0cc4ba0
[python3] correct 2to3 changes
sdrave May 4, 2016
1dfbe7c
[py3] fix version string generation
renefritze Jul 8, 2015
20b6e93
[py3] fix using removed NoneType
renefritze Jul 8, 2015
c49f28f
[py3] update cache decorator's __get__
renefritze Jul 8, 2015
727547d
[py3] fix getting chace size from sqlite
renefritze Jul 8, 2015
3ddacda
[py3] cache files need binary read/write mode
renefritze Jul 8, 2015
c1cca8f
[core] fix __qualname__ usage for Python 3
sdrave Jul 9, 2015
02a34ff
some Python 3 fixes
sdrave Jul 9, 2015
19c710c
[py] correct usage of dict.keys and dict.values
sdrave Jul 9, 2015
623a2ea
[py3] remove isinstace(g.size(codim), int) test
sdrave Jul 9, 2015
7534a61
[py3] fix version.py generation
sdrave Jul 10, 2015
c213c80
[vtkio] replace pyvtk with pyevtk
renefritze Jul 24, 2015
287c9dc
[python3] adds woraround for numpy < 1.9 in vectorarray.len_ind
renefritze Oct 9, 2015
b457dba
[build] adds fasttest target in Makefile
renefritze Oct 9, 2015
6f29826
removes long-since unused tox configuration
renefritze Oct 12, 2015
b529e08
[python3] fix zero-fill size for vtk output coordinates
renefritze Oct 13, 2015
ac45c16
[python3] implements workaround for #171
renefritze Oct 13, 2015
d365c55
[python3] avoid potential problem in defaults I/O
renefritze Oct 14, 2015
40f417c
[python3] fix demo test checking for import error
renefritze Oct 15, 2015
ec2c370
[test] exception checking needed further tweaking
renefritze Oct 15, 2015
82b35f4
[test] rewire PySide xfail and extend to gui.test_visualize_patch
renefritze Oct 15, 2015
a4cc03b
[test] missed one ImportError to PysideMissing conversion
renefritze Oct 15, 2015
6ee93ec
[python3] minimize workaround for #171
renefritze Oct 21, 2015
a377efe
[py3] coordinates nedd to be contiguous
renefritze Feb 25, 2016
00b2c44
[py3] fix index check for vectorarrays
renefritze Feb 25, 2016
177d280
[py3/test] type check for _INDEXTYPE instead of Number
renefritze Feb 25, 2016
d7f89c5
[py3] fixes new sqlite behaviour
renefritze Feb 26, 2016
c8bca33
[py3] fix adding additional streams
renefritze Feb 26, 2016
f16af99
[python3] remove duplicate ParameterType.keys
sdrave May 4, 2016
710d6b8
[py3] fix iteritems issues
renefritze Feb 26, 2016
6f255eb
[py3] try to refix pickling
renefritze Feb 26, 2016
7ceaed9
[py3] make open mode explicit
renefritze Feb 29, 2016
51ac5a7
[py3] fix _function_unpickling_handler
renefritze Feb 29, 2016
2983bef
[py3] a couple more test fixes
renefritze Feb 29, 2016
07965b0
[py3] more Number -> _INDEXTYPES
renefritze Feb 29, 2016
9b741de
[py3] fix gmsh writing
renefritze Feb 29, 2016
10d663a
[tests] fix operator fixture factory
renefritze Mar 1, 2016
3c00d96
[py3] prepare automatic 3 to 2 conversion
renefritze Mar 1, 2016
e711a9b
[build] fix 3to2 makefile target
renefritze Mar 8, 2016
bb317cd
[test] move pytest options to pytest.ini
renefritze Mar 8, 2016
adfc7dc
[test] refactor/re-enable "python setup.py test"
renefritze Mar 8, 2016
ff118f1
[py3] fix unpickling
renefritze Mar 9, 2016
64aac5b
[setup] hooks 3to2 into build command
renefritze Mar 15, 2016
f469474
[setup] do not fail if lib3to2 is an egg
renefritze Mar 24, 2016
cb8bab7
[py3] update names of function object attributes
sdrave Jul 9, 2015
b331849
[tests] use str instad of dumps for creating result hash
sdrave May 4, 2016
d3fa868
[python3] encode string before computing hash
sdrave May 4, 2016
a5adec2
[python3] check_results: set encoding when using load to latin-1
sdrave May 4, 2016
1edee26
[travis] use .travis.yml from python3_move branch
sdrave May 4, 2016
f014a48
[debian] replace pyvtk by pyevtk
sdrave May 4, 2016
1f34a96
Revert "removes landscape config, closes #137"
renefritze Jan 14, 2016
1d95e69
[python3] check_results: do not pickle numpy arrays directly
sdrave May 5, 2016
7a19fe4
[travis] re-add pyMOR to PYTHONPATH
sdrave May 5, 2016
6b2f5cb
[travis] try to fix version string generation on non-master branches
sdrave May 6, 2016
166ef50
[3to2] remove some unneeded fixers, do not create backups
sdrave May 6, 2016
cc11736
[python3] fix sphinx build
sdrave May 9, 2016
abd30c1
[python3] py.test fixture params do not need to be lists
sdrave May 9, 2016
24b59bc
[core] fix deterministic_state() for dictionaries
sdrave May 10, 2016
a9029ac
[python3] always use HIGHEST_PROTOCOL in deterministic_state
sdrave May 10, 2016
f60da3b
[core] support __reduce_ex__ in deterministic_state()
sdrave May 10, 2016
e698ae9
[python2] ensure that cPickle is used on Python 2
sdrave May 10, 2016
af5326b
[python2] improve string handling in deterministic_state()
sdrave May 10, 2016
1867c96
[3to2] update fixers in 3to2 to fixers used in setup.py
sdrave May 10, 2016
5439474
[parameters] simplify implementation of Parameter
sdrave May 10, 2016
bb351a0
[python2] fix af5326b3f057f1e645ab70ca4b7867f4758c3893
sdrave May 10, 2016
5548874
[core] simplify UberMeta
sdrave May 10, 2016
5f2e936
[python3] fix _init_arguments in presence of keyword-only args
sdrave May 10, 2016
1ace019
[python3] use inspect.signature in core.cache
sdrave May 10, 2016
b0836d0
[fenics] add missing @classmethod to FenicsVector
sdrave May 10, 2016
ea1ccd1
[core.cache] simplify implementation of @cached
sdrave May 11, 2016
77b7ef2
[python3] improve core.pickle
sdrave May 11, 2016
4bffb50
[python3] improve function pickling tests
sdrave May 11, 2016
080b334
[docs] update copyright notice in documentation
sdrave May 12, 2016
8ac3ad4
[python2] fix pymordocstring.py for Python 2
sdrave May 12, 2016
afe3f13
[core.defaults] some minor improvements
sdrave May 12, 2016
4bc0b49
[core.defaults] ensure that no invalid defaults are added to DefaultC…
sdrave May 12, 2016
40a193e
[core.defaults] do not use exec in @defaults
sdrave May 12, 2016
3ffd33c
[docs] replace PYMOR_COPY_DOCSTRINGS_DISABLE with PYMOR_WITH_SPHINX
sdrave May 12, 2016
95acb27
[python2] disable @defaults on Python 2 during documentation generation
sdrave May 12, 2016
9325e8f
[python3] refactor and add full Python 3 support
sdrave May 12, 2016
0906e32
[python3] use Python 3 online docs when building documentation with P…
sdrave May 12, 2016
49997a8
[tests] add more dealii VectorArray fixtures
sdrave May 12, 2016
8e33593
[travis] updating mpi4py from the fenics ppa fixes a shutdown bug
renefritze May 12, 2016
28362ea
[travis] forgot to update mpi4py in the py3 case
renefritze May 13, 2016
a61b6ae
[build] fix import name for pyside
andreasbuhr May 14, 2016
8b24a6e
[build] change suggested pip command to install packeges one by one
andreasbuhr May 14, 2016
6bb5a77
Merge pull request #246 from andreasbuhr/python3_fix_pip_install_command
sdrave May 17, 2016
87a3352
Merge pull request #245 from andreasbuhr/python3_fix_pyside_dependency
sdrave May 17, 2016
8d85c85
[travis] apt sources needs updating after adding repo
renefritze May 18, 2016
b3b5260
[travis] do not install conflict inducing, not needed dolfin-dev package
renefritze May 18, 2016
dc87c5d
[travis] move python3-sympy install since it is not actually whitelisted
renefritze May 18, 2016
89786f1
[travis] split py 3/2 package install
renefritze May 18, 2016
1f9a71b
[travis] move pip install command after installing pip
renefritze May 18, 2016
cb080f6
[travis] was missing python3-scipy
renefritze May 18, 2016
242a71f
[travis] was missing python development packages
renefritze May 18, 2016
6bb44e7
[travis] remove no longer needed deadsnakes repo
renefritze May 18, 2016
d73a23c
workaround for post-finalize calls with dolfin+petsc4py
renefritze May 20, 2016
d00bfd4
[travis] use apt package for zmq
renefritze May 19, 2016
862a24b
[travis] add manual hdf5 dev package installation
renefritze May 19, 2016
4c940bb
[travis] add manual slepc dev package installation
renefritze May 19, 2016
d5f3fa9
move petsc/MPI workaround into main package's init
renefritze May 23, 2016
d3253f1
[travis] build all test variants for both py 2.7 and 3.x
renefritze May 23, 2016
f1997ef
[python3,fenics] make FunctionSpace hashable on Python3 for pyMOR's M…
sdrave May 23, 2016
272b622
[python3] improve dumps_function
sdrave May 23, 2016
d939dca
[py3] only run 3to2 once from setup.py
renefritze May 24, 2016
db5496f
[travis] add '--verbose' flag to pip install command
sdrave May 24, 2016
4c95dc0
[setup] add 3to2 to the beginning of dependency list
sdrave May 25, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -61,3 +61,4 @@ coverage.xml
libpeerconnection.log
debian/pymor/
.cache
3to2.conversion.ok
16 changes: 16 additions & 0 deletions .landscape.yaml
@@ -0,0 +1,16 @@
# https://landscape.io/pages/docs

max-line-length: 120

ignore-paths:
- distribute_setup.py
- graveyard
- src/pymor/playground/
- src/pymortests/

strictness: low

pyroma:
run: true

autodetect: yes
66 changes: 46 additions & 20 deletions .travis.yml
@@ -1,38 +1,51 @@
language: generic

git:
depth: 1000

before_install:
- git fetch --depth=1000 --tags origin master
- alias python=python${TRAVIS_PYTHON_VERSION}
- alias python=python${PYMOR_PYTHON_VERSION}
- export PYTHON_X=python${PYMOR_PYTHON_VERSION}
# for some reason installing ptyhon-pytest does not install a /usr/bin/py.test-2.7 which we fake below
- export PY_TEST_X="${PYTHON_X} /usr/local/bin/py.test"
- export PIP_X=pip${PYMOR_PYTHON_MAJOR}
- sudo add-apt-repository -y ppa:pymor/stable
- sudo add-apt-repository -y ppa:fenics-packages/fenics
- sudo apt-get update -qq
# these are packages not on travis' whitelist/only in our ppa
- sudo apt-get install -y -qq python-docopt python-pytest python-opengl python-distribute ipython python-pyside python-pyvtk python-mpi4py
- for pkg in ipyparallel pytest-cov python-coveralls ; do sudo -E pip install ${pkg} ; done
# our exp. py3 packages are incompat. with the official repo
# using aptitude here because it auto-fixes problems
- sudo aptitude install -y -q dolfin-dev python-dolfin
- python -c 'import dolfin' || echo "import dolfin failed"
- |
if [ "${PYMOR_PYTHON_MAJOR}" == "3" ] ; then
sudo add-apt-repository -y ppa:pymor/fenics-py3
sudo aptitude update
sudo aptitude install -y -q libslepc3.4.2-dev libhdf5-openmpi-dev python3-zmq python3-dev python3-dolfin python3-mpi4py python3-tk cython3 python3-pip python3.4-venv python3-docopt python3-pytest python3-opengl ipython3 python3-pyside python3-mpi4py python3-sympy python3-scipy
else
sudo add-apt-repository -y ppa:fenics-packages/fenics
sudo aptitude update
sudo aptitude install -y -q libslepc3.4.2-dev libhdf5-openmpi-dev python-zmq python-dev python-dolfin python-mpi4py python2.7 python-pytest python-docopt python-pytest python-opengl python-distribute ipython python-pyside python-mpi4py
fi
- ${PYTHON_X} -c 'import dolfin' || echo "import dolfin failed"
- for pkg in 3to2 https://bitbucket.org/pauloh/pyevtk/get/tip.tar.gz ipyparallel pytest-cov python-coveralls ; do sudo -E ${PIP_X} install ${pkg} ; done
- sudo -E ${PIP_X} install -U pytest

install:
- python setup.py build_ext -i
- ${PYTHON_X} setup.py build_ext -i

sudo: required
dist: trusty

script:
- |
if [ "${PYTEST_MARKER}" == "PIP_ONLY" ] ; then
virtualenv piptest
virtualenv --python=${PYTHON_X} piptest
source piptest/bin/activate
# this fails on PRs, so skip it
[[ "${TRAVIS_PULL_REQUEST}" != "false" ]] || pip install git+https://github.com/${TRAVIS_REPO_SLUG}.git@${TRAVIS_COMMIT}
[[ "${TRAVIS_PULL_REQUEST}" != "false" ]] || ${PIP_X} --verbose install git+https://github.com/${TRAVIS_REPO_SLUG}.git@${TRAVIS_COMMIT}
elif [ "${PYTEST_MARKER}" == "MPI" ] ; then
export PYTHONPATH=$(pwd)/src
xvfb-run -a mpirun -n 2 python src/pymortests/mpi_run_demo_tests.py
xvfb-run -a mpirun -n 2 ${PYTHON_X} src/pymortests/mpi_run_demo_tests.py
else
export PYTHONPATH=$(pwd)/src
# this runs in pytest in a fake, auto numbered, X Server
xvfb-run -a py.test -k "${PYTEST_MARKER}"
xvfb-run -a ${PY_TEST_X} -k "${PYTEST_MARKER}"
fi

notifications:
Expand All @@ -47,22 +60,23 @@ branches:
except:
- gh-pages

env:
- PYTEST_MARKER="not slow"
- PYTEST_MARKER="slow"
- PYTEST_MARKER="PIP_ONLY"
- PYTEST_MARKER="MPI"

addons:
apt:
packages:
- debhelper
- python-pip
- python-markupsafe
- python3-markupsafe
- git
- cython
- xvfb
- libopenmpi-dev
- python3-numpy
- python3-sphinx
- python3-matplotlib
- python3-dev
- python3-six
- python-six
- python-virtualenv
- python-numpy
- python-sphinx
Expand All @@ -85,3 +99,15 @@ addons:
os:
- linux

env:
global: PYMOR_PYTHON_MAJOR=3 PYMOR_PYTHON_VERSION=3.4
matrix:
- PYTEST_MARKER="not slow"
- PYTEST_MARKER="slow"
- PYTEST_MARKER="PIP_ONLY"
- PYTEST_MARKER="MPI"
- PYMOR_PYTHON_MAJOR=2 PYMOR_PYTHON_VERSION=2.7 PYTEST_MARKER="not slow"
- PYMOR_PYTHON_MAJOR=2 PYMOR_PYTHON_VERSION=2.7 PYTEST_MARKER="slow"
- PYMOR_PYTHON_MAJOR=2 PYMOR_PYTHON_VERSION=2.7 PYTEST_MARKER="PIP_ONLY"
- PYMOR_PYTHON_MAJOR=2 PYMOR_PYTHON_VERSION=2.7 PYTEST_MARKER="MPI"

8 changes: 8 additions & 0 deletions Makefile
Expand Up @@ -22,6 +22,9 @@ flake8:
test:
python setup.py test

fasttest:
PYTEST_MARKER="not slow" python setup.py test

full-test:
@echo
@echo "Ensuring that all required pytest plugins are installed ..."
Expand All @@ -37,3 +40,8 @@ full-test:

doc:
PYTHONPATH=${PWD}/src/:${PYTHONPATH} make -C docs html

3to2:
./3to2.sh src/
./3to2.sh docs/
python setup.py build_ext -i
4 changes: 2 additions & 2 deletions debian/control
Expand Up @@ -5,7 +5,7 @@ Maintainer: Rene Milk <rene.milk@uni-muenster.de>
Build-Depends: debhelper (>= 8.0.0), python-pip, python-virtualenv, python-numpy,
python-scipy, python-pytest, python-pyside,
cython, python-sphinx, python-sympy, python-matplotlib,
python-opengl, python-docopt, python-pyvtk,
python-opengl, python-docopt, python-pyevtk,
python-dev, python3, dh-make,
python-docutils
Standards-Version: 3.9.4
Expand All @@ -19,7 +19,7 @@ Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends},
python-pip, python-virtualenv, python-numpy,
python-scipy, python-pytest, python-pyside,
cython, python-matplotlib, python-opengl,
python-docopt, python-pyvtk,
python-docopt, python-pyevtk,
python-dev, python
Suggests: python-pymor-doc
Description: makes pyMOR importable system-wide + dependency tracking
Expand Down
5 changes: 3 additions & 2 deletions dependencies.py
Expand Up @@ -4,7 +4,7 @@

tests_require = ['pytest', 'pytest-cov']
install_requires = ['cython>=0.20.1', 'numpy>=1.8.1', 'scipy>=0.13.3', 'Sphinx', 'docopt']
setup_requires = ['cython>=0.20.1', 'numpy>=1.8.1']
setup_requires = ['pytest-runner', 'cython>=0.20.1', 'numpy>=1.8.1']
install_suggests = {'ipython': 'an enhanced interactive python shell',
'ipyparallel': 'required for pymor.parallel.ipython',
'matplotlib': 'needed for error plots in demo scipts',
Expand All @@ -22,7 +22,8 @@
'pytest-cov': 'pytest_cov',
'pytest-flakes': 'pytest_flakes',
'pytest-pep8': 'pytest_pep8',
'pyopengl': 'OpenGL'}
'pyopengl': 'OpenGL',
'pyside': 'PySide'}

if __name__ == '__main__':
print(' '.join([i for i in install_requires + install_suggests]))
2 changes: 1 addition & 1 deletion distribute_setup.py
Expand Up @@ -194,7 +194,7 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from urllib.request import urlopen
tgz_name = "distribute-%s.tar.gz" % version
url = download_base + tgz_name
saveto = os.path.join(to_dir, tgz_name)
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = PYMOR_COPY_DOCSTRINGS_DISABLE=1 sphinx-build
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

Expand Down
10 changes: 7 additions & 3 deletions docs/source/conf.py
Expand Up @@ -5,6 +5,10 @@

import sys, os, re

PY2 = sys.version_info.major == 2

os.environ['PYMOR_WITH_SPHINX'] = '1'

# Fix documentation generation for readthedocs.org

if os.environ.get('READTHEDOCS', None) == 'True':
Expand Down Expand Up @@ -102,7 +106,7 @@ def __getattr__(cls, name):

# General substitutions.
project = 'pyMOR'
copyright = '2012-2015, the pyMOR AUTHORS'
copyright = '2012-2016, the pyMOR AUTHORS'

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
Expand All @@ -111,7 +115,7 @@ def __getattr__(cls, name):

# The full version, including alpha/beta/rc tags.
release = version.split('-')[0]
print version, release
print(version, release)

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down Expand Up @@ -277,7 +281,7 @@ def __getattr__(cls, name):

# autodoc_default_flags = ['members', 'undoc-members', 'show-inheritance']

intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None),
intersphinx_mapping = {'python': ('http://docs.python.org/' + ('2.7' if PY2 else '3'), None),
'numpy': ('http://docs.scipy.org/doc/numpy', None),
'scipy': ('http://docs.scipy.org/doc/scipy/reference', None)}

Expand Down
9 changes: 3 additions & 6 deletions docs/source/environment.rst
Expand Up @@ -15,12 +15,9 @@ PYMOR_CACHE_DISABLE
PYMOR_COLORS_DISABLE
If ``1``, disable coloring of logging output.

PYMOR_COPY_DOCSTRINGS_DISABLE
By default, docstrings of methods in base classes are copied
to overriding methods, if these do not define their own
docstring. Setting this variable to `1` disables this feature.
(We use this for when auto-generating API-documentation with
sphinx.)
PYMOR_WITH_SPHINX
This variable is set to `1` during API documentation generation
using sphinx.

PYMOR_DEFAULTS
If empty or ``NONE``, do not load any :mod:`~pymor.core.defaults`
Expand Down
6 changes: 2 additions & 4 deletions docs/source/gen_apidoc.py
Expand Up @@ -2,8 +2,6 @@
# Copyright 2013-2016 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)

from __future__ import print_function

from types import FunctionType

import pkgutil
Expand All @@ -29,7 +27,7 @@ def walk(module):
modules.append(module.__name__ + '.' + modname)
modules = sorted(modules)
packages = sorted(packages)
with open('{}/{}.rst'.format(BUILD_DIR, module.__name__), 'wb') as f:
with open('{}/{}.rst'.format(BUILD_DIR, module.__name__), 'wt') as f:
print(section('{} package'.format(module.__name__)), file=f)

print('.. automodule:: ' + module.__name__, file=f)
Expand All @@ -53,7 +51,7 @@ def walk(module):
print(' ' + option, file=f)
print('', file=f)
module = __import__(m, fromlist='none')
for k, v in sorted(module.__dict__.iteritems()):
for k, v in sorted(module.__dict__.items()):
if isinstance(v, (type, FunctionType)) and v.__module__ == m:
if v.__name__.startswith('_') and not v.__doc__:
continue
Expand Down