This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

INI-files parser with schemes and types

Philosophy of Zini

Application’s settings must be simple! In it should be a code or complex structures. Must be only a simple types.

Why not…

JSON?

JSON is uncomfortable and unextendable.

YAML?

The YAML is like a garden of rakes. It’s very complex format. I do not need all it’s futures.

Configparser?

  1. Configparser is ugly;
  2. Configparser is overengineered;
  3. Configparser is not have type casting;
  4. Configparser is not have type checking;
  5. Configparser is… configparser.

Supported types

boolean:

simple true or false, e.g. key = true

int:

simple numeric type, e.g. key = 13

float:

float type, e.g. key = 3.14

string:

strings always uses quotes, e.g. key = "some string"

datetime:

datetime formated like as ISO 8601

  • YYYY-MM-DD
  • YYYY-MM-DD hh:mm
  • YYYY-MM-DD hh:mm:ss
  • YYYY-MM-DD hh:mm:ss.sss

When the time, you can set timezone as Z or ±hh:mm.

E.g.:

  • key = 2005-01-13
  • key = 2005-01-13 18:05:00
  • key = 2005-01-13 15:05:00 +03:00
  • key = 2005-01-13 15:00Z
timedelta:

durations:

  • key = 20m — 20 minutes
  • key = 10h2m — 10 hours and 2 minutes
  • key = 1w2s — one week (7 days) and 2 seconds
  • key = 1s20ms — one 2 second and 20 milliseconds
  • key = 1w1d1h1m1s1ms — 694861001 milliseconds
list:

list of values:

key =
    "string value"
    2005-01-13 18:00:05
    13

Examples

$ cat tests/test.ini

# first comment
[first]
boolean = false
integer = 13

[second]
; second comment
boolean = true
string = "some string"

[complex]
list =
    "string"
    "string too"
    "else string"

Simple reading

>>> from zini import Zini
>>> ini = Zini()
>>> result = ini.read('tests/test.ini')
>>> isinstance(result, dict)
True
>>> result['first']['boolean'] is False  # automatic type casting
True
>>> result['first']['integer'] == 13
True
>>> result['second']['string'] == "some string"
True
>>> result['complex']['list'] == ["string", "string too", "else string"]
True

Types and defaults

>>> from zini import Zini
>>> ini = Zini()
>>> ini['first']['integer'] = str  # set type
>>> result = ini.read('tests/test.ini')
zini.ParseError: error in line 3: 'integer = 13'
>>> from zini import Zini
>>> ini = Zini()
>>> ini['second']['boolean'] = "string"  # set type and default value
>>> result = ini.read('tests/test.ini')
zini.ParseError: error in line 7: 'boolean = true'

Lists of values

>>> import zini
>>> ini = zini.Zini()
>>> ini['third']['generic'] = [str]
>>> result = ini.read('tests/test.ini')
ParseError: error in line 20: '    10'
Release History

Release History

1.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
zini-1.1.0-py3-none-any.whl (5.1 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Oct 22, 2016
zini-1.1.0.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source Oct 22, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting