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

[work in progress] Dropping Python 2 support #286

Merged
merged 27 commits into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e6eaf46
refactored away externals
tommyod Mar 31, 2019
5325e2a
deleted externals
tommyod Mar 31, 2019
4c073f8
removed support for old sklearn
tommyod Mar 31, 2019
6813f48
removed 'base.py', importing from sklearn instead
tommyod Mar 31, 2019
ffb92a7
Revert "flake8 in CI for tests too. verbose output from tests and slo…
tommyod Apr 1, 2019
5d55acf
Revert "deleted externals"
tommyod Apr 1, 2019
d53f165
Revert "Revert "deleted externals""
tommyod Apr 1, 2019
f338929
Revert "Revert "flake8 in CI for tests too. verbose output from tests…
tommyod Apr 1, 2019
46c0187
Revert "removed 'base.py', importing from sklearn instead"
tommyod Apr 1, 2019
61d70d7
Revert "Revert "removed 'base.py', importing from sklearn instead""
tommyod Apr 1, 2019
7c0d7ef
Revert "Revert "Revert "flake8 in CI for tests too. verbose output fr…
tommyod Apr 1, 2019
cad6bcc
Revert "Revert "Revert "deleted externals"""
tommyod Apr 1, 2019
4dc4d31
Revert "Revert "deleted externals""
tommyod Apr 1, 2019
5cb4658
Revert "Revert "flake8 in CI for tests too. verbose output from tests…
tommyod Apr 1, 2019
d74da91
Revert "removed 'base.py', importing from sklearn instead"
tommyod Apr 1, 2019
0f684c9
reverted
tommyod Apr 1, 2019
2ceda46
deleted 'externals' folder for py2 compatibility
tommyod Apr 2, 2019
a97fa20
mentioned python 3.5+ in README and docs
tommyod Apr 2, 2019
6297254
updated urllib to Python 3 compatibility
tommyod Apr 2, 2019
ea8de7e
added forgotten import
tommyod Apr 2, 2019
731f5fd
trying to use python 3 on circleCI
tommyod Apr 2, 2019
1caa192
Revert "trying to use python 3 on circleCI"
tommyod Apr 2, 2019
33c58d0
added some lines to circleCI
tommyod Apr 2, 2019
9868acf
using py3 in circleCI
tommyod Apr 2, 2019
f6c6fba
removed apt get update from circleCI
tommyod Apr 2, 2019
21d7da4
activating env in circleCI
tommyod Apr 2, 2019
0672c6d
quiet installation with pip
tommyod Apr 3, 2019
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
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.