Skip to content

Commit

Permalink
Merge pull request #58 from SmokinCaterpillar/python38
Browse files Browse the repository at this point in the history
updated pypet to work with python 3.8 and pandas 1.0
  • Loading branch information
SmokinCaterpillar committed Jun 1, 2020
2 parents e06b598 + cfa3288 commit 97453dc
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 41 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ addons:

matrix:
include:
- python: 3.5
- python: 3.7
env: COVERAGE=OFF GIT_TEST=OFF EXAMPLES=OFF TEST_SUITE=SINGLECORE SCOOP=OFF
- python: 3.6
- python: 3.8
env: COVERAGE=OFF GIT_TEST=OFF EXAMPLES=OFF TEST_SUITE=MULTIPROC SCOOP=OFF
- python: 3.5
env: COVERAGE=ON GIT_TEST=ON EXAMPLES=OFF TEST_SUITE=OFF SCOOP=OFF
- python: 3.6
env: COVERAGE=ON GIT_TEST=ON EXAMPLES=OFF TEST_SUITE=OFF SCOOP=OFF
- python: 3.8
env: COVERAGE=OFF GIT_TEST=ON EXAMPLES=ON TEST_SUITE=OFF SCOOP=ON


Expand Down Expand Up @@ -75,4 +75,5 @@ branches:
- master
- brian2
- py3only
- python38

7 changes: 7 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
pypet 0.5.0

* Fix to work with pandas 1.0
* Fix to work with brian2 2.3
* Fix to work with Python 3.7 and 3.8
* Removal `expectedrows` and `filters` option for HDF5Storage.put as this is no longer supported by pandas

pypet 0.4.3

* DEPR: Removed pandas Panel and Panel4D (see also https://github.com/pandas-dev/pandas/pull/13776)
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2013-2018, Robert Meyer
Copyright (c) 2013-2020, Robert Meyer
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ analyses becomes a piece of cake!

Python 3.5 or 3.6 and

* tables >= 3.1.1
* tables >= 3.5.0

* pandas >= 0.20.0
* pandas >= 1.0.0

* numpy >= 1.12.0
* numpy >= 1.16.0

* scipy >= 0.17.0
* scipy >= 1.3.0

* HDF5 >= 1.8.9
* HDF5 >= 1.10.0


There are also some optional packages that you can but do not have to install.
Expand All @@ -40,15 +40,15 @@ If you want to combine *pypet* with SCOOP you need

For git integration you additionally need

* GitPython >= 0.3.1
* GitPython >= 3.1.3

To utilize the cap feature for multiprocessing you need

* psutil >= 2.0.0
* psutil >= 5.7.0

To utilize the continuing of crashed trajectories you need

* dill >= 0.2.1
* dill >= 0.3.1

Automatic Sumatra records are supported for

Expand Down
15 changes: 8 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,49 @@ environment:

matrix:
- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "64"
MULTIPROC: "OFF"
SINGLECORE: "1"
EXAMPLES: "ON"

- PYTHON: "C:\\Python35_32"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "32"
MULTIPROC: "1"
SINGLECORE: "OFF"
EXAMPLES: "OFF"

- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "64"
MULTIPROC: "3"
SINGLECORE: "OFF"
EXAMPLES: "OFF"

- PYTHON: "C:\\Python35_32"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "32"
MULTIPROC: "2"
SINGLECORE: "OFF"
EXAMPLES: "OFF"

- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "64"
MULTIPROC: "4"
SINGLECORE: "OFF"
EXAMPLES: "OFF"

- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "64"
MULTIPROC: "OFF"
SINGLECORE: "2"
EXAMPLES: "ON"

- PYTHON: "C:\\Python35_32"
PYTHON_VERSION: "3.5"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "32"
MULTIPROC: "OFF"
SINGLECORE: "3"
Expand Down Expand Up @@ -83,6 +83,7 @@ branches:
- develop
- brian2
- py3only
- python38


test_script:
Expand Down
2 changes: 1 addition & 1 deletion ciscripts/appveyor/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $MINICONDA_URL = "http://repo.continuum.io/miniconda/"

function DownloadMiniconda ($python_version, $platform_suffix) {
$webclient = New-Object System.Net.WebClient
if ($python_version -match "3.5") {
if ($python_version -match "3.8") {
$filename = "Miniconda3-latest-Windows-" + $platform_suffix + ".exe"
} else {
$filename = "Miniconda-latest-Windows-" + $platform_suffix + ".exe"
Expand Down
6 changes: 3 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@

# General information about the project.
project = u'pypet'
copyright = u'2013, Robert Meyer'
copyright = u'2020, Robert Meyer'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '0.4'
version = '0.5'
# The full version, including alpha/beta/rc tags.
release = '0.4.2'
release = '0.5.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
18 changes: 9 additions & 9 deletions doc/source/manual/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,17 @@ Getting Started
Requirements
------------

3.4, 3.5, or 3.6 [#pythonversion]_, and
3.6, 3.7, or 3.8 [#pythonversion]_, and

* numpy_ >= 1.13.0
* numpy_ >= 1.16.0

* scipy_ >= 1.0.0

* tables_ >= 3.1.1
* tables_ >= 3.5.0

* pandas_ >= 0.23.0
* pandas_ >= 1.0.0

* HDF5_ >= 1.8.9
* HDF5_ >= 1.10.0

Python 2.6 and 2.7 are no longer supported. Still if you
need *pypet* for these versions check out the legacy `0.3.0`_ package.
Expand All @@ -115,15 +115,15 @@ If you want to combine *pypet* with the `SCOOP framework`_ you need

For git integration you additionally need

* GitPython_ >= 0.3.1
* GitPython_ >= 3.1.3

To utilize the cap feature for :ref:`more-on-multiprocessing` you need

* psutil_ >= 2.0.0
* psutil_ >= 5.7.0

To utilize the continuing of crashed trajectories you need

* dill_ >= 0.2.1
* dill_ >= 0.3.1

Automatic sumatra records are supported for

Expand All @@ -133,7 +133,7 @@ Automatic sumatra records are supported for

.. [#pythonversion]
*pypet* might also work under Python 3.0-3.2 but has not been tested.
*pypet* might also work under Python 3.0-3.5 but has not been tested.
-------
Expand Down
2 changes: 1 addition & 1 deletion pypet/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4.4dev'
__version__ = '0.5.0dev'
2 changes: 1 addition & 1 deletion pypet/brian2/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def unit_from_expression(expr):
return unit_from_expression(expr)
elif expr.__class__ is ast.Name:
return ALLUNITS[expr.id]
elif expr.__class__ is ast.Num:
elif expr.__class__ is ast.Num or expr.__class__ is ast.Constant:
return expr.n
elif expr.__class__ is ast.UnaryOp:
op = expr.op.__class__.__name__
Expand Down
9 changes: 5 additions & 4 deletions pypet/storageservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4182,8 +4182,8 @@ def _prm_write_pandas_data(self, key, data, group, fullname, flag, **kwargs):
"""
try:
if 'filters' not in kwargs:
filters = self._all_get_filters(kwargs)
kwargs['filters'] = filters
self._logger.debug(
'filters are no longer supported by pandas')
if 'format' not in kwargs:
kwargs['format'] = self.pandas_format
if 'encoding' not in kwargs:
Expand All @@ -4198,8 +4198,9 @@ def _prm_write_pandas_data(self, key, data, group, fullname, flag, **kwargs):
else:
self._logger.debug('Appending to pandas data `%s` in `%s`' % (key, fullname))

if data is not None and (kwargs['format'] == 'f' or kwargs['format'] == 'fixed'):
kwargs['expectedrows'] = data.shape[0]
if 'expectedrows' in kwargs:
self._logger.debug('expectedrows no longer supported by pandas, will '
'ignore the option')

name = group._v_pathname + '/' + key
self._hdf5store.put(name, data, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion pypet/utils/comparisons.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def nested_equal(a, b):
new_frame = a == b
new_frame = new_frame | (pd.isnull(a) & pd.isnull(b))
if isinstance(new_frame, pd.DataFrame):
return np.all(new_frame.as_matrix())
return np.all(new_frame.values)
except (ValueError, TypeError):
# The Value Error can happen if the data frame is of dtype=object and contains
# numpy arrays. Numpy array comparisons do not evaluate to a single truth value
Expand Down
7 changes: 6 additions & 1 deletion pypet/utils/helpful_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ def __next__(self):

def __iter__(self):
while True:
yield self.next()
try:
yield self.next()
except StopIteration:
# new behavior since PEP479
# one should return to stop iteration
return


class ChainMap(object):
Expand Down

0 comments on commit 97453dc

Please sign in to comment.