tiramisu/doc/getting-started.txt

87 lines
2.7 KiB
Plaintext
Raw Permalink Normal View History

==================================
2013-05-17 12:11:14 +02:00
Getting started
==================================
2013-08-23 11:16:26 +02:00
What is options handling ?
2012-11-20 17:14:58 +01:00
=================================
2018-08-14 12:03:47 +02:00
Due to more and more available options required to set up an operating system,
compiler options or whatever, it became quite annoying to hand the necessary
options to where they are actually used and even more annoying to add new
options. To circumvent these problems the configuration control was
2013-08-23 11:16:26 +02:00
introduced...
What is Tiramisu ?
2012-11-20 17:14:58 +01:00
===================
2013-09-05 16:56:02 +02:00
Tiramisu is an options handler and an options controller, which aims at
2013-08-23 11:42:22 +02:00
producing flexible and fast options access. The main advantages are its access
2013-08-23 11:16:26 +02:00
rules and the fact that the whole consistency is preserved at any time, see
2013-08-23 11:42:22 +02:00
:doc:`consistency`. There is of course type and structure validations, but also
2018-08-14 12:03:47 +02:00
validations towards the whole options. Furthermore, options can be reached and
2013-08-29 11:48:34 +02:00
changed according to the access rules from nearly everywhere in your appliance.
2012-11-20 17:14:58 +01:00
Just the facts
==============
2012-11-20 17:14:58 +01:00
.. _gettingtiramisu:
2018-08-14 12:03:47 +02:00
`tiramisu`\ 's home page is here_
.. _here: https://forge.cadoles.com/Cadoles/tiramisu
Download
---------
2018-08-14 12:03:47 +02:00
2013-08-23 11:42:22 +02:00
To obtain a copy of the sources, check it out from the repository using `git`.
2013-08-29 11:48:34 +02:00
We suggest using `git` if one wants to access to the current developments.
::
2018-08-14 12:03:47 +02:00
git clone https://forge.cadoles.com/Cadoles/tiramisu.git
2013-08-23 11:42:22 +02:00
This will get you a fresh checkout of the code repository in a local directory
named ``tiramisu``.
Getting started
-------------------
2013-08-23 11:42:22 +02:00
Option objects can be created in different ways. Let's perform very basic
:class:`~tiramisu.option.Option` and :class:`~tiramisu.config.Config` object
2013-08-23 11:16:26 +02:00
manipulations:
::
>>> from tiramisu.config import Config
>>> from tiramisu.option import OptionDescription, BoolOption
2013-08-29 11:48:34 +02:00
>>> # let's create a group of options... with only one option inside
>>> descr = OptionDescription("optgroup", "", [
... BoolOption("bool", "", default=False)])
2013-08-29 11:48:34 +02:00
>>> # c is a namespace as well as a container for the options
2013-08-23 11:42:22 +02:00
>>> c = Config(descr)
>>> c.bool
False
2013-08-23 11:42:22 +02:00
>>> c.bool = True
>>> c.bool
True
2013-08-29 11:48:34 +02:00
So by now, we have:
2013-08-23 11:42:22 +02:00
- a namespace (which is `c` here)
- the access of an option's value by the
2018-08-14 12:03:47 +02:00
attribute access way (here `bool`, which is a boolean option
2013-08-23 11:42:22 +02:00
:class:`~tiramisu.option.BoolOption()`.
2018-08-14 12:03:47 +02:00
So, option objects are produced at the entry point `c` and then handed down to
where they are actually used when `c.bool` is triggered. This keeps options
2013-08-29 11:48:34 +02:00
local but available at any timer and consistent.
2013-08-23 11:42:22 +02:00
2018-08-14 12:03:47 +02:00
Once the namespace is created, we can set a
2013-08-29 11:48:34 +02:00
:meth:`~config.CommonConfig.read_write()` access to the options::
2013-08-23 11:42:22 +02:00
>>> c.read_write()
2013-08-29 11:48:34 +02:00
2018-08-14 12:03:47 +02:00
which enables us to set a bunch of access rules that we wil explain later in
2013-08-29 11:48:34 +02:00
:doc:`status`.