haggis
======
This is a library of general purpose utility functions and classes written in
Python. Much of this code is intended to support the imprint project
<https://gitlab.com/madphysicist/imprint>. The modules of this library are
more-or-less standalone utilities, organized by category.
This library contains plenty of code that relies on external programs and less
common Python libraries. The code is considered to be "extras", in the setuptools
sense. Extras can be omitted without any modification to the python code. The
following extras are supported:
- [docx]: Support for docx file utilities requires python-docx to be
installed.
- [latex]: Supporting LaTeX requires a host of external programs to work
properly, so this feature is optional. See the dependency page in the main
documentation for more information.
- [pdf]: Requires the poppler library to be installed.
- [ps]: Requires GhostScript to be installed.
- [plot]: Plotting tools require matplotlib, which is a heavy dependency, and
unnecessary for many purposes.
- [qt]: Some optional utilities for pyqt6 are provided if it is installed.
Since this a heavy dependency, they are quite optional.
- [term]: Terminal colors work out of the box on Linux, but require the
colorama library to work on Windows.
- [scio]: Science I/O depends on the scipy and astropy libraries to deliver
IDL and FITS file support, respectively.
- [xlsx]: Support for xlsx file utilities requires openpyxl to be installed.
To install extras such as latex and pdf, do:
pip install haggis[latex,pdf]
See the documentation at <https://haggis.readthedocs.io/en/latest> for more
information, including the API documentation.
This library is licensed under the AGPLv3, and compatible with later versions.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Changelog
=========
0.14.1 (2024-10-17)
-------------------
* Fixes:
- `configuration.JSONConfiguration` outputs newlines at end of file
- Improved formatting of multi-line `configuration.NumpyObject`
0.14.0 (2024-07-15)
-------------------
* New class:
- args.StoreVariableNargs
* API change:
- `recipes.islast` has a new attribute, `last`, containing the
latest element
- `string_util.format_list` accepts `last_sep` to allow for more
natural output
- `string_util.format_list` `indent` defaults to zero
* New unit tests:
- tests.string_util.TestFormatList
- tests.test_recipes.TestIsLast
- tests.test_args.TestStoreVariableNargs
* Bugfixes:
- Missing raw-string identifiers in `tests.string_util.TestParseList`
- `string_util.format_list` checks for invalid width
0.13.3 (2024-07-15)
-------------------
* New functions:
- os.redirect_stderr
- os.redirect_stdout
- os.redirect_stream
- os.suppress_stderr
- os.suppress_stdout
* Bugfix:
- `logs.ReturnableStreamHandler` clears the previous line when it
gets a line after a carriage return.
0.13.2 (2024-07-12)
-------------------
* New class:
- logs.ReturnableStreamHandler
* API changes:
- New attribute `logs.RETURNABLE == "returnable"`
- New keyword values in `logs.configure_logger`:
- `log_stderr` accepts string `RETURNABLE` to use
`ReturnableStreamHandler` when logging
- `log_stdout` accepts string `RETURNABLE` to use
`ReturnableStreamHandler` when logging
0.13.1 (2024-07-11)
-------------------
* Bugfix:
- Extra newlines printed in `configuraition.JSONConfiguration._pprint`
* Nominal Qt5 support in gui.qt
0.13.0 (2024-04-29)
-------------------
* New modules and packages:
- gui package
- gui.qt
* New classes:
- gui.qt.ImageAspectLabel
0.12.1 (2024-06-24)
-------------------
* Bufixes:
- `islast` does not crash on empty iterators
* Typo fixes in documentation
0.12.0 (2023-08-29)
-------------------
* New functions and classes:
- string_util.parse_list
- string_util.parse_pair
- string_util.func_name
* New unit tests:
- tests.test_string_util.TestParsePair
- tests.test_string_util.TestParseList
0.11.0 (2023-08-29)
-------------------
* Bugfixes:
- Setting correct `stacklevel` in `logs.add_logging_level`
- Fixes to documentation of properties in `recipes.RangeBuilder` and
`time.Stopwatch`
- Counting tabs in prefix rather than entire string in
`args.SmartHelpFormatter`
* API changes:
- New keywords in `string_util.horiz_cat` and
`string_util.split_horiz_cat`.
- `titles`: optional headings included with each column
- `headers`: string or string generator to insert after the title
- `width`: minimum width to allow for each column
- `hsep`: header separator, similar to `sep`, which it defaults to
- Dropped `missing='missing'` option since it truncated anyway
- Renamed `recipes.shift_left` to `recipes.shift_up`
* New unit tests:
- tests.test_string_util
* Added pytest-cov to required test dependencies
0.10.1 (2023-08-21)
-------------------
* Fixes to test and documentation warnings
0.10.0 (2023-08-20)
-------------------
* New modules:
- args
* New functions and classes:
- args.SmartHelpFormatter
* New unit tests:
- tests.test_args
0.9.2 (2023-08-20)
------------------
* Switched to trunk-based development
0.9.1 (2023-03-26)
------------------
* Migrated to GitLab hosting
0.9.0 (2023-03-15)
------------------
* New functions and classes:
- logs.add_detail_level
* Bugfixes:
- Added missing default kwargs to monkeypatched version of
logging.LogAdapter method in logs.add_log_level
- Updated bondary handling in npy_util.prune_mask
* logs.add_logging_level verifies exception info settings if prior calls
are found
0.8.0 (2022-11-04)
------------------
* New functions and classes:
- recipes.chained_getter
* New unit tests:
- tests.test_logs.TestAddLoggingLevel
- tests.test_logs.TestResetHandlers
- tests.test_logs.TestLogMaxFilter
- tests.test_logs.TestMetaLoggableType
- tests.test_recipes.TestChainedGetter
* Bugfixes:
- Fixed sense of inclusive in logs.LogMaxFilter
* logs.add_logging_level updates logging.LoggerAdapter
0.7.1 (2022-10-24)
------------------
* New functions and classes:
- npy_util.prune_mask
0.7.0 (2022-10-17)
------------------
* New functions and classes:
- npy_util.masked_index
- npy_util.unmasked_index
- npy_util.find_peaks
* New unit tests:
- tests.test_npy_util.TestMaskedIndex
- tests.test_npy_util.TestUnmaskedIndex
- tests.test_npy_util.TestFindPeaks
0.6.0 (2022-10-11)
------------------
* API changes:
- Parameter stop in recipes.RangeBuilder.update is now optional
- Property span in recipes.RangeBuilder
* Bugfixes:
- Fixed handling of bulleted list styles in files.docx.list_number
0.5.0 (2022-06-17)
------------------
* New functions and classes:
- multiline_repr in string_util
- RangeBuilder in recipes
0.4.0 (2022-06-02)
------------------
* New functions and classes:
- npy_util.replace_field
* New unit tests:
- tests.test_npy_util.TestReplaceField
0.3.0 (2022-03-29)
------------------
* New functions and classes:
- load.load_module no longer nested in load.module_as_dict
- npy_util.iterate_dtype
* Bugfixes:
- files.PreOpenedFile object is now properly iterable
* New unit tests:
- tests.test_load.TestLoadModule
- tests.test_load.TestModuleAsDict
0.2.0 (2022-01-27)
------------------
* New modules:
- npy_util
- tests.test_numbers
- tests.test_objects
* New functions and classes:
- getsizeof, size_type_mapping in objects
- ndarray_handler added to size_type_mapping in objects
- isolate_dtype in npy_util
- as_base, digit_count in numbers
* New unit tests:
- tests.test_objects.TestGetsizeof
- tests.test_numbers.TestAsBase
- tests.test_numbers.TestDigitCount
* Added docs to sdist
* Moved map_array, mask2runs, runs2mask from math to npy_util
0.1.1 (2022-01-16)
------------------
Minor updates to first release.
* New functions and classes:
- segment_distance in math
* Bugfixes:
- math.read_divide correctly handles scalar inputs
* Created pytest configuration, added first set of unit tests
- files.tests.test_csv
- tests.test_math.TestSegmentDistance
* Improved documentation with autosummary
* Added this CHANGELOG to installed data
0.1 (2022-01-10)
----------------
First release.
* New modules
- time
- files.ui
* New functions and classes:
- json_registry made public in configuration
- semilogx_base, semilogy_base, loglog_base in mpl_util
- map_array, rms in math
- split_extension in files
* API changes:
- string_util.timestamp moved to time
- Added mask2runs and runs2mask to math
- Improvements to NumpyObject in configuration
- Improvements to copy_func in objects
- Added n argument to insert_suffix in files
* Bufixes:
- mpl_util.show_extents axis confusion
- Broken imports in submodules
* Officially supporting Python versions up to 3.10
* README -> README.md so GitHub can pick it up
0.1a2 (2021-01-09)
------------------
Second alpha release.
* Major additions to API
* New modules:
- threads
- configuration
- structures
- mapping
- ctypes_util
* New functions and classes:
- CloseableMixin in recipes
- to_hex, camel2snake, snake2camel, timestamp in string_util
- set_labels in mpl_utils
- real_divide, threshold, ang_diff_* in math
* API changes:
- Moved half of recipes to mapping
- Updated Namespace, (in mapping), added setdefaults
0.1a1 (2021-04-03)
------------------
First alpha release.
* API changes:
- SentinelType made public in root package
- ensure_extension.modes renamed to ensure_exntension.policies in files
0.1a1.dev2 (2019-03-31)
-----------------------
Second development pre-release.
* Major overhaul of documentation
0.1a1.dev1 (2019-03-20)
-----------------------
First development pre-release.
* First release on PyPI.
* Created Read the Docs pages.
* Only code required for imprint present initially.
* Documentation 90% complete.
* No tests worth speaking of.
Raw data
{
"_id": null,
"home_page": "https://gitlab.com/madphysicist/haggis",
"name": "haggis",
"maintainer": "Joseph R. Fox-Rabinovitz",
"docs_url": null,
"requires_python": null,
"maintainer_email": "jfoxrabinovitz@gmail.com",
"keywords": null,
"author": "Joseph R. Fox-Rabinovitz",
"author_email": "jfoxrabinovitz@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ad/c8/832f5820c4967182ab341b8b868465b550a94bd9a16267025b24f938040f/haggis-0.14.1.tar.gz",
"platform": null,
"description": "haggis\n======\n\nThis is a library of general purpose utility functions and classes written in\nPython. Much of this code is intended to support the imprint project\n<https://gitlab.com/madphysicist/imprint>. The modules of this library are\nmore-or-less standalone utilities, organized by category.\n\nThis library contains plenty of code that relies on external programs and less\ncommon Python libraries. The code is considered to be \"extras\", in the setuptools\nsense. Extras can be omitted without any modification to the python code. The\nfollowing extras are supported:\n\n - [docx]: Support for docx file utilities requires python-docx to be\n installed.\n - [latex]: Supporting LaTeX requires a host of external programs to work\n properly, so this feature is optional. See the dependency page in the main\n documentation for more information.\n - [pdf]: Requires the poppler library to be installed.\n - [ps]: Requires GhostScript to be installed.\n - [plot]: Plotting tools require matplotlib, which is a heavy dependency, and\n unnecessary for many purposes.\n - [qt]: Some optional utilities for pyqt6 are provided if it is installed.\n Since this a heavy dependency, they are quite optional.\n - [term]: Terminal colors work out of the box on Linux, but require the\n colorama library to work on Windows.\n - [scio]: Science I/O depends on the scipy and astropy libraries to deliver\n IDL and FITS file support, respectively.\n - [xlsx]: Support for xlsx file utilities requires openpyxl to be installed.\n\nTo install extras such as latex and pdf, do:\n\n pip install haggis[latex,pdf]\n\nSee the documentation at <https://haggis.readthedocs.io/en/latest> for more\ninformation, including the API documentation.\n\nThis library is licensed under the AGPLv3, and compatible with later versions.\nYou should have received a copy of the GNU Affero General Public License\nalong with this program. If not, see <https://www.gnu.org/licenses/>.\n\n\nChangelog\n=========\n\n0.14.1 (2024-10-17)\n-------------------\n* Fixes:\n - `configuration.JSONConfiguration` outputs newlines at end of file\n - Improved formatting of multi-line `configuration.NumpyObject`\n\n0.14.0 (2024-07-15)\n-------------------\n* New class:\n - args.StoreVariableNargs\n* API change:\n - `recipes.islast` has a new attribute, `last`, containing the\n latest element\n - `string_util.format_list` accepts `last_sep` to allow for more\n natural output\n - `string_util.format_list` `indent` defaults to zero\n* New unit tests:\n - tests.string_util.TestFormatList\n - tests.test_recipes.TestIsLast\n - tests.test_args.TestStoreVariableNargs\n* Bugfixes:\n - Missing raw-string identifiers in `tests.string_util.TestParseList`\n - `string_util.format_list` checks for invalid width\n\n0.13.3 (2024-07-15)\n-------------------\n* New functions:\n - os.redirect_stderr\n - os.redirect_stdout\n - os.redirect_stream\n - os.suppress_stderr\n - os.suppress_stdout\n* Bugfix:\n - `logs.ReturnableStreamHandler` clears the previous line when it\n gets a line after a carriage return.\n\n0.13.2 (2024-07-12)\n-------------------\n* New class:\n - logs.ReturnableStreamHandler\n* API changes:\n - New attribute `logs.RETURNABLE == \"returnable\"`\n - New keyword values in `logs.configure_logger`:\n - `log_stderr` accepts string `RETURNABLE` to use\n `ReturnableStreamHandler` when logging\n - `log_stdout` accepts string `RETURNABLE` to use\n `ReturnableStreamHandler` when logging\n\n0.13.1 (2024-07-11)\n-------------------\n* Bugfix:\n - Extra newlines printed in `configuraition.JSONConfiguration._pprint`\n* Nominal Qt5 support in gui.qt\n\n0.13.0 (2024-04-29)\n-------------------\n* New modules and packages:\n - gui package\n - gui.qt\n* New classes:\n - gui.qt.ImageAspectLabel\n\n0.12.1 (2024-06-24)\n-------------------\n* Bufixes:\n - `islast` does not crash on empty iterators\n* Typo fixes in documentation\n\n0.12.0 (2023-08-29)\n-------------------\n* New functions and classes:\n - string_util.parse_list\n - string_util.parse_pair\n - string_util.func_name\n* New unit tests:\n - tests.test_string_util.TestParsePair\n - tests.test_string_util.TestParseList\n\n0.11.0 (2023-08-29)\n-------------------\n\n* Bugfixes:\n - Setting correct `stacklevel` in `logs.add_logging_level`\n - Fixes to documentation of properties in `recipes.RangeBuilder` and\n `time.Stopwatch`\n - Counting tabs in prefix rather than entire string in\n `args.SmartHelpFormatter`\n* API changes:\n - New keywords in `string_util.horiz_cat` and\n `string_util.split_horiz_cat`.\n - `titles`: optional headings included with each column\n - `headers`: string or string generator to insert after the title\n - `width`: minimum width to allow for each column\n - `hsep`: header separator, similar to `sep`, which it defaults to\n - Dropped `missing='missing'` option since it truncated anyway\n - Renamed `recipes.shift_left` to `recipes.shift_up`\n* New unit tests:\n - tests.test_string_util\n* Added pytest-cov to required test dependencies\n\n0.10.1 (2023-08-21)\n-------------------\n\n* Fixes to test and documentation warnings\n\n0.10.0 (2023-08-20)\n-------------------\n\n* New modules:\n - args\n* New functions and classes:\n - args.SmartHelpFormatter\n* New unit tests:\n - tests.test_args\n\n0.9.2 (2023-08-20)\n------------------\n\n* Switched to trunk-based development\n\n0.9.1 (2023-03-26)\n------------------\n\n* Migrated to GitLab hosting\n\n0.9.0 (2023-03-15)\n------------------\n\n* New functions and classes:\n - logs.add_detail_level\n* Bugfixes:\n - Added missing default kwargs to monkeypatched version of\n logging.LogAdapter method in logs.add_log_level\n - Updated bondary handling in npy_util.prune_mask\n* logs.add_logging_level verifies exception info settings if prior calls\n are found\n\n0.8.0 (2022-11-04)\n------------------\n\n* New functions and classes:\n - recipes.chained_getter\n* New unit tests:\n - tests.test_logs.TestAddLoggingLevel\n - tests.test_logs.TestResetHandlers\n - tests.test_logs.TestLogMaxFilter\n - tests.test_logs.TestMetaLoggableType\n - tests.test_recipes.TestChainedGetter\n* Bugfixes:\n - Fixed sense of inclusive in logs.LogMaxFilter\n* logs.add_logging_level updates logging.LoggerAdapter\n\n\n0.7.1 (2022-10-24)\n------------------\n\n* New functions and classes:\n - npy_util.prune_mask\n\n\n0.7.0 (2022-10-17)\n------------------\n\n* New functions and classes:\n - npy_util.masked_index\n - npy_util.unmasked_index\n - npy_util.find_peaks\n* New unit tests:\n - tests.test_npy_util.TestMaskedIndex\n - tests.test_npy_util.TestUnmaskedIndex\n - tests.test_npy_util.TestFindPeaks\n\n\n0.6.0 (2022-10-11)\n------------------\n\n* API changes:\n - Parameter stop in recipes.RangeBuilder.update is now optional\n - Property span in recipes.RangeBuilder\n* Bugfixes:\n - Fixed handling of bulleted list styles in files.docx.list_number\n\n\n0.5.0 (2022-06-17)\n------------------\n\n* New functions and classes:\n - multiline_repr in string_util\n - RangeBuilder in recipes\n\n\n0.4.0 (2022-06-02)\n------------------\n\n* New functions and classes:\n - npy_util.replace_field\n* New unit tests:\n - tests.test_npy_util.TestReplaceField\n\n\n0.3.0 (2022-03-29)\n------------------\n\n* New functions and classes:\n - load.load_module no longer nested in load.module_as_dict\n - npy_util.iterate_dtype\n* Bugfixes:\n - files.PreOpenedFile object is now properly iterable\n* New unit tests:\n - tests.test_load.TestLoadModule\n - tests.test_load.TestModuleAsDict\n\n\n0.2.0 (2022-01-27)\n------------------\n\n* New modules:\n - npy_util\n - tests.test_numbers\n - tests.test_objects\n* New functions and classes:\n - getsizeof, size_type_mapping in objects\n - ndarray_handler added to size_type_mapping in objects\n - isolate_dtype in npy_util\n - as_base, digit_count in numbers\n* New unit tests:\n - tests.test_objects.TestGetsizeof\n - tests.test_numbers.TestAsBase\n - tests.test_numbers.TestDigitCount\n* Added docs to sdist\n* Moved map_array, mask2runs, runs2mask from math to npy_util\n\n\n0.1.1 (2022-01-16)\n------------------\n\nMinor updates to first release.\n\n* New functions and classes:\n - segment_distance in math\n* Bugfixes:\n - math.read_divide correctly handles scalar inputs\n* Created pytest configuration, added first set of unit tests\n - files.tests.test_csv\n - tests.test_math.TestSegmentDistance\n* Improved documentation with autosummary\n* Added this CHANGELOG to installed data\n\n\n0.1 (2022-01-10)\n----------------\n\nFirst release.\n\n* New modules\n - time\n - files.ui\n* New functions and classes:\n - json_registry made public in configuration\n - semilogx_base, semilogy_base, loglog_base in mpl_util\n - map_array, rms in math\n - split_extension in files\n* API changes:\n - string_util.timestamp moved to time\n - Added mask2runs and runs2mask to math\n - Improvements to NumpyObject in configuration\n - Improvements to copy_func in objects\n - Added n argument to insert_suffix in files\n* Bufixes:\n - mpl_util.show_extents axis confusion\n - Broken imports in submodules\n* Officially supporting Python versions up to 3.10\n* README -> README.md so GitHub can pick it up\n\n\n0.1a2 (2021-01-09)\n------------------\n\nSecond alpha release.\n\n* Major additions to API\n* New modules:\n - threads\n - configuration\n - structures\n - mapping\n - ctypes_util\n* New functions and classes:\n - CloseableMixin in recipes\n - to_hex, camel2snake, snake2camel, timestamp in string_util\n - set_labels in mpl_utils\n - real_divide, threshold, ang_diff_* in math\n* API changes:\n - Moved half of recipes to mapping\n - Updated Namespace, (in mapping), added setdefaults\n\n\n0.1a1 (2021-04-03)\n------------------\n\nFirst alpha release.\n\n* API changes:\n - SentinelType made public in root package\n - ensure_extension.modes renamed to ensure_exntension.policies in files\n\n\n0.1a1.dev2 (2019-03-31)\n-----------------------\n\nSecond development pre-release.\n\n* Major overhaul of documentation\n\n0.1a1.dev1 (2019-03-20)\n-----------------------\n\nFirst development pre-release.\n\n* First release on PyPI.\n* Created Read the Docs pages.\n* Only code required for imprint present initially.\n* Documentation 90% complete.\n* No tests worth speaking of.\n\n\n",
"bugtrack_url": null,
"license": "GNU Affero General Public License v3 or later (AGPLv3+)",
"summary": "General purpose utility library",
"version": "0.14.1",
"project_urls": {
"Bugs": "https://gitlab.com/madphysicist/haggis/-/issues",
"Documentation": "https://haggis.readthedocs.io/en/stable/",
"Homepage": "https://gitlab.com/madphysicist/haggis"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3a114d86aca86b85493ef50c029f9aa155cb8013234b8eee124ff9d7877877dd",
"md5": "568b1e13a6cf9160564661c3154f04b0",
"sha256": "7962ce71bb0b40c3d81342f8083e256895c122c96cf166b7d120317a107f290a"
},
"downloads": -1,
"filename": "haggis-0.14.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "568b1e13a6cf9160564661c3154f04b0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 221221,
"upload_time": "2024-10-17T21:49:31",
"upload_time_iso_8601": "2024-10-17T21:49:31.186782Z",
"url": "https://files.pythonhosted.org/packages/3a/11/4d86aca86b85493ef50c029f9aa155cb8013234b8eee124ff9d7877877dd/haggis-0.14.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "adc8832f5820c4967182ab341b8b868465b550a94bd9a16267025b24f938040f",
"md5": "80c2ffe93e245ac20bd59317877c1986",
"sha256": "16f1f9352107e398bbd87475f267ff7f8d7648f407014770b35862e8d14ff3c1"
},
"downloads": -1,
"filename": "haggis-0.14.1.tar.gz",
"has_sig": false,
"md5_digest": "80c2ffe93e245ac20bd59317877c1986",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 178957,
"upload_time": "2024-10-17T21:49:33",
"upload_time_iso_8601": "2024-10-17T21:49:33.051590Z",
"url": "https://files.pythonhosted.org/packages/ad/c8/832f5820c4967182ab341b8b868465b550a94bd9a16267025b24f938040f/haggis-0.14.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-17 21:49:33",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "madphysicist",
"gitlab_project": "haggis",
"lcname": "haggis"
}