-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Create config subpackage #376
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
Create config subpackage #376
Conversation
…package by adding a config/__init__.py file. This will make it easier to continue refactoring the config system later
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.
LGTM, nice cleanup.
The doctest fails seem weird to me, locally all tests pass for this branch.
|
Ok I think I know what's wrong with the tests. This PR moves the file @naveen521kk can we make sure this doesn't happen with poetry? The |
Yes, I had included everything in manim folder inside package. |
Context
This PR belongs to the ongoing refactor of the config system (#337).
Main change
The main goal here is to encapsulate everything having to do with setting up the config in a new folder
config/. Before, setting up the config and parsing the .cfg files was strewn about in many files. Now... it is still fairly disordered and in many files, but at least they live in the same directory. The next PR in this series will start merging those files, now within the safety of the new subpackage.Yes, there are 30 files touched by this PR but most of them are one-line modifications of import statements. The actual PR is like two files and a bunch of renamed/moved files.
The motivation
The main benefit of this change is that after the config is set up, no other part of the codebase needs to care about how it is being setup. Accordingly, many imports of the form
from ..config import camera_configor similar have been changed tofrom .. import camera_config. The former says "go to the config module and get me the configuration of the camera", and it required of the developer that they know all of the internals of how the config system is set up. For example, if the configuration system changed (say iscamera_configwas defined in some other module), all of those imports had to change. The new versionfrom .. import camera_configsays "go to the top level package and get me the configuration of the camera". Even if the configuration system changes internally, as long as the config subpackage exportscamera_configto the top-level package, this import will continue to work always.Additionally, the
logger.pymodule is also now part of theconfig/folder, as it deals with parsing .cfg files and needs to export a variable that all other modules need as soon as possible (thelogger).List of changes
*from the config subpackage.config/which is made into a subpackage by adding the fileconfig/__init__.py. Remember, a subpackage is nothing more than a collection of modules and theconfig/__init__.pyfile just determines what is exported into the top level package. The new subpackage contains all of the modules and resources related to setting up the config system.Future work
Encapsulating everything inside a subpackage will make it super easy in the future to keep refactoring the config system with minimal modification of the rest of the codebase. See #337 for future plans on refactoring the config system.
EDIT: sorry for the messy commit history. I'm... trying something.