-
Notifications
You must be signed in to change notification settings - Fork 219
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
Migrate defaults to a separate file #1356
base: develop
Are you sure you want to change the base?
Migrate defaults to a separate file #1356
Conversation
f4d7131
to
7258373
Compare
7258373
to
57b8fa4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up @ishaileshpant.
Two suggestions:
- It is recommended to keep constants at a module-level.
- Can remove
DEFAULT_
string for all constants. Upper case obviates the need to be explicit.
The only case that it won't address is some constants span across modules and hence i move to global package level else duplication of constants will be there agree on the "default" prefix, in fact we can even name the file as defaults, that would further simplify the names and purpose becomes explicit |
57b8fa4
to
db21d90
Compare
…d aggregator - Rebased 10.Feb.2 Signed-off-by: Shailesh Pant <[email protected]>
db21d90
to
667819b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would suggest renaming it to defaults.py
.
Using defaults.ROUNDS_TO_TRAIN
increases readability compared to constants.ROUNDS_TO_TRAIN
in my opinion.
This PR refactors the aggregator and collaborator modules by replacing hard-coded “magic” numbers and strings with centralized constant definitions. A new file, constants.py, has been introduced in the openfl/component directory to store these default values. This change improves maintainability and consistency across the codebase.
Motivation
Hard-coded values (e.g., 256, "tensor.db", "RESET", etc.) were scattered in the code. Extracting them into a constants file helps prevent errors and makes future updates easier.
Using descriptive constant names (like ROUNDS_TO_TRAIN and CERT_COMMON_NAME) clarifies the purpose of each value and allows for a single point of modification if defaults need to change.