diff --git a/.travis.yml b/.travis.yml index 3e3e20017..9c6bfa121 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,10 @@ before_install: - hash -r - conda config --add channels conda-forge - conda config --set always_yes yes --set changeps1 no + # workaround for conda >= 4.8 + - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then + pip install tqdm; + fi - conda update -q conda # Useful for debugging any issues with conda @@ -41,7 +45,7 @@ install: # (issue 702 : fixed bug when writing metadata using HDF format) - conda create -n travisci --yes python=${TRAVIS_PYTHON_VERSION:0:3} "numpy>=1.13" "pandas>=0.20" pytables matplotlib xlrd openpyxl - xlsxwriter pytest pytest-pep8 + xlsxwriter "pytest>=3.5" pytest-pep8 - source activate travisci script: diff --git a/condarecipe/larray/meta.yaml b/condarecipe/larray/meta.yaml index 150cdd70a..25e9f69d6 100644 --- a/condarecipe/larray/meta.yaml +++ b/condarecipe/larray/meta.yaml @@ -1,9 +1,9 @@ package: name: larray - version: 0.32.1 + version: 0.32.2 source: - git_tag: 0.32.1 + git_tag: 0.32.2 git_url: https://github.com/larray-project/larray.git # git_tag: master # git_url: file://c:/Users/gdm/devel/larray/.git diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 000000000..1b1121016 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,12 @@ +numpy +pandas +matplotlib +tables # ==pytables +xlrd +openpyxl +sphinx +numpydoc +pandoc +ipython +ipykernel +nbsphinx diff --git a/doc/source/_static/custom.css b/doc/source/_static/custom.css new file mode 100644 index 000000000..2dbf54ecb --- /dev/null +++ b/doc/source/_static/custom.css @@ -0,0 +1,13 @@ +.classifier { + font-style: oblique; +} + +/* +Workaround for an incompatibility between read the docs theme and sphinx 2.0+ +See: https://github.com/larray-project/larray/issues/849 +*/ +.classifier:before { + font-style: normal; + margin: 0.5em; + content: ":"; +} diff --git a/doc/source/changes.rst b/doc/source/changes.rst index e531b1f51..3968e6a11 100644 --- a/doc/source/changes.rst +++ b/doc/source/changes.rst @@ -1,6 +1,20 @@ Change log ########## +Version 0.32.2 +============== + +Released on 2020-04-03. + +CORE +---- +.. include:: ./changes/version_0_32_2.rst.inc + +EDITOR +------ +.. include:: ./changes/editor/version_0_32_2.rst.inc + + Version 0.32.1 ============== diff --git a/doc/source/changes/editor/version_0_32_2.rst.inc b/doc/source/changes/editor/version_0_32_2.rst.inc new file mode 100644 index 000000000..fb03061e7 --- /dev/null +++ b/doc/source/changes/editor/version_0_32_2.rst.inc @@ -0,0 +1,8 @@ +.. py:currentmodule:: larray_editor + +Fixes +^^^^^ + +* fixed spurious warning in the console when an expression results in an empty sequence (array, list, tuple). + +* fixed displaying arrays entirely filled with NaN. diff --git a/doc/source/changes/version_0_32_2.rst.inc b/doc/source/changes/version_0_32_2.rst.inc new file mode 100644 index 000000000..21d2f9f13 --- /dev/null +++ b/doc/source/changes/version_0_32_2.rst.inc @@ -0,0 +1,11 @@ +.. py:currentmodule:: larray + + +Fixes +^^^^^ + +* fixed using Pandas >= 1.0 (closes :issue:`845`). + +* fixed the missing space between parameters name and type in API documentation (closes :issue:`849`). + +* fixed a few issues for Python 2.7 and/or Linux. diff --git a/doc/source/conf.py b/doc/source/conf.py index 49d30e398..e6ed243f5 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -104,7 +104,7 @@ # General information about the project. project = 'LArray' -copyright = '2014-2017, Gaëtan de Menten, Geert Bryon, Johan Duyck, Alix Damman' +copyright = '2014-2020, Gaëtan de Menten, Geert Bryon, Johan Duyck, Alix Damman' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -190,6 +190,15 @@ # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] +# Workaround for an incompatibility between read the docs theme and sphinx 2.0+. +# See: https://github.com/larray-project/larray/issues/849 + +# These paths are either relative to html_static_path +# or fully qualified paths (eg. https://...) +html_css_files = [ + 'custom.css', +] + # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. diff --git a/doc/source/fetch_changelogs.py b/doc/source/fetch_changelogs.py index 9ef3e7031..1a7a33b01 100644 --- a/doc/source/fetch_changelogs.py +++ b/doc/source/fetch_changelogs.py @@ -30,13 +30,13 @@ def fetch_changelog(section_name, release_name, github_rep, rel_changes_dir='/do ['git', 'commit', '-m', f'fetched {section_name} changelog for {short(release_name)}', str(fpath)]) -def fetch_changelogs(release_name): - fetch_changelog('editor', release_name, EDITOR_GITHUB_REP) +def fetch_changelogs(release_name, branch='master'): + fetch_changelog('editor', release_name, EDITOR_GITHUB_REP, branch=branch) - print(echocall(['git', 'log', 'upstream/master..HEAD'])) + print(echocall(['git', 'log', f'origin/{branch}..HEAD'])) if yes('Are the above commits ready to be pushed?', default='n'): doechocall('Pushing changes to GitHub', - ['git', 'push', 'upstream', 'master', '--follow-tags']) + ['git', 'push', 'origin', branch, '--follow-tags']) if __name__ == '__main__': @@ -44,7 +44,7 @@ def fetch_changelogs(release_name): argv = sys.argv if len(argv) < 2: - print(f"Usage: {argv[0]} release_name") + print(f"Usage: {argv[0]} release_name [branch]") sys.exit() - fetch_changelogs(argv[1]) + fetch_changelogs(*argv[1:]) diff --git a/larray/__init__.py b/larray/__init__.py index 3310c1824..914fdf04d 100644 --- a/larray/__init__.py +++ b/larray/__init__.py @@ -1,6 +1,6 @@ from __future__ import absolute_import, division, print_function -__version__ = '0.32.1' +__version__ = '0.32.2' from larray.core.axis import Axis, AxisCollection, X diff --git a/larray/core/axis.py b/larray/core/axis.py index a250d85af..c203e4e7d 100644 --- a/larray/core/axis.py +++ b/larray/core/axis.py @@ -2830,7 +2830,7 @@ def _key_to_raw_and_axes(self, key, collapse_slices=False, translate_key=True): # transform non-Array advanced keys (list and ndarray) to Array def to_la_ikey(axis, axis_key): - if isinstance(axis_key, (int, np.integer, slice, Array)): + if isinstance(axis_key, (int, long, np.integer, slice, Array)): return axis_key else: assert isinstance(axis_key, (list, np.ndarray)) diff --git a/larray/inout/pandas.py b/larray/inout/pandas.py index 36dc563b5..f8680a179 100644 --- a/larray/inout/pandas.py +++ b/larray/inout/pandas.py @@ -39,13 +39,13 @@ def index_to_labels(idx, sort=True): r""" Returns unique labels for each dimension. """ - if isinstance(idx, pd.core.index.MultiIndex): + if isinstance(idx, pd.MultiIndex): if sort: return list(idx.levels) else: return [list(unique(idx.get_level_values(l))) for l in range(idx.nlevels)] else: - assert isinstance(idx, pd.core.index.Index) + assert isinstance(idx, pd.Index) labels = list(idx.values) return [sorted(labels) if sort else labels] @@ -53,7 +53,7 @@ def index_to_labels(idx, sort=True): def cartesian_product_df(df, sort_rows=False, sort_columns=False, fill_value=nan, **kwargs): idx = df.index labels = index_to_labels(idx, sort=sort_rows) - if isinstance(idx, pd.core.index.MultiIndex): + if isinstance(idx, pd.MultiIndex): if sort_rows: new_index = pd.MultiIndex.from_product(labels) else: @@ -118,14 +118,14 @@ def from_series(s, sort_rows=False, fill_value=nan, meta=None, **kwargs): a1 b0 4.0 5.0 a1 b1 6.0 7.0 """ - if isinstance(s.index, pd.core.index.MultiIndex): + if isinstance(s.index, pd.MultiIndex): # TODO: use argument sort=False when it will be available # (see https://github.com/pandas-dev/pandas/issues/15105) df = s.unstack(level=-1, fill_value=fill_value) # pandas (un)stack and pivot(_table) methods return a Dataframe/Series with sorted index and columns if not sort_rows: labels = index_to_labels(s.index, sort=False) - if isinstance(df.index, pd.core.index.MultiIndex): + if isinstance(df.index, pd.MultiIndex): index = pd.MultiIndex.from_tuples(list(product(*labels[:-1])), names=s.index.names[:-1]) else: index = labels[0] diff --git a/larray/tests/test_session.py b/larray/tests/test_session.py index 55fbb0a99..06fb7bc78 100644 --- a/larray/tests/test_session.py +++ b/larray/tests/test_session.py @@ -67,7 +67,8 @@ def test_init_session(meta): @needs_xlwings def test_init_session_xlsx(): s = Session(inputpath('demography_eurostat.xlsx')) - assert s.names == ['births', 'deaths', 'immigration', 'pop', 'pop_benelux'] + assert s.names == ['births', 'deaths', 'immigration', 'population', + 'population_5_countries', 'population_benelux'] @needs_pytables diff --git a/make_release.py b/make_release.py index b808e3b4b..a68b468cb 100644 --- a/make_release.py +++ b/make_release.py @@ -25,11 +25,11 @@ LARRAY_USERS_GROUP = "larray-users@googlegroups.com" -def update_metapackage(public_release, repository, release_name, **extra_kwargs): +def update_metapackage(public_release, local_repository, release_name, **extra_kwargs): if not public_release: return - chdir(repository) + chdir(local_repository) version = short(release_name) # TODO: this should be echocall(redirect_stdout=False) @@ -46,13 +46,13 @@ def update_metapackage(public_release, repository, release_name, **extra_kwargs) '--summary', "'Package installing larray and all sub-projects and optional dependencies'"]) -def merge_changelogs(build_dir, src_documentation, release_name, public_release, **extra_kwargs): +def merge_changelogs(build_dir, src_documentation, release_name, public_release, branch='master', **extra_kwargs): chdir(join(build_dir, src_documentation)) if not public_release: return - check_call(['python', 'fetch_changelogs.py', release_name]) + check_call(['python', 'fetch_changelogs.py', release_name, branch]) insert_step_func(merge_changelogs, msg='append changelogs from larray-editor project', before='update_changelog') diff --git a/readthedocs.yml b/readthedocs.yml index 359e95f11..de31c9be9 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -13,12 +13,17 @@ sphinx: formats: - pdf -conda: - environment: doc/environment.yml +# we do not use conda anymore because it consumes too much memory and thus crashes our builds +# see: +# - https://docs.readthedocs.io/en/stable/guides/build-using-too-many-resources.html#use-pip-when-possible +# - https://github.com/readthedocs/readthedocs.org/issues/6692 +#conda: +# environment: doc/environment.yml # Optionally set the version of Python and requirements required to build your docs python: - version: 3.6 + version: 3.7 install: - - method: setuptools + - requirements: doc/requirements.txt + - method: pip path: . diff --git a/setup.py b/setup.py index 6160da31b..fb4d4dc02 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ def readlocal(fname): DISTNAME = 'larray' -VERSION = '0.32.1' +VERSION = '0.32.2' AUTHOR = 'Gaetan de Menten, Geert Bryon, Johan Duyck, Alix Damman' AUTHOR_EMAIL = 'gdementen@gmail.com' DESCRIPTION = "N-D labeled arrays in Python"