Fast ConfigParser
Python (Cython) based implementation of ConfigParser based on POSIX and stdlib functions. Wrapped via Cython, uses POSIX stat and libc stdio functions for read file.
Support converting values in formats:
StrType - force convert to string all values (defaults too).
IntType - convert values to integer (include suffixes ‘K’, ‘M’ and ‘G’ multiples of 1000).
BytesSizeType - convert values to integer size of bytes (include suffixes ‘K’, ‘M’ and ‘G’ multiples of 1024).
BoolType - convert ‘False’, ‘false’, ‘True’ and ‘true’ to valid Python bool type.
IntSecondsType - convert time to seconds. Uses ‘pytimeparse’ python package.
TimedeltaType - convert time to timdelta/relativedelta(if installed). Uses ‘pytimeparse’ python package.
ListType - convert separated by symbol (default is comma) string to list of values.
JsonType - convert json value to python value.
Usage
Install package in your environment:
pip install configparserc
Example code for parse ini-config:
import os
from configparserc import config, tools
class MainSection(config.AppendSection):
"""
Simple section where:
* some_int_key has int value;
* some_bool_key has int value;
* some_list_key has semicolon separated list value;
* some_other_key has int value in bytes.
and all values appends or override defaults.
"""
type_some_int_key = config.IntType()
type_some_bool_key = config.BoolType()
type_some_list_key = config.ListType(separator=';')
type_some_other_key = config.ListType(separator=';')
config = config.ConfigParserC(
# Override section class for section `main`
section_overload={'main': MainSection},
# Set deafults for all sections.
section_defaults={
'main': {
'some_int_key': "123",
'some_bool_key': "false",
'some_list_key': "a;c;d"
}
},
# Allow to use values from environment
# via "{ENVIRONMENT_VAR}" values.
format_kwargs=os.environ.copy()
)
config.parse_files(['/path/to/ini/config', '/other/path/to/ini/config'])
config.parse_text('''
[main]
# Support comments
; in different ini formats.
int_key = 1234
''')
config_as_dict = config.all()
License
The ConfigParserC Project (https://gitlab.com/onegreyonewhite/configparserc) Copyright (C) 2019-2023 Sergey Klyuykov
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Release files for configparserc 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| configparserc-3.0.2.tar.gz | 13.2 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| configparserc-3.0.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 | Details |
| configparserc-3.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 | Details |
| configparserc-3.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | CPython 3.11 | Linux glibc 2.17+ x86-64, Linux glibc 2.5+ x86-64 | Details |
| configparserc-3.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.5+ x86-64, Linux glibc 2.17+ x86-64 | Details |
Total release size: 1.3 MB
Release files / configparserc-3.0.2.tar.gz
| Download URL | configparserc-3.0.2.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a92513a76d03b364bb9969df7c9411bac844c2477b859e42f6608b0f456d1f4c
|
|
BLAKE2b-256 checksum How to use checksums |
781460d0a1bc758a5e51c4b5c78e929c81756ed0847f03fa0aee8b0e58105b42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / configparserc-3.0.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | configparserc-3.0.2-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 342.7 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
529310a2f5268f2093cda5ee0ba02743d06060fa2f2f5ac8d93d01f3a55f068a
|
|
BLAKE2b-256 checksum How to use checksums |
ecd922209e1d09b34acfe6cdff7c9c4a2692cc245c4a14a706b802e323f12bae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / configparserc-3.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | configparserc-3.0.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 344.7 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
ddac7ea5a98cc0c79166eb66d04cd2c80b732d4fe31ce57d8dd9a65a0b7a0783
|
|
BLAKE2b-256 checksum How to use checksums |
63deb4ef2b34175e9e78c6af0ef5d3a6ebb61bb6ff2bca7117a6dddb5befdf0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / configparserc-3.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | configparserc-3.0.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 323.8 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
8d1610b600c6eacffac8c5ad8832f4d7de05a878f4fa9405d3f4f151ee6bbb20
|
|
BLAKE2b-256 checksum How to use checksums |
a27010021ccb9682a71799908668a682d98fdfdd7ad823059b32281e57008cc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / configparserc-3.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | configparserc-3.0.2-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 314.0 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
9dd48056ca77434ec82fd0a91d7dbda21164663bebbc9de87145cda3afd3ee58
|
|
BLAKE2b-256 checksum How to use checksums |
e654a7e4fc17f95864c99e3877f4ecb6321c7825642b7be239ef73529b6a9e62
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|