Commit 366281a4 authored by Jan Kotanski's avatar Jan Kotanski
Browse files

New upstream version 2.9.0

parent 96ff622b
Announcing HDF5 for Python (h5py) 2.5.0
========================================
The h5py team is happy to announce the availability of h5py 2.5.0.
This release introduces experimental support for the highly-anticipated
"Single Writer Multiple Reader" (SWMR) feature in the upcoming HDF5 1.10
release. SWMR allows sharing of a single HDF5 file between multiple processes
without the complexity of MPI or multiprocessing-based solutions.
This is an experimental feature that should NOT be used in production code.
We are interested in getting feedback from the broader community with respect
to performance and the API design.
For more details, check out the h5py user guide:
http://docs.h5py.org/en/latest/swmr.html
SWMR support was contributed by Ulrik Pedersen.
What's h5py?
------------
The h5py package is a Pythonic interface to the HDF5 binary data format.
It lets you store huge amounts of numerical data, and easily manipulate
that data from NumPy. For example, you can slice into multi-terabyte
datasets stored on disk, as if they were real NumPy arrays. Thousands of
datasets can be stored in a single file, categorized and tagged however
you want.
Documentation is at:
http://docs.h5py.org
Changes
-------
* Experimental SWMR support
* Group and AttributeManager classes now inherit from the appropriate ABCs
* Fixed an issue with 64-bit float VLENS
* Cython warning cleanups related to "const"
* Entire code base ported to "six"; 2to3 removed from setup.py
Acknowledgements
----------------
This release incorporates changes from, among others:
* Ulrik Pedersen
* James Tocknell
* Will Parkin
* Antony Lee
* Peter H. Li
* Peter Colberg
* Ghislain Antony Vaillant
Where to get it
---------------
Downloads, documentation, and more are available at the h5py website:
http://www.h5py.org
include ANN.rst
include api_gen.py
include MANIFEST.in
include pylintrc
include README.rst
include setup_build.py
include setup_configure.py
include tox.ini
recursive-include docs *
prune docs/_build
recursive-include docs_api *
prune docs_api/_build
recursive-include examples *.py
recursive-include h5py *.h *.pyx *.pxd *.pxi *.py *.txt
exclude h5py/config.pxi
exclude h5py/defs.pxd
exclude h5py/defs.pyx
recursive-include licenses *
recursive-include lzf *
recursive-include windows *
recursive-exclude * .DS_Store
exclude ci other .github
recursive-exclude ci *
recursive-exclude other *
recursive-exclude .github *
exclude pavement.py
exclude *.yml
exclude *.yaml
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
Metadata-Version: 1.1
Name: h5py
Version: 2.9.0
Summary: Read and write HDF5 files from Python
Home-page: http://www.h5py.org
Author: Andrew Collette
Author-email: andrew.collette@gmail.com
License: BSD
Download-URL: https://pypi.python.org/pypi/h5py
Description:
The h5py package provides both a high- and low-level interface to the HDF5
library from Python. The low-level interface is intended to be a complete
wrapping of the HDF5 API, while the high-level component supports access to
HDF5 files, datasets and groups using established Python and NumPy concepts.
A strong emphasis on automatic conversion between Python (Numpy) datatypes and
data structures and their HDF5 equivalents vastly simplifies the process of
reading and writing data from Python.
Supports HDF5 versions 1.8.4 and higher. On Windows, HDF5 is included with
the installer.
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Cython
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
.. image:: https://travis-ci.org/h5py/h5py.png
:target: https://travis-ci.org/h5py/h5py
.. image:: https://ci.appveyor.com/api/projects/status/h3iajp4d1myotprc/branch/master?svg=true
:target: https://ci.appveyor.com/project/h5py/h5py/branch/master
HDF5 for Python
===============
`h5py` is a thin, pythonic wrapper around the `HDF5 <https://support.hdfgroup.org/HDF5/>`_, which runs on Python 2.7, and Python 3 (3.4+).
Websites
--------
* Main website: http://www.h5py.org
* Source code: http://github.com/h5py/h5py
* Mailing list: https://groups.google.com/d/forum/h5py
Installation
------------
Pre-build `h5py` can either be installed via your Python Distribution (e.g.
`Continuum Anaconda`_, `Enthought Canopy`_) or from `PyPI`_ via `pip`_.
`h5py` is also distributed in many Linux Distributions (e.g. Ubuntu, Fedora),
and in the MacOS package managers `Homebrew <https://brew.sh/>`_,
`Macports <https://www.macports.org/>`_, or `Fink <http://finkproject.org/>`_.
More detailed installation instructions, including how to install `h5py` with
MPI support, can be found at: http://docs.h5py.org/en/latest/build.html.
Reporting bugs
--------------
Open a bug at http://github.com/h5py/h5py/issues. For general questions, ask
on the list (https://groups.google.com/d/forum/h5py).
.. _`Continuum Anaconda`: http://continuum.io/downloads
.. _`Enthought Canopy`: https://www.enthought.com/products/canopy/
.. _`PyPI`: https://pypi.org/project/h5py/
.. _`pip`: https://pip.pypa.io/en/stable/
"""
Generate the lowest-level Cython bindings to HDF5.
In order to translate HDF5 errors to exceptions, the raw HDF5 API is
wrapped with Cython "error wrappers". These are cdef functions with
the same names and signatures as their HDF5 equivalents, but implemented
in the h5py.defs extension module.
The h5py.defs files (defs.pyx and defs.pxd), along with the "real" HDF5
function definitions (_hdf5.pxd), are auto-generated by this script from
api_functions.txt. This file also contains annotations which indicate
whether a function requires a certain minimum version of HDF5, an
MPI-aware build of h5py, or special error handling.
This script is called automatically by the h5py build system when the
output files are missing, or api_functions.txt has been updated.
See the Line class in this module for documentation of the format for
api_functions.txt.
h5py/_hdf5.pxd: Cython "extern" definitions for HDF5 functions
h5py/defs.pxd: Cython definitions for error wrappers
h5py/defs.pyx: Cython implementations of error wrappers
"""
import re
import os.path as op
class Line(object):
"""
Represents one line from the api_functions.txt file.
Exists to provide the following attributes:
mpi: Bool indicating if MPI required
error: Bool indicating if special error handling required
version: None or a minimum-version tuple
code: String with function return type
fname: String with function name
sig: String with raw function signature
args: String with sequence of arguments to call function
Example: MPI ERROR 1.8.12 int foo(char* a, size_t b)
.mpi: True
.error: True
.version: (1, 8, 12)
.code: "int"
.fname: "foo"
.sig: "char* a, size_t b"
.args: "a, b"
"""
PATTERN = re.compile("""(?P<mpi>(MPI)[ ]+)?
(?P<error>(ERROR)[ ]+)?
(?P<version>([0-9]+\.[0-9]+\.[0-9]+))?
([ ]+)?
(?P<code>(unsigned[ ]+)?[a-zA-Z_]+[a-zA-Z0-9_]*\**)[ ]+
(?P<fname>[a-zA-Z_]+[a-zA-Z0-9_]*)[ ]*
\((?P<sig>[a-zA-Z0-9_,* ]*)\)
""", re.VERBOSE)
SIG_PATTERN = re.compile("""
(?:unsigned[ ]+)?
(?:[a-zA-Z_]+[a-zA-Z0-9_]*\**)
[ ]+[ *]*
(?P<param>[a-zA-Z_]+[a-zA-Z0-9_]*)
""", re.VERBOSE)
def __init__(self, text):
""" Break the line into pieces and populate object attributes.
text: A valid function line, with leading/trailing whitespace stripped.
"""
m = self.PATTERN.match(text)
if m is None:
raise ValueError("Invalid line encountered: {0}".format(text))
parts = m.groupdict()
self.mpi = parts['mpi'] is not None
self.error = parts['error'] is not None
self.version = parts['version']
if self.version is not None:
self.version = tuple(int(x) for x in self.version.split('.'))
self.code = parts['code']
self.fname = parts['fname']
self.sig = parts['sig']
sig_const_stripped = self.sig.replace('const', '')
self.args = self.SIG_PATTERN.findall(sig_const_stripped)
if self.args is None:
raise ValueError("Invalid function signature: {0}".format(self.sig))
self.args = ", ".join(self.args)
raw_preamble = """\
include "config.pxi"
from api_types_hdf5 cimport *
from api_types_ext cimport *
"""
def_preamble = """\
include "config.pxi"
from api_types_hdf5 cimport *
from api_types_ext cimport *
"""
imp_preamble = """\
include "config.pxi"
from api_types_ext cimport *
from api_types_hdf5 cimport *
cimport _hdf5
from _errors cimport set_exception
"""
class LineProcessor(object):
def run(self):
# Function definitions file
self.functions = open(op.join('h5py', 'api_functions.txt'), 'r')
# Create output files
self.raw_defs = open(op.join('h5py', '_hdf5.pxd'), 'w')
self.cython_defs = open(op.join('h5py', 'defs.pxd'), 'w')
self.cython_imp = open(op.join('h5py', 'defs.pyx'), 'w')
self.raw_defs.write(raw_preamble)
self.cython_defs.write(def_preamble)
self.cython_imp.write(imp_preamble)
for text in self.functions:
# Directive specifying a header file
if not text.startswith(' ') and not text.startswith('#') and \
len(text.strip()) > 0:
inc = text.split(':')[0]
self.raw_defs.write('cdef extern from "%s.h":\n' % inc)
continue
text = text.strip()
# Whitespace or comment line
if len(text) == 0 or text[0] == '#':
continue
# Valid function line
self.line = Line(text)
self.write_raw_sig()
self.write_cython_sig()
self.write_cython_imp()
self.functions.close()
self.cython_imp.close()
self.cython_defs.close()
self.raw_defs.close()
def add_cython_if(self, block):
""" Wrap a block of code in the required "IF" checks """
def wrapif(condition, code):
code = code.replace('\n', '\n ', code.count('\n')-1) # Yes, -1.
code = "IF {0}:\n {1}".format(condition, code)
return code
if self.line.mpi:
block = wrapif('MPI', block)
if self.line.version is not None:
block = wrapif('HDF5_VERSION >= {0.version}'.format(self.line), block)
return block
def write_raw_sig(self):
""" Write out "cdef extern"-style definition for an HDF5 function """
raw_sig = "{0.code} {0.fname}({0.sig}) except *\n".format(self.line)
raw_sig = self.add_cython_if(raw_sig)
raw_sig = "\n".join((" "+x if x.strip() else x) for x in raw_sig.split("\n"))
self.raw_defs.write(raw_sig)
def write_cython_sig(self):
""" Write out Cython signature for wrapper function """
cython_sig = "cdef {0.code} {0.fname}({0.sig}) except *\n".format(self.line)
cython_sig = self.add_cython_if(cython_sig)
self.cython_defs.write(cython_sig)
def write_cython_imp(self):
""" Write out Cython wrapper implementation """
# Figure out what test and return value to use with error reporting
if '*' in self.line.code or self.line.code in ('H5T_conv_t',):
condition = "==NULL"
retval = "NULL"
elif self.line.code in ('int', 'herr_t', 'htri_t', 'hid_t','hssize_t','ssize_t') \
or re.match(r'H5[A-Z]+_[a-zA-Z_]+_t', self.line.code):
condition = "<0"
retval = "-1"
elif self.line.code in ('unsigned int','haddr_t','hsize_t','size_t'):
condition = "==0"
retval = 0
else:
raise ValueError("Return code <<%s>> unknown" % self.line.code)
# Have to use except * because Cython can't handle special types here
imp = """\
cdef {0.code} {0.fname}({0.sig}) except *:
cdef {0.code} r
_hdf5.H5Eset_auto(NULL, NULL)
r = _hdf5.{0.fname}({0.args})
if r{condition}:
if set_exception():
return <{0.code}>{retval}
elif {0.error}:
raise RuntimeError("Unspecified error in {0.fname} (return value {condition})")
return r
"""
imp = imp.format(self.line, condition=condition, retval=retval)
imp = self.add_cython_if(imp)
self.cython_imp.write(imp)
def run():
lp = LineProcessor()
lp.run()
if __name__ == '__main__':
run()
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS = -W
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build
# User-friendly check for sphinx-build
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
endif
# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
@echo " info to make Texinfo files and run them through makeinfo"
@echo " gettext to make PO message catalogs"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " xml to make Docutils-native XML files"
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
clean:
rm -rf $(BUILDDIR)/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."
json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."
htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."
qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/h5py.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/h5py.qhc"
devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/h5py"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/h5py"
@echo "# devhelp"
epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."
latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
latexpdfja:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through platex and dvipdfmx..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."
man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
texinfo:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
@echo "Run \`make' in that directory to run these through makeinfo" \
"(use \`make info' here to do that automatically)."
info:
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
@echo "Running Texinfo files through makeinfo..."
make -C $(BUILDDIR)/texinfo info
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
gettext:
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
@echo
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."
linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."
doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
xml:
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
@echo
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
pseudoxml:
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
@echo
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
.. _install:
Installation
============
.. _install_recommends:
It is highly recommended that you use a pre-built version of h5py, either from a
Python Distribution, an OS-specific package manager, or a pre-built wheel from
PyPI.
Be aware however that most pre-built versions lack MPI support, and that they
are built against a specific version of HDF5. If you require MPI support, or
newer HDF5 features, you will need to build from source.
After installing h5py, you should run the tests to be sure that everything was
installed correctly. This can be done in the python interpreter via::
import h5py
h5py.run_tests()
On Python 2.6 and 2.7, unittest2 must be installed to run the tests.
.. _prebuilt_install:
Pre-built installation (recommended)
-----------------------------------------