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

Remove six and future #112

Merged
merged 3 commits into from
Apr 7, 2021
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 .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ install:
# https://github.com/conda-forge/blas-feedstock/issues/58
- conda create -q -n test-env python=$TRAVIS_PYTHON_VERSION
- conda activate test-env
- conda install -y -q lapack "libblas=*=*netlib" cython>=0.26 future>=0.15 "ipopt=$IPOPT_VERSION" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0 six>=1.11
- conda install -y -q lapack "libblas=*=*netlib" cython>=0.26 "ipopt=$IPOPT_VERSION" numpy>=1.15 pkg-config>=0.29.2 setuptools>=39.0

before_script:
- conda info -a
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ Include sections:
Version History
---------------

[1.1.0.dev0] - XXXX-XX-XX
~~~~~~~~~~~~~~~~~~~~~~~~~

Removed
+++++++

- The six and future dependencies are removed.

[1.0.3] - 2021-04-07
~~~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 0 additions & 2 deletions conda/cyipopt-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ channels:
- conda-forge
dependencies:
- cython
- future
- ipopt
- libblas * *netlib
- numpy
Expand All @@ -12,5 +11,4 @@ dependencies:
- python >=3.6
- scipy
- setuptools
- six
- sphinx
2 changes: 0 additions & 2 deletions cyipopt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
License: EPL 1.0
"""

from __future__ import absolute_import

from ipopt_wrapper import *
from .ipopt_wrapper import *
from .scipy_interface import *
Expand Down
20 changes: 6 additions & 14 deletions cyipopt/cython/ipopt_wrapper.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import warnings

import numpy as np
cimport numpy as np
import six

from cyipopt.utils import deprecated_warning, generate_deprecation_warning_msg
from ipopt cimport *
Expand Down Expand Up @@ -280,7 +279,7 @@ cdef class Problem:
def __init__(self, n, m, problem_obj=None, lb=None, ub=None, cl=None,
cu=None):

if not isinstance(n, six.integer_types) or not n > 0:
if not isinstance(n, int) or not n > 0:
raise TypeError("n must be a positive integer")

if problem_obj is None:
Expand All @@ -304,7 +303,7 @@ cdef class Problem:
#
# Handle the constraints
#
if not isinstance(m, six.integer_types) or not m >= 0:
if not isinstance(m, int) or not m >= 0:
raise TypeError("m must be zero or a positive integer")

if m < 1:
Expand Down Expand Up @@ -400,8 +399,7 @@ cdef class Problem:
repr(nele_jac),
repr(nele_hess)
)
if six.PY3:
creation_msg = creation_msg.encode("utf8")
creation_msg = creation_msg.encode("utf8")

log(creation_msg, logging.DEBUG)

Expand Down Expand Up @@ -478,19 +476,13 @@ cdef class Problem:
definition as described in the Ipopt documentation.

"""
if six.PY3 and isinstance(keyword, type("")):
if isinstance(keyword, type("")):
keyword = bytes(keyword, "utf-8")

if six.PY3 and isinstance(val, type("")):
if isinstance(val, type("")):
val = bytes(val, "utf-8")

# NOTE : The strings passed in PY2 seem to be of type unicode.
if six.PY2:
keyword = str(keyword)
if isinstance(val, type(u'')):
val = str(val)

if isinstance(val, six.binary_type):
if isinstance(val, bytes):
ret_val = AddIpoptStrOption(self.__nlp, keyword, val)
elif type(val) == float:
ret_val = AddIpoptNumOption(self.__nlp, keyword, val)
Expand Down
2 changes: 0 additions & 2 deletions cyipopt/scipy_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
License: EPL 1.0
"""

from __future__ import absolute_import, unicode_literals
import sys

from builtins import bytes # from the future package
import numpy as np
try:
import scipy
Expand Down
1 change: 0 additions & 1 deletion cyipopt/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
elsewhere within this package for demonstration purposes.
"""

import builtins
import sys

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions docs/rtd-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ channels:
- conda-forge
dependencies:
- cython
- future
- ipopt
- lapack <3.9.0
- numpy
- numpydoc
- pkg-config
- setuptools
- six
- sphinx
14 changes: 6 additions & 8 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ dependencies:
* setuptools
* cython
* numpy
* six
* future
* scipy [optional]

The binaries and header files of the Ipopt package can be obtained from
Expand Down Expand Up @@ -64,11 +62,11 @@ From source on Windows

Install the dependencies with conda (Anaconda or Miniconda)::

$ conda.exe install -c conda-forge numpy cython future six setuptools
$ conda.exe install -c conda-forge numpy cython setuptools

Or alternatively with pip::

$ pip install numpy cython future six setuptools
$ pip install numpy cython setuptools

Additionally, make sure you have a C compiler setup to compile Python C
extensions, e.g. Visual C++. Build tools for VS2019
Expand Down Expand Up @@ -115,7 +113,7 @@ On Ubuntu 18.04 Using APT Dependencies

All of the dependencies can be installed with Ubuntu's package manager::

$ sudo apt install build-essential pkg-config python-dev python-six cython python-numpy coinor-libipopt1v5 coinor-libipopt-dev
$ sudo apt install build-essential pkg-config python-dev cython python-numpy coinor-libipopt1v5 coinor-libipopt-dev

The NumPy and IPOPT libs and headers are installed in standard locations, so
you should not need to set ``LD_LIBRARY_PATH`` or ``PKG_CONFIG_PATH``.
Expand Down Expand Up @@ -184,9 +182,9 @@ prepend ``sudo`` to the above command, but it is safest to install into your
user space, i.e. what ``pip install --user`` does, or setup a virtual
environment with tools like venv or conda. If you use virtual environments you
will need to be careful about selecting headers and libraries for packages in
or out of the virtual environments in the build step. Note that six, cython,
or out of the virtual environments in the build step. Note that cython,
and numpy could alternatively be installed using Python specific package
managers, e.g. ``pip install six cython numpy``.
managers, e.g. ``pip install cython numpy``.

On Ubuntu 18.04 with Custom Compiled IPOPT
------------------------------------------
Expand All @@ -202,7 +200,7 @@ Install ``pip`` so all Python packages can be installed via ``pip``::

Then use ``pip`` to install the following packages::

$ pip install --user numpy cython six future
$ pip install --user numpy cython

Compile Ipopt
~~~~~~~~~~~~~
Expand Down
2 changes: 0 additions & 2 deletions examples/hs071.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#
# Based on matlab code by Peter Carbonetto.

from __future__ import print_function, unicode_literals

import numpy as np
import cyipopt

Expand Down
1 change: 0 additions & 1 deletion examples/lasso.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#
# Adapted from matlab code by Peter Carbonetto.
#
from __future__ import division
import numpy as np
import cyipopt

Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
cython>=0.26
future>=0.15
ipopt>=3.12
numpy>=1.15
pkg-config>=0.29.2
setuptools>=39.0
six>=1.11
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@
URL = "https://github.com/mechmotum/cyipopt"
INSTALL_REQUIRES = [
"cython>=0.26",
"future>=0.15",
"numpy>=1.15",
"setuptools>=39.0",
"six>=1.11",
]
LICENSE = "EPL-1.0"
CLASSIFIERS = [
Expand Down