-
-
Notifications
You must be signed in to change notification settings - Fork 155
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 sub-packages, modules, and imports #45
Comments
One thing I'm noticing: most sub-packages have extensive imports for modules and objects contained within said sub-package's modules and sub-sub-packages. This forces imports of said modules, objects, and sub-sub-packages whenever one attempts to access anything within the original sub-package. It has also allowed indirect references via module objects and imports to grow all throughout the codebase. We can probably clear up a lot of this entanglement by simply removing most imports from the More specifically, any import or reference (e.g. From there, if we have the user-level import requirements/structure figured out, then completing this refactoring should be easy. |
For anyone who might be interested in doing this, I recommend an automated approach using Here's a rough outline of such an automation: Visit each
After gathering these rewrites, all the project's modules could be visited and searched for these package-level imports (i.e. the first element in each rewrite pair) and replaced with their direct imports/references (i.e. the second element in each rewrite pair). |
Here are some interesting hacks that are currently being used to avoid circular dependencies (and that we need to remove): |
Also, I've recently noticed that the config system—operating mostly from the file For instance, the If anything, these module-level dependencies on Furthermore, aren't there well established config-file libraries we can use instead of maintaining our own? |
The current package/module structure leads to numerous circular dependencies and an overall unwieldy import process. We need to refactor the imports and module/subpackage layouts entirely.
For instance, it should be possible to import the core graph types (e.g.
Node
,Apply
,Variable
) without importing anyOp
s,Linkers
, and other compilation-based classes. Furthermore, there's rampant use of module references liketheano.*
to access objects within subpackages. This obfuscates the dependency structure when casually reading source file headers and balloons the cross-dependencies when use oftheano.*
alone perform numerous automatic imports.The text was updated successfully, but these errors were encountered: