Skip to main content

Core library of the prettyetc project

Project description

The project is divided in 2 packages:

  • prettyetc-qt (a qt-based graphical interface for prettyetc)

  • prettyetc (the core with the APIs)

prettyetc-qt

Browse your configuration files in a visual way with a pretty and universal interface.

Prettyetc allows you to edit your configs in a multitabbed window, each config is displayed as a foldable tree that has no ugly brackets, quotes or anything else which might be language specific.

For example you can read a JSON and an INI file using the same view and structure.

The official GUI is powered by the Qt framework, using the official Python bindings.

prettyetc

Edit configuration files with an advanced tree-based data structure and convert them to other languages.

Installation

NOTE: If you have both Python 2 and 3 installed in your system, you probably need use pip3 instead of pip.

Full installation with the UI: pip install prettyetc-qt .

Or, if you want only the core: pip install prettyetc[all].

More informations about the installation process at: https://prettyetc.gitlab.io/prettyetc/developing/userguide/installation.html

An example (using the core APIs)

Let’s see what prettyetc can do.

from prettyetc.etccore import ConfigFileFactory, DictField

# create the factory
factory = ConfigFileFactory(enable_logger=True)

# create the file, this can be used to read and write the file
file = factory.create_file("colors.json")

# read the file and save it in a RootField
root = file.read()

# add a new color
color = {
    "color": "aqua",
    "code": {
        "rgba": [0, 255, 255, 1],
        "hex": "#0FF"
    },
    "web_safe": True,
}
root["colors"].add(DictField.from_primitives(color))

# change red color name
red_color = root["colors"][2]
red_color["color"].data = "light-red"

# change red color codes
red_color["code"]["rgba"][0].data = 204
red_color["code"]["hex"].data = "#c00"

# change red color web_safe field
red_color["web_safe"].data = False

# write the RootField to file (beautified json)
file.write(root, language="json", beautify=True)

See getting started for a quick start on how to use prettyetc.

Supported languages

Due to languages nature or the used backend, the parsers/serializers do not implement all field specifications, but a subset of those.

Here is a detailed table explaining what feature are supported by language.
Language
- Type
JSON
Parser
JSON
Serializer
INI
Parser
INI
Serializer
XML
Parser
XML
Serializer
YAML
Parser
YAML
Serializer
Etc 1
Parser
Etc 1
Serializer
Field
name

V 2

V 2

V

V

V

V

V 2

V 2

V

V

Field
description
(comment)

I

I

V

V

Field
readonly

I

I

V

V

Field
attributes

I

I

V

V

Indexable
fields

V

V

V 3

V 3

V

V

V

V

Typed
field

V

V

E 4

E 4

P

P

V

V

V

V

* backend require external libraries

Legend:

empty space: not supported yet
I: impossible due to language specification
E: enforced support
P: partially supported
V: fully supported

1: the etc language is divided into some sublanguages, so some feature can be unavailable in a specific sublanguage.
2: For arrays, the name can be setted to None or to an integer index.
3: limited to one level.
4: The INI specification does not support typing, so any key and value is a string.

Docs

For a detailed explanation of core features, Prettyetc’s Field meaning, API reference and other, we suggest to go to the documentation of Prettyetc.

API Documentation: https://prettyetc.gitlab.io/prettyetc/index.html

An explanation of the etc language

The etc configuration language is a collection of micro-languages, all of them are structured similar to INI files (without sections).

The origin of this name is the *nix /etc folder that contain the system or default configuration for lots of programs and also kernel settings.

Except for files specifically formatted in INI or JSON, the files in this folder has an undefined and a simple syntax; made by spaces, the “:” character or the “=” character (somewhere) and the “#” character as comment start, that remember the sh/bash syntax.

Examples of these files are: /etc/resolv.conf /etc/sysctl.conf /etc/modules.

Our parser aim to handle most of it, representing it using fields in a universal view.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prettyetc-0.4.0-py3-none-any.whl (87.4 kB view details)

Uploaded Python 3

File details

Details for the file prettyetc-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: prettyetc-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 87.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.9

File hashes

Hashes for prettyetc-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b0828a7a13e6e27476364e86a14fc980cb9528a0ac2a8cd90596ecc6b38e9b75
MD5 2cac2b40d33989b630455ab90ba9c405
BLAKE2b-256 e7a119d9152f51c8930812fab223cbbe9a4c3b658be16463f11db5bb1450cc19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page