Skip to content

Commit

Permalink
Updating all PyPy usage to be Python 3 only.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Aug 7, 2019
1 parent 3eaa5aa commit 1e3037f
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 56 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Expand Up @@ -16,8 +16,8 @@ jobs:
name: Unit tests in Python 3.6
command: nox -s "unit-3.6"
- run:
name: Unit tests in pypy
command: nox -s "unit-pypy"
name: Unit tests in pypy3
command: nox -s "unit-pypy3"
- run:
name: Unit tests AND line coverage in Python 3.7
command: nox -s cover
Expand Down
22 changes: 11 additions & 11 deletions DEVELOPMENT.rst
Expand Up @@ -115,7 +115,7 @@ We recommend using `Nox`_ to run unit tests:
$ nox -s "unit-3.6"
$ nox -s "unit-3.7"
$ nox -s "unit-pypy"
$ nox -s "unit-pypy3"
$ nox -s unit # Run all versions
However, `pytest`_ can be used directly (though it won't
Expand All @@ -125,7 +125,7 @@ manage dependencies or build extensions):
$ PYTHONPATH=src/ python3.6 -m pytest tests/unit/
$ PYTHONPATH=src/ python3.7 -m pytest tests/unit/
$ PYTHONPATH=src/ pypy -m pytest tests/unit/
$ PYTHONPATH=src/ pypy3 -m pytest tests/unit/
.. _Nox: https://nox.readthedocs.io
.. _pytest: https://docs.pytest.org
Expand Down Expand Up @@ -203,17 +203,17 @@ prohibitive to create a new environment for testing.

In order to avoid this penalty, the ``WHEELHOUSE`` environment
variable can be used to instruct ``nox`` to install NumPy and SciPy
from locally built wheels when installing the ``pypy`` sessions.
from locally built wheels when installing the ``pypy3`` sessions.

To pre-build NumPy and SciPy wheels:

.. code-block:: console
$ pypy -m virtualenv pypy-venv
$ pypy-venv/bin/python -m pip wheel --wheel-dir=${WHEELHOUSE} numpy
$ pypy-venv/bin/python -m pip install ${WHEELHOUSE}/numpy*.whl
$ pypy-venv/bin/python -m pip wheel --wheel-dir=${WHEELHOUSE} scipy
$ rm -fr pypy-venv/
$ pypy3 -m virtualenv pypy3-venv
$ pypy3-venv/bin/python -m pip wheel --wheel-dir=${WHEELHOUSE} numpy
$ pypy3-venv/bin/python -m pip install ${WHEELHOUSE}/numpy*.whl
$ pypy3-venv/bin/python -m pip wheel --wheel-dir=${WHEELHOUSE} scipy
$ rm -fr pypy3-venv/
Alternatively, wheels can be downloaded from `pypy-wheels`_, however
the SciPy wheel will still require ``libatlas-dev``, ``libblas-dev`` and
Expand Down Expand Up @@ -246,12 +246,12 @@ To run the functional tests:
$ nox -s "functional-3.6"
$ nox -s "functional-3.7"
$ nox -s "functional-pypy"
$ nox -s "functional-pypy3"
$ nox -s functional # Run all versions
$ # OR
$ PYTHONPATH=src/ python3.6 -m pytest tests/functional/
$ PYTHONPATH=src/ python3.7 -m pytest tests/functional/
$ PYTHONPATH=src/ pypy -m pytest tests/functional/
$ PYTHONPATH=src/ pypy3 -m pytest tests/functional/
.. _functional tests: https://github.com/dhermes/bezier/tree/master/tests/functional

Expand Down Expand Up @@ -539,7 +539,7 @@ and for running tests and interacting with Continuous Integration
services:

- ``WHEELHOUSE``: If set, this gives a path to prebuilt NumPy and SciPy wheels
for PyPy.
for PyPy 3.
- ``GENERATE_IMAGES``: Indicates to ``nox -s doctest`` that images should
be generated during cleanup of each test case.
- ``APPVEYOR``: Indicates currently running on AppVeyor.
Expand Down
22 changes: 11 additions & 11 deletions DEVELOPMENT.rst.template
Expand Up @@ -115,7 +115,7 @@ We recommend using `Nox`_ to run unit tests:

$ nox -s "unit-3.6"
$ nox -s "unit-3.7"
$ nox -s "unit-pypy"
$ nox -s "unit-pypy3"
$ nox -s unit # Run all versions

However, `pytest`_ can be used directly (though it won't
Expand All @@ -125,7 +125,7 @@ manage dependencies or build extensions):

$ PYTHONPATH=src/ python3.6 -m pytest tests/unit/
$ PYTHONPATH=src/ python3.7 -m pytest tests/unit/
$ PYTHONPATH=src/ pypy -m pytest tests/unit/
$ PYTHONPATH=src/ pypy3 -m pytest tests/unit/

.. _Nox: https://nox.readthedocs.io
.. _pytest: https://docs.pytest.org
Expand Down Expand Up @@ -203,17 +203,17 @@ prohibitive to create a new environment for testing.

In order to avoid this penalty, the ``WHEELHOUSE`` environment
variable can be used to instruct ``nox`` to install NumPy and SciPy
from locally built wheels when installing the ``pypy`` sessions.
from locally built wheels when installing the ``pypy3`` sessions.

To pre-build NumPy and SciPy wheels:

.. code-block:: console

$ pypy -m virtualenv pypy-venv
$ pypy-venv/bin/python -m pip wheel --wheel-dir=${{WHEELHOUSE}} numpy
$ pypy-venv/bin/python -m pip install ${{WHEELHOUSE}}/numpy*.whl
$ pypy-venv/bin/python -m pip wheel --wheel-dir=${{WHEELHOUSE}} scipy
$ rm -fr pypy-venv/
$ pypy3 -m virtualenv pypy3-venv
$ pypy3-venv/bin/python -m pip wheel --wheel-dir=${{WHEELHOUSE}} numpy
$ pypy3-venv/bin/python -m pip install ${{WHEELHOUSE}}/numpy*.whl
$ pypy3-venv/bin/python -m pip wheel --wheel-dir=${{WHEELHOUSE}} scipy
$ rm -fr pypy3-venv/

Alternatively, wheels can be downloaded from `pypy-wheels`_, however
the SciPy wheel will still require ``libatlas-dev``, ``libblas-dev`` and
Expand Down Expand Up @@ -246,12 +246,12 @@ To run the functional tests:

$ nox -s "functional-3.6"
$ nox -s "functional-3.7"
$ nox -s "functional-pypy"
$ nox -s "functional-pypy3"
$ nox -s functional # Run all versions
$ # OR
$ PYTHONPATH=src/ python3.6 -m pytest tests/functional/
$ PYTHONPATH=src/ python3.7 -m pytest tests/functional/
$ PYTHONPATH=src/ pypy -m pytest tests/functional/
$ PYTHONPATH=src/ pypy3 -m pytest tests/functional/

.. _functional tests: https://github.com/dhermes/bezier/tree/{revision}/tests/functional

Expand Down Expand Up @@ -539,7 +539,7 @@ and for running tests and interacting with Continuous Integration
services:

- ``WHEELHOUSE``: If set, this gives a path to prebuilt NumPy and SciPy wheels
for PyPy.
for PyPy 3.
- ``GENERATE_IMAGES``: Indicates to ``nox -s doctest`` that images should
be generated during cleanup of each test case.
- ``APPVEYOR``: Indicates currently running on AppVeyor.
Expand Down
9 changes: 4 additions & 5 deletions docs/python/binary-extension.rst.template
Expand Up @@ -299,11 +299,10 @@ Though the Python extension module (``.so`` file) only depends on
>>> invoke_shell("otool", "-L", ".dylibs/libgfortran.5.dylib")
$ otool -L .dylibs/libgfortran.5.dylib
.dylibs/libgfortran.5.dylib:
/DLC/bezier/libgfortran.5.dylib (...)
@loader_path/libquadmath.0.dylib (...)
/usr/lib/libz.1.dylib (...)
/usr/lib/libSystem.B.dylib (...)
@loader_path/libgcc_s.1.dylib (...)
/DLC/bezier/libgfortran.5.dylib (...)
@loader_path/libquadmath.0.dylib (...)
/usr/lib/libSystem.B.dylib (...)
@loader_path/libgcc_s.1.dylib (...)

.. note::

Expand Down
7 changes: 1 addition & 6 deletions noxfile.py
Expand Up @@ -33,7 +33,6 @@
"jsonschema": "jsonschema >= 3.0.2",
"lcov_cobertura": "lcov_cobertura",
"matplotlib": "matplotlib >= 3.1.1",
"mock": "mock >= 3.0.5",
"numpy": "numpy >= 1.17.0",
"pycobertura": "pycobertura",
"Pygments": "Pygments",
Expand All @@ -51,7 +50,7 @@
os.path.join(NOX_DIR, "docs", "requirements.txt"),
)
DEFAULT_INTERPRETER = "3.7"
PYPY = "pypy"
PYPY = "pypy3"
ALL_INTERPRETERS = ("3.6", "3.6-32", "3.7", "3.7-32", PYPY)
# Constants used for checking the journal of commands.
APPVEYOR = "appveyor"
Expand Down Expand Up @@ -124,8 +123,6 @@ def unit(session):
local_deps = pypy_setup(BASE_DEPS, session)
else:
local_deps = BASE_DEPS + (DEPS["scipy"],)
if interpreter == PYPY:
local_deps += (DEPS["mock"],)

# Install all test dependencies.
session.install(*local_deps)
Expand Down Expand Up @@ -161,8 +158,6 @@ def functional(session):
local_deps = pypy_setup(BASE_DEPS, session)
else:
local_deps = BASE_DEPS
if interpreter == PYPY:
local_deps += (DEPS["mock"],)

# Install all test dependencies.
session.install(*local_deps)
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/README.md
Expand Up @@ -6,7 +6,7 @@

This repository is intended to be used as a fully-functional environment for installing / running / testing `bezier`. Provides:

- CPython 3.5, 3.6, 3.7 and PyPy 3.5 (version 6.0.0)
- CPython 3.6, 3.7 and PyPy 3.6 (version 7.1.1)
- NumPy pre-installed (needed for installing extensions)
- `/wheelhouse` directory with NumPy and SciPy pre-built for PyPy 3
- `gfortran` compiler
Expand Down
26 changes: 9 additions & 17 deletions scripts/docker/bezier.Dockerfile
Expand Up @@ -23,20 +23,12 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb

# Build NumPy and SciPy wheels for PyPy since it takes a bit of time.
RUN for PYPY in pypy pypy3; do \
set -ex \
&& virtualenv --python=${PYPY} pypy-env \
&& pypy-env/bin/python -m pip install --upgrade pip wheel \
&& mkdir /wheelhouse-${PYPY} \
&& pypy-env/bin/python -m pip wheel --wheel-dir=/wheelhouse-${PYPY} numpy==1.15.4 \
&& pypy-env/bin/python -m pip install /wheelhouse-${PYPY}/numpy*.whl \
&& pypy-env/bin/python -m pip wheel --wheel-dir=/wheelhouse-${PYPY} scipy==1.2.2 \
&& rm -fr pypy-env \
; done

# Combine the version specific wheelhouses into one directory.
RUN mkdir /wheelhouse \
&& mv /wheelhouse-pypy/* /wheelhouse \
&& mv /wheelhouse-pypy3/* /wheelhouse \
&& rm -fr /wheelhouse-pypy /wheelhouse-pypy3
# Build NumPy and SciPy wheels for PyPy 3 since it takes a bit of time.
RUN mkdir /wheelhouse
RUN set -ex \
&& virtualenv --python=pypy3 pypy3-env \
&& pypy3-env/bin/python -m pip install --upgrade pip wheel \
&& pypy3-env/bin/python -m pip wheel --wheel-dir=/wheelhouse numpy==1.17.0 \
&& pypy3-env/bin/python -m pip install /wheelhouse/numpy*.whl \
&& pypy3-env/bin/python -m pip wheel --wheel-dir=/wheelhouse scipy==1.3.0 \
&& rm -fr pypy3-env
3 changes: 0 additions & 3 deletions tests/conftest.py
Expand Up @@ -18,9 +18,6 @@
``py.test --durations=N``.
"""

import sys
import unittest

import pytest

try:
Expand Down

0 comments on commit 1e3037f

Please sign in to comment.