You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-18Lines changed: 22 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -406,50 +406,54 @@ Details:
406
406
1. The names which need to be unzipped while running, splited by "," `without ext`, such as `bottle,aiohttp`, or the complete path like `bin/bottle.py,temp.py`. For `.so/.pyd` files(which can not be loaded by zipimport), or packages with operations of static files.
407
407
1. if unzip is set to "*", then will unzip all files and folders.
408
408
2. if unzip is set to **AUTO**, then will add the `.pyd` and `.so` files automatically.
409
-
2. the `unzip` arg of `zipapps.create_app`
410
-
8.`--unzip-path, -up`
411
-
1. If `unzip` arg is not null, cache files will be unzipped to the given path while running. Defaults to `zipapps_cache`, support some internal variables as runtime args:
409
+
2. Can be overwrite with environment variable `ZIPAPPS_UNZIP`
410
+
3. the `unzip` arg of `zipapps.create_app`
411
+
8.`--unzip-exclude, -ue`
412
+
1. The opposite of `--unzip` / `-u` which will not be unzipped, should be used with `--unzip` / `-u`.
413
+
2. Can be overwrite with environment variable `ZIPAPPS_UNZIP_EXCLUDE`
414
+
9.`--unzip-path, -up`
415
+
3. If `unzip` arg is not null, cache files will be unzipped to the given path while running. Defaults to `zipapps_cache`, support some internal variables as runtime args:
412
416
1.`TEMP/HOME/SELF` as prefix, for example `HOME/zipapps_cache`
413
417
1.`TEMP` means `tempfile.gettempdir()`
414
418
2.`HOME` means `Path.home()`
415
419
3.`SELF` means `.pyz` file path.
416
420
2. And you can also **overwrite** it with environment variables:
417
421
1.`ZIPAPPS_CACHE` or `UNZIP_PATH`
418
-
2. the `unzip_path` arg of `zipapps.create_app`
419
-
9.`-cc, --pyc, --compile, --compiled`
420
-
1. Compile .py to .pyc for fast import, but zipapp does not work unless you unzip it(so NOT very useful).
421
-
2. the `compiled` arg of `zipapps.create_app`
422
-
10.` --cache-path, --source-dir, -cp`
422
+
4. the `unzip_path` arg of `zipapps.create_app`
423
+
10.`-cc, --pyc, --compile, --compiled`
424
+
5. Compile .py to .pyc for fast import, but zipapp does not work unless you unzip it(so NOT very useful).
425
+
6. the `compiled` arg of `zipapps.create_app`
426
+
11.` --cache-path, --source-dir, -cp`
423
427
1. The cache path of zipapps to store site-packages and `includes` files. If not set, will create and clean-up in TEMP dir automately.
424
428
2. the `cache_path` arg of `zipapps.create_app`
425
-
11.`--shell, -s`
429
+
12.`--shell, -s`
426
430
1. Only while `main` is not set, used for shell=True in `subprocess.run`.
427
431
1.*very rarely used*, because extra sub-process is not welcome
428
432
2. the `shell` arg of `zipapps.create_app`
429
-
12.`--main-shell, -ss`
433
+
13.`--main-shell, -ss`
430
434
1. Only for `main` is not null, call `main` with `subprocess.Popen`: `python -c "import a.b;a.b.c()"`. This is used for `psutil` ImportError of DLL load.
431
435
1.*very rarely used* too
432
436
2. the `main_shell` arg of `zipapps.create_app`
433
-
13.`--strict-python-path, -spp`
437
+
14.`--strict-python-path, -spp`
434
438
1.`Boolean` value. Ignore global PYTHONPATH, only use `zipapps_cache` and `app.pyz`.
435
439
2. the `ignore_system_python_path` arg of `zipapps.create_app`
436
-
14.`-b, --build-id`
440
+
15.`-b, --build-id`
437
441
1. The string to skip duplicate builds, it can be the paths of files/folders which splited by ",", then the modify time will be used as build_id. If build_id contains `*`, will use `glob` function to get paths. For example, you can set requirements.txt as your build_id by `python3 -m zipapps -b requirements.txt -r requirements.txt` when you use pyz as venv.
438
442
1.*very rarely used* too too
439
443
2. the `build_id` arg of `zipapps.create_app`
440
-
15.`--zipapps, --env-paths`
444
+
16.`--zipapps, --env-paths`
441
445
1. Default `--zipapps` arg if it is not given while running. Support TEMP/HOME/SELF prefix.
1. Install packages with pip while first running, which means requirements will not be install into pyz file.
444
-
17.`--ensure-pip`
448
+
18.`--ensure-pip`
445
449
1. Add the ensurepip package to your pyz file, works for **embed-python**(windows) or other python versions without `pip` installed but `lazy-install` mode is enabled. [EXPERIMENTAL]
446
-
18.`--layer-mode`
450
+
19.`--layer-mode`
447
451
1. Layer mode for the `serverless` use case, `__main__.py / ensure_zipapps.py / activate_zipapps.py` files will not be set in this mode.
448
452
2.`--layer-mode-prefix`
449
453
1. Only work while `--layer-mode` is set, will move the files in the given prefix folder.
450
-
19.`--clear-zipapps-cache, -czc`
454
+
20.`--clear-zipapps-cache, -czc`
451
455
1. Clear the zipapps cache folder after running, but maybe failed for .pyd/.so files.
452
-
20. all the other (or `unknown`) args will be used by `pip install`
456
+
21. all the other (or `unknown`) args will be used by `pip install`
Copy file name to clipboardExpand all lines: zipapps/__main__.py
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,15 @@ def main():
92
92
'-u',
93
93
default='',
94
94
help='The names which need to be unzipped while running, splited by "," '
95
-
'`without ext`, such as `bottle,aiohttp`, or the complete path like `bin/bottle.py,temp.py`. For `.so/.pyd` files(which can not be loaded by zipimport), or packages with operations of static files. if unzip is set to "*", then will unzip all files and folders. if unzip is set to **AUTO**, then will add the `.pyd` and `.so` files automatically.'
95
+
'`without ext`, such as `bottle,aiohttp`, or the complete path like `bin/bottle.py,temp.py`. For `.so/.pyd` files(which can not be loaded by zipimport), or packages with operations of static files. if unzip is set to "*", then will unzip all files and folders. if unzip is set to **AUTO**, then will add the `.pyd` and `.so` files automatically. Can be overwrite with environment variable `ZIPAPPS_UNZIP`'
96
+
)
97
+
parser.add_argument(
98
+
'--unzip-exclude',
99
+
'-ue',
100
+
default='',
101
+
dest='unzip_exclude',
102
+
help='The opposite of `--unzip` / `-u` which will not be unzipped, '
103
+
'should be used with `--unzip` / `-u`. Can be overwrite with environment variable `ZIPAPPS_UNZIP_EXCLUDE`'
:param shell: whether run python in subprocess, or use runpy if shell is False, defaults to False
70
71
:type shell: bool, optional
71
-
:param unzip: names to be unzip, using `AUTO` is a better choice, defaults to ''
72
+
:param unzip: names to be unzip, using `AUTO` is a better choice, defaults to ''. Can be overwrite with environment variable `ZIPAPPS_UNZIP`
72
73
:type unzip: str, optional
73
74
:param unzip_path: If `unzip` arg is not null, cache files will be unzipped to the given path while running. Defaults to `zipapps_cache`, support some internal variables: `TEMP/HOME/SELF` as internal variables, for example `HOME/zipapps_cache`. `TEMP` means `tempfile.gettempdir()`, `HOME` means `Path.home()`, `SELF` means `.pyz` file path, defaults to ''
74
75
:type unzip_path: str, optional
@@ -98,6 +99,8 @@ def __init__(
98
99
:type includes: str, optional
99
100
:param clear_zipapps_cache: Clear the zipapps cache folder after running, but maybe failed for .pyd/.so files..
100
101
:type includes: bool, optional
102
+
:param unzip_exclude: names not to be unzip, defaults to '', should be used with unzip. Can be overwrite with environment variable `ZIPAPPS_UNZIP_EXCLUDE`
0 commit comments