Don't use code in __init__.py

Registered by Chris Dent

Nova makes a habit of putting code in the __init__.py files in directories in the nova hierarchy. This means that any import within a subtree that has such an __init__.py in its parents will automatically import that code, even if it doesn't need it. In a collection of code that is as broad and deep as the nova code while also being utilized by multiple different processes, this can mean that processes can import code they will never need.

In a situation where there's only one process, this is no big deal, but in a situation where there are many different processes (nova-compute, nova-conductor, nova-scheduler, nova-api, placement-api) this can make some of those processes larger than they need to be (a concern in a container-oriented world) and potentially harder to debug if unexpected imports are impacting behavior.

It would be better to move code out of __init__.py (where possible) and use explicit imports from named modules. This blueprint provides a place to anchor work in that direction.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Chris Dent
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.