Resource initialization
One of the points to take a look is to avoid creating heavy and synchronization objects on import.
For example, inside datalibrary.downloader a multiprocessing.Lock is created on import, and inside datalibrary.s3Client a MinioClient is created with a special case in the init method to provide test configuration.
At the same time, in pytdml.io.S3_reader, we import boto3 inside the init method of S3Client and wrap the import in a try block, when boto3 is a dependency of the project, and it doesn't seem to be a reason not to make the import in the top level of the file.
Other similar cases could be investigated during the code sprint.
We do have a lot of work to do regarding potential performance waste and maintenance issues.
- Global Code Review: Check all modules for side-effect code (e.g., functions executed on import), hidden dependencies, or unnecessary environment-specific branches.
- Tool-Driven Standards: Integrate flake8 or pylint rules to detect non-compliant imports and unused dependencies. By lazy initializing resources, explicitly managing dependencies, and decoupling configuration logic, we can resolve potential performance waste and maintenance issues, improving code maintainability and stability.