Skip to main content

Simple use ini files

Project description

This is the simplest way to interact with a single ini file to store settings.

Attention! It is delivered together with logging to a file. You need to try to understand.

Use:

	from simpleini import SETTINGS, logging

	parsed_data = SETTINGS(<names_settings>, <required_settings>)

	# names_settings - A string with the names of the settings stored in the file. If there is no file, it will be created and the program will be completed.
	# required_settings - comma-separated list of required variables. 'all' - to check all variables
```python


#### Example ini reader (simple mode):
```python
# Read from [DEFAULT] section
	parsed_data = SETTINGS('settings1, settings2, settings3', 'all')

	settings1 = parsed_data.settings1
	settings2 = parsed_data.settings2
	settings3 = parsed_data.settings3
```python

#### Examle ini readred
```python
parsed_data = SETTINGS()
settings1 = parsed_data.section_name.settings1
settings2 = parsed_data.section_name.settings2
settings3 = parsed_data.section_name_2.settings1
```python

#### Example with required fields
```python
settings = SETTINGS(required_fields='NEW_DEFAULT.path_default')
```python

#### Example set
```python
settings.set('test.one', 123)
```python

#### Example remove section
```python
settings.remove('section_name')
```python

#### Example remove option
```python
settings.remove('section_name.option_name')
```python

#### Example logging:
```python
	logging('message for log') # it will write a file to the project folder log.txt and it will add incoming information to it
```python

Project details


Download files

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

Source Distribution

simpleini-0.1.9.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

simpleini-0.1.9-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file simpleini-0.1.9.tar.gz.

File metadata

  • Download URL: simpleini-0.1.9.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.1 Windows/10

File hashes

Hashes for simpleini-0.1.9.tar.gz
Algorithm Hash digest
SHA256 97ba5c7aedabd592ee9cc3481dc1b8a674246682c1e273b9cd6892d15212d757
MD5 61b57a2472f68a76128ca79cb5c06d01
BLAKE2b-256 ca4d52d2b96dad1c6ad60da8b42b571d793a5fc314c955cb5e829829e7a0ae80

See more details on using hashes here.

File details

Details for the file simpleini-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: simpleini-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.1 Windows/10

File hashes

Hashes for simpleini-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e410ead15d3234f48a588453253e91e24ccda41707abd8d1a4e5cb2853255dc7
MD5 b1e44831b4dfdf5615142bfc4dd4caf8
BLAKE2b-256 967bf33375fef5af3af727f358c94daa11c24b0ea52998f22825f71f42a99e30

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