Py-config-runner

Latest version: v0.3.2

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

Scan your dependencies

Page 1 of 2

0.05

What's Changed

* Code updates by vfdev-5 in https://github.com/vfdev-5/py_config_runner/pull/13
* Added mutations to config object by vfdev-5 in https://github.com/vfdev-5/py_config_runner/pull/14
* Code cosmetics by vfdev-5 in https://github.com/vfdev-5/py_config_runner/pull/15


**Full Changelog**: https://github.com/vfdev-5/py_config_runner/compare/v0.2.1...v0.3.0

0.3.2

Configuration can be now used with multiprocessing:
python
import multiprocessing as mp


def worker_config_checker(config):
import numpy as np

assert "a" in config
assert config.a == 123

assert "b" in config
np.testing.assert_allclose(config.b, np.array([1, 2, 3]))

assert "out" in config
assert config.out == 12

if __name__ == "__main__":
config = ConfigObject(config_filepath)
ctx = mp.get_context("spawn")
p = ctx.Process(target=worker_config_checker, args=(config,))
p.start()
p.join()


Deep Learning DDP example with Ignite :
- https://github.com/vfdev-5/py_config_runner/tree/master/examples#deep-learning-example-with-pytorch-ignite

0.3.1

Configuration can be updated from the script before loading it and mutation can change types.

Limitations: mutation can not a local object or class instance.

Example
python
old_value = {"encoder": "E1", "decoder": "D1"}
old_value = "unet"
old_value = [1, 2, 3]
old_value = 5

new_value = "unet"
new_value = [1, 2, 3]
new_value = {"encoder": "E1", "decoder": "D1"}
new_value = 5

Create a configuration file:
filepath = os.path.join(dirname, "custom_module.py")
s = f"""
a = {old_value}
"""

with open(filepath, "w") as h:
h.write(s)

Load configuration:
config = ConfigObject(filepath, mutations={"a": new_value})
assert config.a == new_value


What's Changed
* Mutations can change types by vfdev-5 in https://github.com/vfdev-5/py_config_runner/pull/16
* Updated docstring by vfdev-5 in https://github.com/vfdev-5/py_config_runner/pull/17


**Full Changelog**: https://github.com/vfdev-5/py_config_runner/compare/v0.3.0...v0.3.1

0.3.0

Configuration can be updated from the script before loading it.

Let's assume that configuration python file has ``learning_rate = 0.01`` which is used to configure an optimizer:

python
baseline.py configuration file

0.2.1

- Fixed 10

0.2.0

- Expose ConfigObject as Python API without using CLI
- Another way to validate configuration (uses pydantic)

See example:
- https://github.com/vfdev-5/py_config_runner/tree/master/examples

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.