Skip to content

Commit

Permalink
update fork (#2)
Browse files Browse the repository at this point in the history
* no copy when loading astropy

* typo

* Bumping to 3.4.4

* Package license and requirements files

* Bump to 3.4.5

* Added some tests to Travis CI and AppVeyor that check if hickle can be properly packaged up, distributed and installed.

* And maybe I should not forget twine in the requirements_test.txt.

* Moved the tests directory from root to ./hickle.

* Added missing tests folder to the MANIFEST.in file.

* Add dict-type permanently to types_dict.

* Subclasses of supported types can now be pickled as well (although not yet with their proper type).

* Removed all cases of saving dtypes as a single element list.

* Renamed the 'type' attribute to 'base_type' in preparation for adding subclass support.

* Also make sure that strings are saved as single elements.

* The types_dict now uses tuples with the create-functions and the hkl_dtype key.

* All create-functions now take an extra 'base_type' string, that describes what the hkl_type is that will be saved to HDF5.

* Groups also obtain their base_type from the create_dataset_lookup()-function now.

* The actual type of a hickled object is now saved as well (in pickled form).

* Finalized implementing support for subclasses.

* Coveralls -> codecov.io

* Add codecov.io badge

* The order of the dict item keys are now saved as well.
Any dict that is loaded will be initialized with the items sorted in that order.
For all types that derive from dict, the dict will be initialized using its true type directly (apparently, I had written it that way before already for some reason).
This fixes telegraphic#65.

* Hickle's required HDF5 attributes are now solely applied to the data group that contains the hickled Python object, instead of the entire file (this allows for hickled objects to be more easily added to already existing HDF5-files, without messing up the root of that file).

* Datasets and groups now solely use 'group_xxx' if there is more than a single item at that level.
All 'create_xxx' functions are now passed a string containing the name of the group/dataset that they should create.

* Added forgotten base_key_type attribute to PyContainer.

* Reverted working tree back to before using 'track_order'.
Added missing 'six' requirement.
Added a test for testing the dumping and loading of an OrderedDict.

* The root of a hickled group is no longer read now, as it is not necessary.
Removed the auxiliary attributes that were required for reading it.
The true type of a dict key is now saved as well, even though it is not used for anything (simply saving it now in case we want to use it later).

* The version is now stored using a single Python file, whose strings are read using regex.

* HDF5 groups can now be given as a file_obj as well when dumping and loading.
Providing a path that does not start with '/' will automatically add it to it.
Added tests for these functionalities.

* Arbitrary-precision integers can now be dumped and loaded properly.

* Also make sure that 'long' dtypes are taken into account on Python 2.

* make hickle work with pathlib.Path

Basically, any package /module that saves to file supports this too (including `h5py`).

* make Python 2 compatible

* Changed wording.

* Added six requirement, and added minimum versions for all requirements.

* Now 'dill' is always used for dumping and loading serialized objects.
Added a test for dumping and loading a local session function.

* Add support for actually loading serialized data in Python 2.

* Add new test to main as well.

* Make sure new changes are also used for Python 2

* Update file_opener re telegraphic#123

* Fixed documentation of `dump` and `load` to be NumPy doc style (and look a bit better).
Replaced broken `pickle` documentation link with a proper one.

* Only lists and tuples are now recognized as acceptable iterables.
All other iterables are either handled separately, or simply pickled.

* Changed the lookup system to use object typing for more consistency.

* Added test for detecting the problem raised in telegraphic#125

* Added support for hickling dicts with slashes in their dict keys.

* Make sure that functional backslashes still work properly in dict keys.

* Loaders are now only loaded when they are required for dumping or loading a specific object.

* Make sure to do proper future import.

* Raise an error if a dict item key contains a double backslash.

* Only filter out import errors due to the loader not being found.

* As Python 2 apparently only reports the last part of the name of a non-importable module, search for something a bit more specific.

* Some small QoL changes.

* The py_type of a pickled object is no longer saved to HDF5, as it is not necessary to restore the object's original state.

* Removed legacy support for v1 and v2.
Added start of legacy support for v3.
v4 now stores its HDF5 attributes using a 'HICKLE_' prefix, to allow users to add attributes to the group without interference.

* Objects can now be hickled to existing HDF5 groups, as long as they don't contain any datasets or groups themselves.

* Made sure that v3 always uses relative imports, to make it easier to port any functionality change from v3 to v4.
(Even though I am not a fan of relative imports)

* The version is now stored using a single Python file, whose strings are read using regex.

* Backported change to version store location to v3 as well.
Bumped version to 3.4.7 to include the latest changes.

* Removed support for Python 2.
Added legacy support for hickle v3 (currently uses v3.4.7).

* Remove testing for Python 2.7 as well.

* Always specify the mode with which to open an HDF5-file.

* Test requirements updates.

* And make sure to always execute 'pytest'.

* Removed basically everything that has to do with Python 2.7 from v4.
As legacy_v3 is expected to be able to load files made with Python 2.7, these are not changed.

* Many, many QoL changes.
Converted all v4 files to be PEP8 compliant.
Rewritten 'load_python3' into 'load_builtins'.
The 'load_numpy' and 'load_builtins' modules are only loaded when they are required, like all other loaders.
Removed the 'containers_type_dict' as the true container type is already saved anyway.
Astropy's classes are now reinitialized using their true type instantly.
Astropy constants can now be properly dumped and loaded.

* Save types of dict keys as a normal string as well.

* Some minor improvements.

* Added test for opening binary files, and make sure that any 'b' is removed from the file mode. (telegraphic#131)

* Added pytests for all uncovered lines.
Removed lines that are never used (and thus cannot be covered).
Added 'NoneType' to the dict of acceptable dict key types, as Nones can be used as keys.

* Replaced all instances of 'a HDF' with 'an HDF'.

* Removed the index.md file in the docs, as it is now simply pointing to the README.md file instead.

* Badges!

* Added few classifiers to the setup.py file.

* Update requirement for pytest.

* Removed use of 'track_times'.

* NumPy arrays with unicode strings can now be properly dumped and loaded.

* NumPy arrays containing non-NumPy objects can now be properly dumped and loaded.

* Added all missing tests for full 100% coverage!!!

* Make sure that kwargs is always passed to 'create_dataset'.

* If hickle fails to save an object to HDF5 using its standard methods, it will fall back to pickling it (and emits a warning saying why that was necessary).
Simplified the way in which python scalars are hickled.

* Actually mention that the line in parentheses is the reason for serializing.

* Use proper development status identifier.

* Make sure to preserve the subclass type of a NumPy array when dumping.

* make sure that a SkyCoord object will be properly saved and retrieved when it's a scalar or N-D array

* revert the change to legacy_v3/load_astropy.py

* Updated legacy v3 to v3.4.8.

Co-authored-by: Kewei Li <kewl@microsoft.com>
Co-authored-by: Danny Price <dan@thetelegraphic.com>
Co-authored-by: Isuru Fernando <isuruf@gmail.com>
Co-authored-by: Ellert van der Velden <ellert_vandervelden@outlook.com>
Co-authored-by: Bas Nijholt <basnijholt@gmail.com>
Co-authored-by: Rui Xue <rx.astro@gmail.com>
  • Loading branch information
7 people committed Dec 14, 2020
1 parent 036db92 commit beb66c7
Show file tree
Hide file tree
Showing 49 changed files with 2,668 additions and 2,364 deletions.
25 changes: 14 additions & 11 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
environment:
matrix:
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "32"
Expand All @@ -32,6 +24,14 @@ environment:
PYTHON_VERSION: "3.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python38"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "32"

- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: "3.8.x"
PYTHON_ARCH: "64"

install:
# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
Expand All @@ -41,11 +41,14 @@ install:
# Upgrade pip
- "python -m pip install --user --upgrade pip setuptools wheel"

# Install testing requirements and hickle
# Install testing requirements
- "pip install -r requirements_test.txt"
- "pip install ."

build: false

test_script:
- "python setup.py test"
- "check-manifest"
- "python setup.py sdist bdist_wheel"
- "twine check dist/*"
- "pip install ."
- "pytest"
11 changes: 7 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@ language: python
dist: xenial

python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"

# command to install dependencies
install:
- sudo apt-get update -qq
- sudo apt-get install -qq libhdf5-serial-dev
- python -m pip install --upgrade pip setuptools wheel
- pip install -r requirements_test.txt
- pip install .

script:
- python setup.py test
- check-manifest
- python setup.py sdist bdist_wheel
- twine check dist/*
- pip install .
- pytest

# Run code coverage
after_success: coveralls
after_success: codecov
14 changes: 14 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include LICENSE
include *.md
include MANIFEST.in
include requirements*.txt
recursive-include hickle tests *

exclude docs
recursive-exclude docs *
exclude *.yml
exclude .nojekyll
exclude .pylintrc
exclude paper*
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[![Build Status](https://travis-ci.org/telegraphic/hickle.svg?branch=master)](https://travis-ci.org/telegraphic/hickle)
[![Build status](https://ci.appveyor.com/api/projects/status/8cwrkjpwxet5jmgp?svg=true)](https://ci.appveyor.com/project/telegraphic/hickle)
[![PyPI - Latest Release](https://img.shields.io/pypi/v/hickle.svg?logo=pypi&logoColor=white&label=PyPI)](https://pypi.python.org/pypi/hickle)
[![PyPI - Python Versions](https://img.shields.io/pypi/pyversions/hickle.svg?logo=python&logoColor=white&label=Python)](https://pypi.python.org/pypi/hickle)
[![Travis CI - Build Status](https://img.shields.io/travis/com/telegraphic/hickle/master.svg?logo=travis%20ci&logoColor=white&label=Travis%20CI)](https://travis-ci.com/telegraphic/hickle)
[![AppVeyor - Build Status](https://img.shields.io/appveyor/ci/telegraphic/hickle/master.svg?logo=appveyor&logoColor=white&label=AppVeyor)](https://ci.appveyor.com/project/telegraphic/hickle)
[![CodeCov - Coverage Status](https://img.shields.io/codecov/c/github/telegraphic/hickle/master.svg?logo=codecov&logoColor=white&label=Coverage)](https://codecov.io/gh/telegraphic/hickle/branches/master)
[![JOSS Status](http://joss.theoj.org/papers/0c6638f84a1a574913ed7c6dd1051847/status.svg)](http://joss.theoj.org/papers/0c6638f84a1a574913ed7c6dd1051847)


Hickle
======

Hickle is a [HDF5](https://www.hdfgroup.org/solutions/hdf5/) based clone of `pickle`, with a twist: instead of serializing to a pickle file,
Hickle dumps to a HDF5 file (Hierarchical Data Format). It is designed to be a "drop-in" replacement for pickle (for common data objects), but is
Hickle is an [HDF5](https://www.hdfgroup.org/solutions/hdf5/) based clone of `pickle`, with a twist: instead of serializing to a pickle file,
Hickle dumps to an HDF5 file (Hierarchical Data Format). It is designed to be a "drop-in" replacement for pickle (for common data objects), but is
really an amalgam of `h5py` and `dill`/`pickle` with extended functionality.

That is: `hickle` is a neat little way of dumping python variables to HDF5 files that can be read in most programming
Expand Down Expand Up @@ -95,6 +98,7 @@ These file-level options are abstracted away from the data model.
Recent changes
--------------

* June 2020: Major refactor to version 4, and removal of support for Python 2.
* December 2018: Accepted to Journal of Open-Source Software (JOSS).
* June 2018: Major refactor and support for Python 3.
* Aug 2016: Added support for scipy sparse matrices `bsr_matrix`, `csr_matrix` and `csc_matrix`.
Expand Down Expand Up @@ -153,7 +157,7 @@ Install with `pip` by running `pip install hickle` from the command line.

### Manual install

1. You should have Python 2.7 and above installed
1. You should have Python 3.5 and above installed

2. Install h5py
(Official page: http://docs.h5py.org/en/latest/build.html)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# -- Project information -----------------------------------------------------

project = u'hickle'
copyright = u'2018, Danny Price'
copyright = u'2018-2020, Danny Price, Ellert van der Velden and contributors'
author = u'Danny Price'

# The short X.Y version
Expand Down Expand Up @@ -60,7 +60,7 @@
#source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'
master_doc = '../../README'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
191 changes: 0 additions & 191 deletions docs/source/index.md

This file was deleted.

8 changes: 4 additions & 4 deletions docs/source/toc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ Welcome to hickle's documentation!
==================================


Hickle is a HDF5-based clone of `pickle`, with a twist: instead of serializing to a pickle file,
Hickle dumps to a HDF5 file (Hierarchical Data Format). It is designed to be a "drop-in" replacement for pickle (for common data objects), but is
Hickle is an HDF5-based clone of `pickle`, with a twist: instead of serializing to a pickle file,
Hickle dumps to an HDF5 file (Hierarchical Data Format). It is designed to be a "drop-in" replacement for pickle (for common data objects), but is
really an amalgam of `h5py` and `dill`/`pickle` with extended functionality.

That is: `hickle` is a neat little way of dumping python variables to HDF5 files that can be read in most programming
languages, not just Python. Hickle is fast, and allows for transparent compression of your data (LZF / GZIP).
That is: `hickle` is a neat little way of dumping python variables to HDF5 files that can be read in most programming
languages, not just Python. Hickle is fast, and allows for transparent compression of your data (LZF / GZIP).



Expand Down
11 changes: 9 additions & 2 deletions hickle/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
from .hickle import dump, load
from .hickle import __version__
# hickle imports
from .__version__ import __version__
from . import hickle
from .hickle import *

# All declaration
__all__ = ['hickle']
__all__.extend(hickle.__all__)

# Author declaration
__author__ = "Danny Price, Ellert van der Velden and contributors"
13 changes: 13 additions & 0 deletions hickle/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-

"""
Hickle Version
==============
Stores the different versions of the *hickle* package.
"""


# %% VERSIONS
# Default/Latest/Current version
__version__ = '4.0.1'
Loading

0 comments on commit beb66c7

Please sign in to comment.