[New-bugs-announce] [issue26277] Allow zipapp to target modules

flying sheep report at bugs.python.org
Wed Feb 3 07:25:04 EST 2016

New submission from flying sheep:

currently, zipapp’s notion of __main__.py is very different from the usual.

the root directory of a zipapp is not a module, therefore __init__.py isn’t used and relative imports from __main__.py don’t work.

i propose that the zipapp functionality is amended/changed to

1. allow more than one target directory (bundle multiple modules)
2. allow creation of a __main__.py that contains a runpy-powered module runner

so maybe we could specify the module itself as entry point to get this behavior

zipapp -m my_module dependency.py my_module

should create

├ __main__.py  →  ...runpy.run_module('my_module')
├ dependency.py
└ my_module
  ├ __init__.py
  └ __main__.py  →  from . import ...

or there would be another option to specify it.

components: Extension Modules
messages: 259476
nosy: flying sheep
priority: normal
severity: normal
status: open
title: Allow zipapp to target modules
type: enhancement
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list