manager
dev_tool.config.manager
log = logging.getLogger(__name__)
module-attribute
ConfigEvent
Bases: Enum
An enumeration of configuration change event types.
This enum defines the types of configuration events that can trigger callbacks.
ENV = auto()
class-attribute
instance-attribute
PYPROJECT = auto()
class-attribute
instance-attribute
ConfigManager
A singleton class for managing configuration across the application.
This class handles loading, reloading, and providing access to various configuration settings from different sources.
A constructor for the ConfigManager class.
This method initializes all configuration components and sets up file watching if a watcher is provided.
Parameters:
-
watcher(FileWatcherService | None, default:None) –An optional file watcher service for monitoring config changes.
Source code in dev_tool/config/manager.py
docker = DockerConfig()
instance-attribute
env = EnvConfig()
instance-attribute
fs = FilesystemConfig()
instance-attribute
pyproject = PyprojectConfig()
instance-attribute
__new__
The method that implements the singleton pattern.
This method ensures only one instance of ConfigManager exists.
Returns:
-
Self–The singleton ConfigManager instance.
Source code in dev_tool/config/manager.py
initialize_watcher
A method that initializes the file watcher.
This method sets up file watching for configuration files with the specified polling interval.
Parameters:
-
interval(float, default:1.0) –The polling interval in seconds.
Source code in dev_tool/config/manager.py
start_watching
A method that starts the file watcher.
This method begins monitoring configuration files for changes.
Source code in dev_tool/config/manager.py
stop_watching
A method that stops the file watcher.
This method ends monitoring of configuration files.
reload_all
A method that reloads all configuration files.
This method refreshes both environment and pyproject configurations.
reload_env
A method that reloads environment variables.
This method refreshes environment variables from the .env file.
reload_pyproject
A method that reloads the pyproject.toml configuration.
This method refreshes configuration from the pyproject.toml file.
create_default_development_env
A method that creates a default development.env file.
This method creates the development environment file from a template.
Source code in dev_tool/config/manager.py
create_default_pyproject
A method that creates a default pyproject.toml file.
This method creates the pyproject.toml file from a template.
Source code in dev_tool/config/manager.py
get_resource_path
get_project_name
A method that retrieves the project name.
This method gets the project name from the pyproject.toml configuration.
Returns:
-
str–The project name as a string.
Source code in dev_tool/config/manager.py
get_current_version
A method that retrieves the current version.
This method returns the current version of the application.
Returns:
-
str–The version string.
get_project_config
A method that retrieves a project configuration section.
This method gets a specific section from the project configuration.
Parameters:
-
key(str) –The section key to retrieve.
Returns:
Source code in dev_tool/config/manager.py
get_tool_config
A method that retrieves a tool configuration section.
This method gets a specific section from the tool configuration.
Parameters:
-
key(str) –The section key to retrieve.
Returns:
Source code in dev_tool/config/manager.py
get_dev_tool_config
A method that retrieves the dev_tool configuration.
This method gets the entire dev_tool configuration section.
Returns:
Source code in dev_tool/config/manager.py
get_coverage_config
A method that retrieves the coverage configuration.
This method gets the coverage configuration section.
Returns:
Source code in dev_tool/config/manager.py
get_django_coverage_config
A method that retrieves the Django coverage configuration.
This method gets the Django-specific coverage configuration merged with the base.
Returns:
Source code in dev_tool/config/manager.py
get_python_coverage_config
A method that retrieves the Python coverage configuration.
This method gets the Python-specific coverage configuration merged with the base.
Returns:
Source code in dev_tool/config/manager.py
get_dev_tool_port
A method that retrieves the dev_tool port setting.
This method gets the port number configured for the dev_tool.
Returns:
-
str | None–The port string, or None if not configured.
Source code in dev_tool/config/manager.py
get_developer_token
A method that retrieves the developer token.
This method gets the developer token from the token file.
Returns:
-
str | None–The token string, or None if not available.
Source code in dev_tool/config/manager.py
get_docker_authorization
A method that retrieves Docker authorization credentials.
This method gets the username and password for Docker from environment variables.
Returns:
Source code in dev_tool/config/manager.py
get_docker_config
A method that retrieves the Docker configuration.
This method gets the Docker configuration section.
Returns:
Source code in dev_tool/config/manager.py
create_default_docker_config
A method that creates a default Docker configuration.
This method generates a complete Docker configuration using the project name and user-provided Docker configuration.
Returns:
Source code in dev_tool/config/manager.py
get_scripting_config
A method that retrieves the scripting configuration.
This method gets the scripting configuration section.
Returns:
Source code in dev_tool/config/manager.py
get_unittest_config
A method that retrieves the unittest configuration.
This method gets the unittest configuration section.
Returns:
Source code in dev_tool/config/manager.py
get_django_unittest_config
A method that retrieves the Django unittest configuration.
This method gets the Django-specific unittest configuration merged with the base.
Returns:
Source code in dev_tool/config/manager.py
get_python_unittest_config
A method that retrieves the Python unittest configuration.
This method gets the Python-specific unittest configuration merged with the base.
Returns: