Author
JimFulton?
Status
IsProposal?
Problem
ZODB packages are highly interdependent. As things stand now, they might as well be a single package. I don't think this is good. Now that Python has packaging support, I'd like to be able to distribute these in a more fine grained way. In particular:
- It should be possible to use transaction without everything else.
- It should be possible to use ZODB without ZEO,
- It should be possible to use ZODB without any one particular storage.
- It should be possible to use ZODB without BTrees?.
- If anyone ever makes the ifdefs work again, it should be possible to use BTrees? without anything else. It should certainly be possible to use BTrees? without ZODB.
- It should theoretically be possible to use persistent without anything else. This may never be of practical consequence, but I think that the architecture would be cleaner if the dependency wasn't there.
Proposal
I'd like to propose the following dependencies:
- persistent
- "nothing"
- transaction
- zope.event
- BTrees?
- persistent (someday, optionally)
- ZODB
- transaction, persistent
- ZEO
- ZODB, transaction
- storagex
- ZODB
Notes:
- We may have to factor some things out into common dependencies. For example, transaction uses the WeakSet? class defined in ZODB. This class will need to be provided in a separate package. (It could technically move to transaction. Maybe someday, it could move to Python's weakref module.)
- Everything will depend on zope.interface and probably on zope.testing for testing support. The later can be a "test" dependency in setuptools jargon. I expect that zope.deferredimport will become a dependency of many of these packages to avoid circular import problems while allowing names to be made available for convenience at the package level.
- ZConfig? should be an optional dependency of ZODB and ZEO. There should be ZConfig? support included, but it should be possible to use ZODB even if ZConfig? is not installed.
- As with ZConfig?, zdaemon should be an optional dependency of ZEO.
- ThreadedAsync? and ZopeUndo? must go. Nuff said. :)
- Ideally, the storages should become separate packages.
If we agree with this plan, I'd like to start by:
- Not creating new sources of dependencies. One of the most common
ways to create dependencies is by being sloppy in tests. For
example, by using ZODB to test transaction.
I ask that people not write new tests that worsen the dependency situation. Ideally, if you update a test, perhaps you could clean it up.
- I intend to start with transaction. There is some interest in
using transaction outside of ZODB. I think the dependencies are
fairly shallow.
- WeakSet? needs to move. If I'm feeling particularly lazy, I'll just move it to transaction. :)
- The tests need to be cleaned up so that they don't use ZODB.
- The exceptions need to be decoupled. I propose to define TransactionFailedError? (possibly with a shorter name) in transaction. This will not extend POSError?. ZODB.TransactionFailedError? will extend the moved error and POSError?.