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
set_notification
classmethod
A class method that sets the notification service for the config manager.
Parameters:
-
notification(NotificationProtocol) –The notification service to use.
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_app_port
A method that retrieves the host port the project's web server binds to.
In multi-project mode the port is derived from the project name so every project publishes its server on a port of its own. Otherwise it is the default.
Returns:
-
int–The host port for the web server.
Source code in dev_tool/config/manager.py
get_bun_config
A method that retrieves the Bun configuration.
This method gets the Bun 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_current_version
A method that retrieves the current version.
This method returns the current version of the application.
Returns:
-
str–The version string.
get_database_port
A method that retrieves the host port the project's database is published on.
In multi-project mode the port is derived from the project name unless the environment file names one of its own. Otherwise it is the environment file's port, or the default.
Returns:
-
int–The host port for the database.
Source code in dev_tool/config/manager.py
get_dev_tool_config
A method that retrieves the dev_tool configuration.
This method gets the dev_tool configuration section.
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 developer token string, or None if not available.
Source code in dev_tool/config/manager.py
get_django_config
A method that retrieves the Django configuration.
This method gets the Django 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 coverage configuration section.
Returns:
Source code in dev_tool/config/manager.py
get_django_unittest_config
A method that retrieves the Django unit test configuration.
This method gets the Django unit test configuration section.
Returns:
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
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_project_name
A method that retrieves the project name.
This method gets the project name from the pyproject.toml file.
Returns:
-
str–The project name string.
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 coverage configuration section.
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 unittest configuration section.
Returns:
Source code in dev_tool/config/manager.py
get_resource_path
get_sass_config
A method that retrieves the Sass configuration.
This method gets the Sass configuration section.
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_ssh_port
A method that retrieves the host port the project's app container exposes SSH on.
In multi-project mode the port is derived from the project name so every project publishes SSH on a port of its own. Otherwise it is the default.
Returns:
-
int–The host port for SSH.
Source code in dev_tool/config/manager.py
is_multi_project
A method that checks whether this machine runs several projects at once.
Multi-project mode is a per-machine choice recorded by a marker file in the Stratus directory. With it, every project derives ports of its own and other projects' containers are left running. Without it, the defaults apply and starting one project stops the others.
Returns:
-
bool–True if the marker file exists.
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_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_version
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
register_listener
A method that registers a callback for configuration change events.
Parameters:
-
event(ConfigEvent) –The configuration event to listen for.
-
callback(Callable) –The callback function to invoke when the event occurs.
Source code in dev_tool/config/manager.py
reload_all
A method that reloads all configuration files.
This method refreshes both environment and pyproject configurations.
Source code in dev_tool/config/manager.py
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.
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.
unregister_listener
A method that unregisters a callback for configuration change events.
Parameters:
-
event(ConfigEvent) –The configuration event to stop listening for.
-
callback(Callable) –The callback function to remove.
Source code in dev_tool/config/manager.py
validate_configuration
A method that validates that required configuration files exist.
This method emits warnings for any missing configuration files.