Skip to content

Releases: RealA10N/validit

v1.3.2

26 Jun 09:06
eb2c477
Compare
Choose a tag to compare

Changes

Fixed

  • Fixed a bug that prevented the creation of optional options templates (Optional(Options(...)))

Commits

  • b76eab4: 🐛 Fixed YAML syntax: yes 👉 true (Alon (PC))
  • be46ec1: 🌟 Added option to manually trigger the publish workflow (Alon (PC))
  • b9470b9: 🐛 Fixed a bug that wouldn't allow Optional(Options(...)) (Alon (PC))
  • eb2c477: 🔖 Release v1.3.2 🎉 (Alon (PC))

configTemplate v0.3.1

10 Jun 16:41
7b684a2
Compare
Choose a tag to compare

Build PyPI PyPI - Python Version GitHub Repo stars

Easily define configuration file structures, and check if a given configuration file matches the template.

Installation

configTemplate is tested on CPython 3.6, 3.7, 3.8, and 3.9. Simply install using pip:

pip install configTemplate

Support for additional file formats

By default, configTemplate only supports `` configuration files, or already loaded data (not directly from a configuration file). However, using additional dependencies, configTemplate supports the following file formats:

  • JSON
  • YAML
  • TOML

To install configTemplate with the additional required dependencies to support your preferred file format, use:

pip install configTemplate[yaml]        # install dependencies for yaml files
pip install configTemplate[toml]        # toml files
pip install configTemplate[json,toml]   # json and toml files
pip install configTemplate[all]         # all available file formats

Usage

To create a template, you will need the basic Template module, and usually the other three basic modules TemplateList, TemplateDict, and TemplateOptional.

from configTemplate import Template, TemplateList, TemplateDict, TemplateOptional

Now, let's create a basic template that represents a single user:

TemplateUser = TemplateDict(        # a dictionary with 2 required values
    username=Template(str),         # username must be a string
    passcode=Template(int, str),    # can be a string or an integer.
    nickname=TemplateOptional(str), # optional - if provided, must be a string.
)

Check if data matches your template using the check method:

errors = TemplateUser.check({'username': 'RealA10N', 'passcode': 12345})
# the check method returns a `TemplateCheckErrorManager` instance
# read full documentation for more information.

if errors:
    print(f'Found {errors.count} conflicts:')
    print(errors)   # prints a detailed and colored error list

else:
    print('data follows the template!')

Using configTemplate as a dependency

configTemplate is still under active development, and some core features may change substantially in the near future.

If you are planning to use configTemplate as a dependency for your project, we highly recommend specifying the exact version of the module you are using in the requirements.txt file or setup.py scripts.

For example, to pinpoint version v0.3.1 use the following line in your requirements.txt file:

configTemplate==0.3.1
configTemplate[yaml]==0.3.1     # If using extra file formats

configTemplate v0.3.0

09 Jun 20:28
e5c310b
Compare
Choose a tag to compare

Build PyPI PyPI - Python Version GitHub Repo stars
Easily define configuration file structures, and check if a given configuration file matches the template.

Installation

configTemplate is tested on CPython 3.6, 3.7, 3.8 and 3.9. Simply install using pip:

pip install configTemplate

Support for additional file formats

By default, configTemplate only supports json configuration files, or already loaded data (not directly from a configuration file).
However, using additional dependencies, configTemplate supports the following file formats:

  • json
  • yaml
  • toml

To install configTemplate with the additional required dependencies to support your preferred file format, use:

pip install configTemplate[yaml]        # install dependencies for yaml files
pip install configTemplate[toml]        # toml files
pip install configTemplate[json,toml]   # json and toml files
pip install configTemplate[all]         # all available file formats

Usage

To create a template, you will need the basic Template module, and usually the other three basic modules TemplateList, TemplateDict and TemplateOptional.

from configTemplate import Template, TemplateList, TemplateDict, TemplateOptional

Now, lets create a basic template that represents a single user:

TemplateUser = TemplateDict(        # a dictionary with 2 required values
    username=Template(str),         # username must be a string
    passcode=Template(int, str),    # can be a string or an integer.
    nickname=TemplateOptional(str), # optional - if provided, must be a string.
)

Check if data matches your template using the check method:

errors = TemplateUser.check({'username': 'RealA10N', 'passcode': 12345})
# the check method returns a `TemplateCheckErrorManager` instance
# read full documentation for more information.

if errors:
    print(f'Found {errors.count} conflicts:')
    print(errors)   # prints a detailed and colored error list

else:
    print('data follows the template!')

Using configTemplate as a dependency

configTemplate is still under active development, and some core features may change substantially in the near future.

If you are planning to use configTemplate as a dependency for your project, we highly recommend to specify the exact version of the module you are using in the requirements.txt file or setup.py scripts.

For example, to pinpoint version v0.3.0 use the following line in your requirements.txt file:

configTemplate==0.3.0
configTemplate[yaml]==0.3.0     # If using extra file formats

configTemplate v0.2.0

04 Jun 20:50
0173977
Compare
Choose a tag to compare

Build PyPI PyPI - Python Version GitHub Repo stars
Easily define configuration file structures, and check if a given configuration file matches the template.

Installation

configTemplate is tested on CPython 3.6, 3.7, 3.8 and 3.9.
Simply install using pip:

pip install configTemplate

Usage

To create a template, you will need the basic Template module, and usually the other three basic modules TemplateList, TemplateDict and TemplateOptional.

from configTemplate import Template, TemplateList, TemplateDict, TemplateOptional

Now, lets create a basic template that represents a single user:

TemplateUser = TemplateDict(        # a dictionary with 2 required values
    username=Template(str),         # username must be a string
    passcode=Template(int, str),    # can be a string or an integer.
    nickname=TemplateOptional(str), # optional - if provided, must be a string.
)

Check if data matches your template using the check method:

errors = TemplateUser.check({'username': 'RealA10N', 'passcode': 12345})
# the check method returns a `TemplateCheckErrorManager` instance
# read full documentation for more information.

if errors:
    print(f'Found {errors.count} conflicts:')
    print(errors)   # prints a detailed and colored error list

else:
    print('data follows the template!')

Using configTemplate as a dependency

configTemplate is still under active development, and some core features may change substantially in the near future.

If you are planning to use configTemplate as a dependency for your project, we highly recommend to specify the exact version of the module you are using in the requirements.txt file or setup.py scripts.

For example, to pinpoint version v0.1.0 use the following line in your requirements.txt file:

configTemplate==0.2.0

configTemplate v0.1.0

31 May 22:41
ea19d6c
Compare
Choose a tag to compare

Build PyPI PyPI - Python Version GitHub Repo stars
Easily define configuration file structures, and check if a given configuration file matches the template.

Installation

configTemplate is tested on CPython 3.6, 3.7, 3.8 and 3.9.
Simply install using pip:

pip install configTemplate

Usage

To create a template, you will need the basic Template module, and usually the other two basic modules TemplateList and TemplateDict.

from configTemplate import Template, TemplateList, TemplateDict

Now, lets create a basic template that represents a single user:

TemplateUser = TemplateDict(    # a dictionary with 2 required values
    username=Template(str),     # username must be a string
    passcode=Template(int, str) # can be a string or an integer.
)

Check if data matches your template using the check method:

errors = TemplateUser.check({'username': 'RealA10N', 'passcode': 12345})
# the check method returns a `TemplateCheckErrorManager` instance
# read full documentation for more information.

if errors:
    print(f'Found {errors.count} conflicts:')
    print(errors)   # prints a detailed and colored error list

else:
    print('data follows the template!')

Using configTemplate as a dependency

configTemplate is still under active development, and some core features may change substantially in the near future.

If you are planning to use configTemplate as a dependency for your project, we highly recommend to specify the exact version of the module you are using in the requirements.txt file or setup.py scripts.

For example, to pinpoint version v0.1.0 use the following line in your requirements.txt file:

configTemplate==0.1.0