Config-file

Latest version: v0.13.1

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

Scan your dependencies

Page 1 of 3

0.13.1

Fixed

- README formatting of "stringify" section.

0.13.0

Added

- Support for Python 3.9, 3.10, 3.11, and 3.12. The way `pathlib.Path` was being subclassed
was causing issues in newer Python versions and `distutils.util.strtobool` has been removed
in newer Python versions so a backported version is now being used.

Changed

- Extra `toml` and `yaml` dependencies have been updated.
- The `toml` extra now installs `tomlkit` version `0.7.2` on Python 3.6 and constrained to `^0.12.2` on Python 3.7
and greater. Previously, it was constrained to `^0.6.0`.
- The `yaml` extra now installs `ruamel.yaml` constrained to `^0.17.16`. Previously, it was constrained
to `^0.16.10`.

- Replaced deprecated use of `ruamel.yaml` methods in the YAML parser (via [28](https://github.com/eugenetriguba/config-file/pull/28), thanks [JaWeRn](https://github.com/JaWeRn)).

Removed

- Depreciated `stringify()` method on `ConfigFile`. Use `str()`
on the `ConfigFile` instead.

0.12.0

Added

- Python's built-in `in` keyword now works with a ConfigFile.

Example:

python
config = ConfigFile('./pyproject.toml')

'tool.poetry' in config
>>> True


Changed

- Depreciated `stringify()` in favor of just using the built-in `str()`.

Fixed

- Addresses issue 25 (INI parser isn't converting back to string).

0.11.0

Added

- `ConfigFile` can now accept yaml and toml files as optional extra file types.
As long as the extras (`yaml` and `toml`) are installed, those file types can also
be used.

- `ConfigFile` can now be indexed into using an array notation to get, set, and delete keys.

- `path` property to `ConfigFile`

- `original_path` property to `ConfigFile`

- `wild` optional argument to `has` on `ConfigFile` to check if the file has an
occurrence of the key anywhere in the file.

Removed

- `BaseParser` from the public API.

- `parser` optional argument from the `ConfigFile` constructor.

Changed

- `path` on the `ConfigFile` is now a property that can only be retrieved. `contents` is now private
but you can use `.stringify()` instead to get the contents. `parser` is now also private.

- `restore_original` in `ConfigFile` now raises a `FileNotFoundError` instead of an `OSError` if the original
file path does not exist.

- `restore_original`'s optional argument is now called `original_path` rather than `original_file_path`.

Fixed

- `default` in `ConfigFile`'s `get` method can now be `None`. Previously, it was defaulted to the
value `None` so there was no way of distinguishing between the default value and a user inputted
value of `None`.

0.10.0

Changed

- `toml` and `pyyaml` are now optional extra dependencies. This allows you to
not have to install them if you aren't using them.

- `retrieve_all` in `JsonParser`'s `get` method is now called `get_all` for
consistency. It isn't publicly available yet. The thought is to write a custom
ini parser first that supports multiple of the same keys and subsections.
This way you can have the `get_all`, `set_all`, `delete_all`, etc. methods
for all file type parsers. I would have to weight if that added complexity
of not using the built-in configparser and roll our own for some added
features is worth it or see if there are ways to work around it with
configparser that are ideal.

Fixed

- You can now specify a default and still coerce your return type. Previously,
if you specified a default, there was no logic in that branch to coerce your
return type as well.

0.9.0

Added

- `default` optional parameter to the `get()` method of `ConfigFile`.
The allows a default value to be fallen back to if the given key is missing.

- `return_type` optional parameter to `get()` method of `ConfigFile`. This
allows you to coerce the return type to one of your choosing by feeding it
the return value.

Changed

- Automatic type parsing is now off by default. This is because of the addition of
the `return_type` optional parameter. After using the package more, I think
the explicitness of specifying the type you're after or that you'd like to
automatically parse the type to one of the basic types is more maintainable.
However, I think the option to automatically parse or parse a whole section of
values is still a useful one.

- The `parse_type` parameter to `ConfigFile`'s `get()` method is now called
`parse_types`.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.