SimpleParam
About
SimpleParam was inspired by the param library which offers lots of neat features in a
small package, however param has a tricky codebase. In SimpleParam you can either create Parameter or
ParameterStore using simple synthax.
SimpleParam is certainly not complete and is missing a lot of awesome features of param and of course, has not been battle-tested yet. Missing features (such as Array, List, etc) will be added as my other projects that use SimpleParam will require them.
Usage
You can intilize Parameter like this:
import simpleparam as param
number = param.Number(42)
number
>>> Parameter(name=param, value=42, doc=')
However, it is probably better to use parameters inside of a ParameterStore, where you can store multiple parameters together and take advantage of additional functionality (e.g. locking of parameters with constant or exporting parameters as JSON object using export_as_dict):
import simpleparam as param
class Config(param.ParameterStore):
def __init__(self):
param.ParameterStore.__init__(self)
# # you can add parameter docstrings by setting `doc`
self.integer = param.Integer(42,
doc="A not very important value")
# `auto_bound` forces hard bounds on values that are outside the specification
self.number = param.Number(42.,
softbounds=[0, 100],
hardbounds=[1, 100],
auto_bound=True)
# setting `allow_any` to False, will force values to be of `str` instance
self.string = param.String("string",
allow_any=False)
# you can set internal parameter name by setting the value of `name`
self.choice = param.Choice("foo",
name="foo_bar_choice",
choices=["foo", "bar"],
)
# parameters can be prevented from being changed by setting value of `constant
self.color = param.Color("#FFFFFF",
constant=True)
self.bool = param.Boolean(True)
self.range = param.Range(value=[0, 100], hardbounds=[0, 100])
config = Config()
config
>>> ParameterStore(count=7)
For complete documentation, please visit the docs website.
Instalation
Install from PyPI
pip install simpleparam
or directly from GitHub
pip install git+https://github.com/lukasz-migas/SimpleParam.git
or in development mode
git clone git+https://github.com/lukasz-migas/SimpleParam.git
cd SimpleParam
python setup.py develop
Requirements
SimpleParam has no external requirements and works in py2 and py3.
Planned features
- add 'List', 'Dict' classes
- rename 'Color' to 'ColorHEX' or add 'modes': RGB or HEX
- add Array class
Metadata
Release files for simpleparam 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simpleparam-0.0.4.tar.gz | 9.7 kB | Without provenance | Details for simpleparam-0.0.4.tar.gz |
Release files / simpleparam-0.0.4.tar.gz
| Download URL | simpleparam-0.0.4.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98e4586bab22bfe18b9cd40980afd89825122e40be6c28f57f5cea92e24a04ba
|
|
BLAKE2b-256 checksum How to use checksums |
1de12b395d66d4f1808d87d17cccc16c1e685b440b5124854cb72cfe629ee3bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/2.7.15
|
Security for simpleparam 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.