Jack Jansen asks:
Is it possible nowadays to have two files with the same name but different paths (i.e. foo/bar.py and foo/spam/bar.py) in the same archive?
Depends on how you do it.
If the user imports foo.spam.bar, an importer will be asked for: foo (return foo.__init__) foo.spam (return foo.bar.__init__) foo.spam.bar (return foo.spam.bar)
But the API allows lots of variations. This is another possible interaction: foo (return None) foo.__init__ (return foo.__init__) foo.spam (return None) foo.bar.__init__ (return foo.bar.__init__) foo.spam.bar (return foo.spam.bar)
Or, by looking at different args to get_code, you could look at the requests as: foo in context of None spam in context of foo bar in context of foo.spam
With another variation where the request for __init__ becomes explicit.
The first way seems the natural way for archives, and makes it easy to keep foo.bar.spam distinct from foo.spam.
That's the one thing that always struck me as very very silly about zipfiles.