AbjadConfiguration

class systemtools.AbjadConfiguration

Abjad configuration.

>>> import abjad
>>> abjad_configuration = abjad.AbjadConfiguration()
>>> abjad_configuration['accidental_spelling']
'mixed'

Behavior at instantiation:

  • Looks for $HOME/.abjad/.
  • Creates $HOME/.abjad/ if directory does not exist.
  • Looks for $HOME/.abjad/abjad.cfg.
  • Creates $HOME/.abjad/abjad.cfg if file does not exist.
  • Parses $HOME/.abjad/abjad.cfg.
  • Provides default key-value pairs for pairs which fail validation.
  • Writes configuration changes to disk.
  • Creates Abjad output directory if directory does not exist.

Supports mutable mapping dictionary interface.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_systemtools { graph [label=systemtools]; "abjad.tools.systemtools.AbjadConfiguration.AbjadConfiguration" [color=black, fontcolor=white, group=2, label=<<B>AbjadConfiguration</B>>, shape=box, style="filled, rounded"]; "abjad.tools.systemtools.Configuration.Configuration" [color=3, group=2, label=Configuration, shape=oval, style=bold]; "abjad.tools.systemtools.Configuration.Configuration" -> "abjad.tools.systemtools.AbjadConfiguration.AbjadConfiguration"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.systemtools.Configuration.Configuration"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

abjad_boilerplate_directory Gest Abjad boilerplate directory.
abjad_directory Gets Abjad directory.
abjad_experimental_directory Gets Abjad experimental directory.
abjad_output_directory Gets Abjad output directory.
abjad_root_directory Gets Abjad root directory.
configuration_directory_name Gets configuration directory name.
configuration_directory_path Gets configuration directory path.
configuration_file_name Gets configuration file name.
configuration_file_path Gets configuration file path.
get(*arguments, **keywords) Get a key.
get_abjad_startup_string() Gets Abjad startup string.
get_abjad_version_string() Gets Abjad version string.
get_lilypond_minimum_version_string() Gets LilyPond minimum version string.
get_lilypond_version_string() Gets LilyPond version string.
get_python_version_string() Gets Python version string.
get_tab_width() Gets tab width.
get_text_editor() Gets text editor.
home_directory Gets home directory.
lilypond_log_file_path Gets LilyPond log file path.
list_package_dependency_versions() Lists package dependency versions.
set_default_accidental_spelling([spelling]) Sets default accidental spelling.
temp_directory Gets system temp directory.
__delitem__(i) Deletes item i from configuration.
__eq__(argument) Is true when ID of argument equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__getitem__(argument) Gets item or slice identified by argument.
__hash__() Hashes Abjad object.
__iter__() Iterates configuration settings.
__len__() Gets the number of settings in configuration.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.
__setitem__(i, argument) Sets configuration item i to argument.

Read-only properties

AbjadConfiguration.abjad_boilerplate_directory

Gest Abjad boilerplate directory.

Return string.

AbjadConfiguration.abjad_directory

Gets Abjad directory.

Returns string.

AbjadConfiguration.abjad_experimental_directory

Gets Abjad experimental directory.

Returns string.

AbjadConfiguration.abjad_output_directory

Gets Abjad output directory.

Returns string.

AbjadConfiguration.abjad_root_directory

Gets Abjad root directory.

Returns string.

AbjadConfiguration.configuration_directory_name

Gets configuration directory name.

Returns string.

(Configuration).configuration_directory_path

Gets configuration directory path.

Defaults to $HOME/{configuration_directory_name}.

If $HOME is read-only or $HOME/{configuration_directory_name} is read-only, returns $TEMP/{configuration_directory_name}.

Also caches the initial result to reduce filesystem interaction.

Returns string.

AbjadConfiguration.configuration_file_name

Gets configuration file name.

Returns string.

(Configuration).configuration_file_path

Gets configuration file path.

Returns string.

(Configuration).home_directory

Gets home directory.

Returns string.

AbjadConfiguration.lilypond_log_file_path

Gets LilyPond log file path.

Returns string.

(Configuration).temp_directory

Gets system temp directory.

Returns string.

Methods

(Configuration).get(*arguments, **keywords)

Get a key.

Class & static methods

classmethod AbjadConfiguration.get_abjad_startup_string()

Gets Abjad startup string.

>>> abjad_configuration.get_abjad_startup_string()
'Abjad 2.21 (development)'

Returns string.

static AbjadConfiguration.get_abjad_version_string()

Gets Abjad version string.

>>> abjad_configuration.get_abjad_version_string()
'2.21'

Returns string.

classmethod AbjadConfiguration.get_lilypond_minimum_version_string()

Gets LilyPond minimum version string.

>>> abjad_configuration.get_lilypond_minimum_version_string() 
'2.17.0'

Returns string.

static AbjadConfiguration.get_lilypond_version_string()

Gets LilyPond version string.

>>> abjad_configuration.get_lilypond_version_string() 
'2.19.1'

Returns string.

static AbjadConfiguration.get_python_version_string()

Gets Python version string.

>>> abjad_configuration.get_python_version_string() 
'2.7.5'

Returns string.

static AbjadConfiguration.get_tab_width()

Gets tab width.

>>> abjad_configuration.get_tab_width()
4

Used by code generation functions.

Returns nonnegative integer.

static AbjadConfiguration.get_text_editor()

Gets text editor.

>>> abjad_configuration.get_text_editor() 
'vi'

Returns string.

static AbjadConfiguration.list_package_dependency_versions()

Lists package dependency versions.

>>> abjad_configuration.list_package_dependency_versions() 
{'sphinx': '1.1.2', 'pytest': '2.1.2'}

Returns dictionary.

static AbjadConfiguration.set_default_accidental_spelling(spelling='mixed')

Sets default accidental spelling.

Sets default accidental spelling to sharps:

>>> abjad_configuration.set_default_accidental_spelling('sharps')
>>> [abjad.Note(13, (1, 4)), abjad.Note(15, (1, 4))]
[Note("cs''4"), Note("ds''4")]

Sets default accidental spelling to flats:

>>> abjad_configuration.set_default_accidental_spelling('flats')
>>> [abjad.Note(13, (1, 4)), abjad.Note(15, (1, 4))]
[Note("df''4"), Note("ef''4")]

Sets default accidental spelling to mixed:

>>> abjad_configuration.set_default_accidental_spelling()
>>> [abjad.Note(13, (1, 4)), abjad.Note(15, (1, 4))]
[Note("cs''4"), Note("ef''4")]

Defaults to 'mixed'.

Mixed test case must appear last here for doc tests to check correctly.

Returns none.

Special methods

(Configuration).__delitem__(i)

Deletes item i from configuration.

Returns none.

(AbjadObject).__eq__(argument)

Is true when ID of argument equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(Configuration).__getitem__(argument)

Gets item or slice identified by argument.

Returns item or slice.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(Configuration).__iter__()

Iterates configuration settings.

Returns generator.

(Configuration).__len__()

Gets the number of settings in configuration.

Returns nonnegative integer.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

(Configuration).__setitem__(i, argument)

Sets configuration item i to argument.

Returns none.