Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global configuration setup #38

Merged
merged 11 commits into from
Feb 13, 2025
Merged

Global configuration setup #38

merged 11 commits into from
Feb 13, 2025

Conversation

stelladk
Copy link
Collaborator

@stelladk stelladk commented Dec 19, 2024

More tests will be needed!

Inspiration from codecarbon and black configuration setups.

@stelladk stelladk added enhancement New feature or request code-breaking labels Dec 19, 2024
@stelladk stelladk self-assigned this Dec 19, 2024
Copy link

codecov bot commented Dec 19, 2024

Codecov Report

Attention: Patch coverage is 83.05085% with 10 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/gromo/config/loader.py 83.72% 4 Missing and 3 partials ⚠️
src/gromo/graph_network/dag_growing_network.py 71.42% 1 Missing and 1 partial ⚠️
src/gromo/utils/logger.py 0.00% 1 Missing ⚠️
Flag Coverage Δ
unittests 68.54% <83.05%> (+0.37%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/gromo/utils/utils.py 63.38% <100.00%> (+1.45%) ⬆️
src/gromo/utils/logger.py 42.47% <0.00%> (ø)
src/gromo/graph_network/dag_growing_network.py 54.23% <71.42%> (-0.06%) ⬇️
src/gromo/config/loader.py 83.72% <83.72%> (ø)

@stelladk
Copy link
Collaborator Author

This is the proposed way to use the configuration file:

from gromo.config.loader import load_config
from gromo.utils.utils import set_from_conf

self._config_data, _ = load_config()
if `local_variable` is None:
    `local_variable` = set_from_conf(self, "variable_name_in_config", default_value, setter=False)

The local variable should have a default value of None in the class, the default value can only be precised in the set_from_conf function. If you want the functionality of self.variable_name_in_config = value do setter=True

@stelladk stelladk marked this pull request as ready for review February 10, 2025 13:20
@stelladk stelladk requested a review from sylvchev February 10, 2025 13:20
Copy link
Collaborator

@sylvchev sylvchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @stelladk !

@stelladk stelladk merged commit 2b5c2f0 into growingnet:main Feb 13, 2025
6 checks passed
@stelladk stelladk deleted the config branch February 13, 2025 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-breaking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants