Registry / serialization / setoptconf-tmp

setoptconf-tmp

JSON →
library0.3.1pypypi✓ verified 84d ago

Setoptconf-tmp is a temporary fork of the `setoptconf` library, designed to retrieve program settings from various sources like the command line, environment variables, INI files, JSON files, YAML files, and Python objects/modules. This fork was created to resolve compatibility issues with `setuptools >= 58` that affected the original `setoptconf` library, particularly for tools like `prospector`. The library is explicitly stated as a temporary solution, not actively maintained, and is expected to be purged once `prospector` updates or the original `setoptconf` is fixed. The current version is 0.3.1, last released in September 2021.

pip install setoptconf-tmp
INSTALL
IMPORT
SIG · SETOPTCONF-TMP
S
setoptconf-tmp
serializationpythonv0.3.1
Install
1.5s avg
Import
27ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.028s · 18MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.5s · import 0.027s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ConfigurationManager
from setoptconf import ConfigurationManager
StringSetting
from setoptconf import StringSetting
IntegerSetting
from setoptconf import IntegerSetting
BooleanSetting
from setoptconf import BooleanSetting
CommandLineSource
from setoptconf import CommandLineSource
EnvironmentVariableSource
from setoptconf import EnvironmentVariableSource
ConfigFileSource
from setoptconf import ConfigFileSource

This quickstart demonstrates how to define settings and retrieve them from multiple sources. It prioritizes command line arguments, then environment variables (prefixed with `MYPROGRAM_`), and finally INI configuration files. It also shows how to define different setting types and provide defaults or mark them as required.

import setoptconf as soc import os # Simulate environment variables os.environ['MYPROGRAM_API_KEY'] = os.environ.get('MYPROGRAM_API_KEY', 'default_api_key_from_env') os.environ['MYPROGRAM_DEBUG'] = os.environ.get('MYPROGRAM_DEBUG', 'True') # Create a dummy config file for demonstration with open('.myprogramrc', 'w') as f: f.write('[myprogram]\n') f.write('setting_from_file = 123\n') manager = soc.ConfigurationManager('myprogram') manager.add(soc.StringSetting('api_key', default='no_key_found')) manager.add(soc.IntegerSetting('setting_from_file', required=False)) manager.add(soc.BooleanSetting('debug', default=False)) manager.add(soc.StringSetting('app_name', default='MyApp')) # The order of sources implies priority (later sources override earlier ones) config = manager.retrieve( soc.CommandLineSource, # Pulls from command line (e.g., --api-key <value>) soc.EnvironmentVariableSource, # Pulls from environment variables prefixed with MYPROGRAM_ soc.ConfigFileSource(('.myprogramrc', '/etc/myprogram.conf')) # Pulls from INI files ) print(f"API Key: {config.api_key}") print(f"Setting from file: {config.setting_from_file}") print(f"Debug mode: {config.debug}") print(f"App Name: {config.app_name}") # Clean up dummy config file os.remove('.myprogramrc')
Debug
Known issues
breakingThis library is a temporary, unmaintained fork. It was created solely to address a specific compatibility issue with `setuptools >= 58` affecting the original `setoptconf` for `prospector` builds. Users should be aware that it will not receive updates, may contain unpatched vulnerabilities, and is explicitly stated to be purged once its original purpose is fulfilled.
fix
Avoid using this library for new projects. For existing projects, migrate to the official `setoptconf` once its `setuptools` compatibility is resolved, or switch to a different, actively maintained configuration library.
affects: All versions
gotchaThe primary `setoptconf` library, which this package forks, historically had issues with `setuptools >= 58`. While `setoptconf-tmp` was created to mitigate this for specific build environments, it highlights a potential underlying fragility or dependency on older Python ecosystem components in the original project design.
fix
If migrating from original `setoptconf`, verify its compatibility with your current `setuptools` version. This `setoptconf-tmp` version is not a long-term solution for that underlying issue.
affects: Versions 0.1.0-0.3.1 (original setoptconf)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'setoptconf_tmp'
The `setoptconf-tmp` package has not been installed in the current Python environment.
fix
Run `pip install setoptconf-tmp` to install the package.
SyntaxError: invalid or unexpected token (for `import setoptconf-tmp`)
Python module names cannot contain hyphens. The package name `setoptconf-tmp` maps to the module name `setoptconf_tmp` for importing.
fix
Use an underscore instead of a hyphen in the import statement: `import setoptconf_tmp` or `from setoptconf_tmp import Config`.
AttributeError: module 'setoptconf_tmp' has no attribute 'config'
The user is attempting to access a non-existent attribute, likely due to a capitalization error. The main configuration class is typically `Config` (with an uppercase 'C'), not `config` (lowercase).
fix
Instantiate the `Config` class correctly: `from setoptconf_tmp import Config; config = Config()` or `config = setoptconf_tmp.Config()`.
ERROR: No matching distribution found for setoptconf-tmp
The `setoptconf-tmp` package might not be available for your specific Python version or platform, or the PyPI index is unreachable. Given its age (last updated 2021) and temporary nature, it may lack compatibility with newer Python versions.
fix
Verify your Python version's compatibility (e.g., Python 3.6-3.9 were common around 2021). Consider if this temporary fork is still necessary, or if the original `setoptconf` or the tool it was meant to fix (`prospector`) has updated to resolve the underlying issue.
Upgrade
Version history
0.3.1latest on PyPI · released Sep 8, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
setoptconf-tmp — pip install setoptconf-tmp · libregistry