Skip to content

Commit

Permalink
[work in progress] Dropping Python 2 support (#286)
Browse files Browse the repository at this point in the history
* refactored away externals

* deleted externals

* removed support for old sklearn

* removed 'base.py', importing from sklearn instead

* Revert "flake8 in CI for tests too. verbose output from tests and slowest"

This reverts commit a80848c.

* Revert "deleted externals"

This reverts commit 5325e2a.

* Revert "Revert "deleted externals""

This reverts commit 5d55acf.

* Revert "Revert "flake8 in CI for tests too. verbose output from tests and slowest""

This reverts commit ffb92a7.

* Revert "removed 'base.py', importing from sklearn instead"

This reverts commit 6813f48.

* Revert "Revert "removed 'base.py', importing from sklearn instead""

This reverts commit 46c0187.

* Revert "Revert "Revert "flake8 in CI for tests too. verbose output from tests and slowest"""

This reverts commit f338929.

* Revert "Revert "Revert "deleted externals"""

This reverts commit d53f165.

* Revert "Revert "deleted externals""

This reverts commit 5d55acf.

* Revert "Revert "flake8 in CI for tests too. verbose output from tests and slowest""

This reverts commit ffb92a7.

* Revert "removed 'base.py', importing from sklearn instead"

This reverts commit 6813f48.

* reverted

* deleted 'externals' folder for py2 compatibility

* mentioned python 3.5+ in README and docs

* updated urllib to Python 3 compatibility

* added forgotten import

* trying to use python 3 on circleCI

* Revert "trying to use python 3 on circleCI"

This reverts commit 731f5fd.

* added some lines to circleCI

* using py3 in circleCI

* removed apt get update from circleCI

* activating env in circleCI

* quiet installation with pip
  • Loading branch information
tommyod authored and jasmainak committed Apr 4, 2019
1 parent a80848c commit ea828a5
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 1,419 deletions.
18 changes: 11 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@ jobs:
- run:
name: Setup Python environment
command: |
pip install --upgrade pip
pip install sphinx matplotlib coverage Pillow
pip install sphinx-gallery
pip install scipy
pip install scikit-learn
pip install pandas
conda update --yes conda
conda create -n testenv --yes python=3.7
source activate testenv
pip install --upgrade pip -q
pip install sphinx matplotlib coverage Pillow -q
pip install sphinx-gallery -q
pip install scipy scikit-learn pandas -q
pip install -e .
pip install sphinx_bootstrap_theme numpydoc
pip install sphinx_bootstrap_theme numpydoc -q
pip install -e git+http://github.com/KordingLab/spykes.git#egg=spykes
python --version
pip list
- run:
name: Build the documentation
command: |
source activate testenv
cd doc && make html
- store_artifacts:
path: doc/_build/html/
Expand Down
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
env:
- PYTHON=2.7
- PYTHON=3.5
- PYTHON=3.6
- PYTHON=3.7
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ specifically,
provides elastic net and group lasso regularization, but only for
linear and logistic regression.

**Pyglmnet** is a response to this fragmentation. Here are some
highlights.
**Pyglmnet** is a response to this fragmentation. It runs on Python 3.5+,
and here are some of the highlights.

- Pyglmnet provides a wide range of noise models (and paired canonical
link functions): ``'gaussian'``, ``'binomial'``, ``'multinomial'``,
Expand Down Expand Up @@ -168,7 +168,7 @@ optimization and pseudo-code.

Here are
`slides <https://pavanramkumar.github.io/pydata-chicago-2016>`__ from a
recent talk at `PyData Chicago
talk at `PyData Chicago
2016 <http://pydata.org/chicago2016/schedule/presentation/15/>`__,
corresponding `tutorial
notebooks <http://github.com/pavanramkumar/pydata-chicago-2016>`__ and a
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Python implementation of regularized generalized linear models
==============================================================

Pyglmnet is a Python library implementing generalized linear models (GLMs)
Pyglmnet is a Python 3.5+ library implementing generalized linear models (GLMs)
with advanced regularization options. It provides a wide range of noise models
(with paired canonical link functions) including gaussian, binomial, multinomial,
poisson, and softplus. It supports a wide range of regularizers: ridge, lasso,
Expand Down
10 changes: 3 additions & 7 deletions pyglmnet/base.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import warnings
from distutils.version import LooseVersion

from .externals.six import iteritems

##############################################################################
# adapted from scikit-learn

Expand Down Expand Up @@ -61,10 +59,8 @@ class BaseEstimator(object):
@classmethod
def _get_param_names(cls):
"""Get parameter names for the estimator"""
try:
from inspect import signature
except ImportError:
from .externals.funcsigs import signature
from inspect import signature

# fetch the constructor or the original constructor before
# deprecation wrapping if any
init = getattr(cls.__init__, 'deprecated_original', cls.__init__)
Expand Down Expand Up @@ -138,7 +134,7 @@ def set_params(self, **params):
# Simple optimisation to gain speed (inspect is slow)
return self
valid_params = self.get_params(deep=True)
for key, value in iteritems(params):
for key, value in params.items():
split = key.split('__', 1)
if len(split) > 1:
# nested objects case
Expand Down
11 changes: 5 additions & 6 deletions pyglmnet/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import itertools
import numpy as np
from scipy.misc import comb

from .externals.six.moves import urllib
from urllib.request import urlretrieve

pbar = None

Expand Down Expand Up @@ -50,7 +49,7 @@ def fetch_tikhonov_data(dpath='/tmp/glm-tools'):
for fname in fnames:
url = os.path.join(base_url, "tikhonov/%s" % fname)
fname = os.path.join(dpath, fname)
urllib.request.urlretrieve(url, fname, _reporthook)
urlretrieve(url, fname, _reporthook)

return dpath

Expand Down Expand Up @@ -86,7 +85,7 @@ def fetch_community_crime_data(dpath='/tmp/glm-tools'):
fname = os.path.join(dpath, 'communities.csv')
base_url = ("http://archive.ics.uci.edu/ml/machine-learning-databases")
url = os.path.join(base_url, "communities/communities.data")
urllib.request.urlretrieve(url, fname, _reporthook)
urlretrieve(url, fname, _reporthook)

# Read in the file
df = pd.read_csv('/tmp/glm-tools/communities.csv', header=None)
Expand Down Expand Up @@ -207,8 +206,8 @@ def create_feature_vector_for_sequence(seq,
pos_file = tempfile.NamedTemporaryFile(bufsize=0)
neg_file = tempfile.NamedTemporaryFile(bufsize=0)

urllib.request.urlretrieve(positive_url, pos_file.name, _reporthook)
urllib.request.urlretrieve(negative_url, neg_file.name, _reporthook)
urlretrieve(positive_url, pos_file.name, _reporthook)
urlretrieve(negative_url, neg_file.name, _reporthook)

positive_sequences = [str(line.strip().upper()) for idx, line in
enumerate(pos_file.readlines())
Expand Down
2 changes: 0 additions & 2 deletions pyglmnet/externals/__init__.py

This file was deleted.

0 comments on commit ea828a5

Please sign in to comment.