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

Refactor Suggestion for Improved Configuration Handling in ailab-db #59

Open
5 tasks
k-allagbe opened this issue Nov 26, 2023 · 2 comments
Open
5 tasks

Comments

@k-allagbe
Copy link
Member

The current implementation of packages involves direct retrieval of configuration variables using os.environ.get. This approach, while functional, limits the flexibility and testability of the packages. The proposal is to refactor these packages so that functions requiring configuration data receive them as parameters, instead of directly accessing environment variables.

Objectives:

  1. Enhanced Flexibility: By passing configuration variables as parameters, we allow users to provide these values in ways that best suit their environment and use case, be it through environment variables, configuration files, or other means.

  2. Improved Testability: Functions that explicitly accept configuration parameters are easier to test, as they do not rely on the external environment's state. This makes writing unit tests more straightforward and reliable.

  3. Clear Dependencies: Having functions request necessary configuration as parameters makes the code more self-explanatory and clear about its dependencies.

Proposed Changes:

  • Refactor functions to accept configuration variables as parameters.
  • Update documentation to reflect these changes and guide users on how to pass these parameters.
  • Implement default values or error handling for cases where critical configuration data is not provided.
  • Write unit tests to cover different scenarios, including those with varying configuration inputs.

Action Items:

  • Identify all instances where os.environ.get is used for configuration in the packages.
  • Redesign these functions to accept configuration data as parameters.
  • Update and test each function to ensure it operates correctly with the new parameter-based configuration.
  • Revise the package documentation to clearly explain the new method of passing configuration data.
  • Create and run unit tests to validate functionality and handle edge cases.
@rngadam
Copy link
Contributor

rngadam commented Nov 27, 2023

isn't this what obol is supposed to achieve?

https://github.com/ai-cfia/obol

@k-allagbe
Copy link
Member Author

isn't this what obol is supposed to achieve?

https://github.com/ai-cfia/obol

Could be, yes. This is just to add the config vars as arguments to the functions. The user of these packages could then use Obol for his needs in his project.

@Francois-Werbrouck Francois-Werbrouck moved this to Todo in Database Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants