Pytoolbox

Latest version: v14.8.2

Safety actively analyzes 623704 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 10

14.8.2

Diff: https://github.com/davidfischer-ch/pytoolbox/compare/14.8.1...14.8.2

Features

* Add TypeAlias `git.RefKind` and use it
* Add function `logging.reset_logger` and use it

Fix and enhancements

* Keep `git` / `subprocess` log records separated
* Prevent a strange issue when reloading logging module

14.8.1

Diff: https://github.com/davidfischer-ch/pytoolbox/compare/14.8.0...14.8.1

Deprecations

* Replace your calls to `argparse.set_columns` by `console.set_columns`
* Replace your calls to `argparse.HelpArgumentParser` by `argparse.ArgumentParser`
* Replace your calls to `filesystem.recursive_copy` by `filesystem.copy_recursive`
* Replace your calls to `subprocess.git_clone_or_pull` by `git.clone_or_pull`
* Replace your calls to `subprocess.ssh` by `ssh.ssh`

Features

* Prevent `pytoolbox` logged events being output to `sys.stderr` by registering a `NullHandler`
* Add class `argparse.ChainAction` (argument parsing action)
* Add function `argparse.separator` (argument parsing type)
* Add function `arpgarse.env_default` (utility function)
* Add convenient constants `DIRECTORY_ARGS`, `FILE_ARG`, `REMAINDER_ARG` and `MULTI_ARG()` (`arpgarse` module)
* Add class `argparse.ArgumentParser` (renamed from `argparse.HelpArgumentParser`)
* Add class `argparse.ActionArgumentParser`
* Add TypeAlias `Color`
* Expose `arpgarse.{ArgumentTypeError,Namespace}` to be convenient (`import argparse` not required)
* Decorator `decorators.deprecated` now accept a `guideline` argument (default to `''`)
* Expose `logging.{CRITICAL, ..., NOTSET}`, `logging.{Logger, LogRecord}` to be convenient (`import logging` not required)
* Add TypedDict `subprocess.CallResult` and use it to type hint functions response (added `exception` key)
* Function `subprocess.cmd`: Now logging to `pytoolbox.subprocess.cmd.<binary>` unless log is defined
* Function `subprocess.cmd`: Log can be a function, a `Logger` or a `str`. `None` will be mapped to default behavior

Fix and enhancements

* Favor `type(obj)` over `obj.__class__`
* Class `exceptions.MessageMixin`: Now show missing attributes (attributes can be properties too)
* Class `exceptions.CalledProcessError`: Add property `cmd_short` and prevent exposing sensitive data in `__str__` or `__repr__`
* Fix calls to `yaml.dump` (as its now `ruamel.yaml`)
* Various improvements such as type hints, documentation, tests

14.8.0

Diff: https://github.com/davidfischer-ch/pytoolbox/compare/14.7.0...14.8.0

Minor compatibility breaks

* Replace `subprocess.CalledProcessError` by `exceptions.CalledProcessError` (keep a deprecated alias)
* Rename function `subprocess.git_clone_or_pull` to `ssh.clone_or_pull` (keep a deprecated alias)
* Rename function `subprocess.ssh` to `ssh.ssh` (keep a deprecated alias)
* Rename TypeAlias `subprocess.LoggerType` to `logging.LoggerType`

Deprecations

* Replace your calls to `subprocess.git_clone_or_pull` by `ssh.clone_or_pull`
* Rename function `subprocess.ssh` by `ssh.ssh`

Features

* Add module `git`
* Add module `ssh`
* Add class `exceptions.CalledProcessError`
* Add class `exceptions.DuplicateGitTagError`
* Add class `exceptions.GitReferenceError`
* Add class `exceptions.RegexMatchGroupNotFoundError`
* Add class `exceptions.SSHAgentConnectionError`
* Add class `exceptions.SSHAgentLoadingKeyError`
* Add class `exceptions.SSHAgentParsingError`
* Add function `logging.get_logger`
* Add Protocol `logging.BasicLggerFunc`
* Add class `logging.BasicFuncLogger`
* Add function `regex.group_replace`
* Add TypeAlias `serialization.YamlDataTypes`
* Add function `serialization.get_yaml`
* Add function `serialization.to_yaml`
* Add decorator `unittest.skip_if_missing`

Fix and enhancements

* Module `subprocess`: Now log defaulting to module's log
* Implement `__repr__` for exception classes
* Replace `pyyaml` by `ruamel.yaml`
* Cover `regex.Match` with tests
* Test code with `ruff`

14.7.0

Diff: https://github.com/davidfischer-ch/pytoolbox/compare/14.6.0...14.7.0

Minor compatibility breaks

* Drop Python 3.9 & 3.10 compatibility
* Favor `pathlib.Path` over `str`:
* Returning `pathlib.Path` when its a path ...
* Not accepting
* Force named arguments when it makes sense (`mypy` should help you with this)
* Drop `is_path` argument, instead check if its an instance of `pathlib.Path`:
* Function `filesystem.from_template`
* Function `filesystem.get_bytes`
* Rename argument `format` to `fmt` to fix a linter issue:
* Function `datetime.datetime_now`
* Function `datetime.datetime_to_str`
* Function `datetime.str_to_datetime`
* Method `module.All.diff`: Drop argument `to_type`
* Function `network.http.download_ext_multi`: Argument `resources` must now be an iterable of `Resource`
* Functions `validation.valid_*`: Do not accept `None` anymore
* Rename function `filesystem.recursive_copy` to `filesystem.copy_recursive` (keep a deprecated alias)

Deprecations

* Replace your calls to `filesystem.copy_recursive` by `filesystem.recursive_copy`

Features

* Type hint a massive portion of code (and import annotations from __future__)!
* Ensure Python 3.11 & 3.12 compatibility
* Add optional MongoDB feature (`mongodb` extra)
* Add class `argparse.Namespace`
* Add context manager `filesystem.chdir`
* Add Protocol `filesystem.CopyProgressCallback`
* Add Protocol `filesystem.TemplateHookFunc`
* Add dataclass `network.http.Resource`
* Add Protocol `network.http.SingleProgressCallback`
* Add Protocol `network.http.MultiProgressCallback`
* Add TypeAlias `subprocess.CallArgType`
* Add TypeAlias `subprocess.CallArgsType`
* Add TypeAlias `subprocess.LoggerType`
* Add TypeAlias `types.GenericType`

Fix and enhancements

* Add explicit named arguments `recursive`, `top_down`, `on_error`, `follow_symlinks`:
* Function `filesystem.chown`
* Function `filesystem.find_recursive`
* Add explicit named arguments related to `requests.get`:
* Function `network.http.download_ext`
* Function `network.http.iter_download_core`
* Function `network.http.iter_download_to_file`
* Module `multimedia.ffmpeg`: Enhance it and make it compatible with ffmpeg 6.1 (See commit d026afdbbe86becbccb3c75d2a1830052834cd0a)
* Function `filesystem.copy_recursive`: Cover it with tests (See commit f4d5bd11992525d9fe08c56c668c254e7093f30d)
* Class `network.smpte2022.base`: Make it Python 3.9+ compatible (by Július Milan <julius.milan.22gmail.com>)
* Class `types.StrongTypedMixin`: Make it compatible with future style annotations
* Module `multimedia.ffmpeg.miscellaneous`: Consolidate code (move common attributes to the parent class)
* Class `multimedia.ffmpeg.miscellaneous.Media`: Refactor it ()
* Refresh `__all__` and don't use magic when not necessary
* Switch from Travis CI to GitHub Actions
* Rework imports (drop multiple-imports *style*)
* Fix various linter issues
* Update `AUTHORS.md`

14.6.0

Diff: https://github.com/davidfischer-ch/pytoolbox/compare/14.5.1...14.6.0

Minor comptability breaks

* Functions `humanize.natural*`: Rename `format` arguments to `fmt`

Features

* Module `humanize`: Add functions `parse_*`

Fix and enhancements

* Ensure Python 3.11 compatibility
* Explain how to bother with GExiv2
* Add more type hints (especially `humanize` and `multimedia.exif`)
* Add `PyGObject` to requirements for `imaging` feature

14.5.1

Diff: https://github.com/davidfischer-ch/pytoolbox/compare/14.5.0...14.5.1

Fix and enhancements

* Make code compatible with legacy versions of `packaging`

Page 1 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.