subprocess for pyinstaller
pip install pyinstallersubprocess
Based on https://github.com/pyinstaller/pyinstaller/issues/6362#issuecomment-968156787
Read the post before using this module.
Here is the most important part:
"Make all your entry points available as python -m invokable submodules and change all your subprocess.run(["entry_point_foo"]) usages to subprocess.run([sys.executable, "-m", "hello_word.entry_point_foo"]).
Extend those subprocess.run() calls to:
if getattr(sys, 'frozen', False):
subprocess.run([os.path.join(sys._MEIPASS, "entry_point_foo")])
else:
subprocess.run([sys.executable, "-m", "hello_word.entry_point_foo"])
Run PyInstaller on each entry point submodule (e.g. hello_world/hello_world/run_hello_world.py) and make use of Merge() to put them together in one bundle."
import subprocess
from pyinstallersubprocess import (
convert_py_file_to_module,
subprocess_console,
subprocess_console_devnull,
subprocess_console_popen,
subprocess_console_stdout_read,
subprocess_no_console_devnull,
subprocess_no_console_popen,
subprocess_no_console_stdout_read)
# The function convert_py_file_to_module turns the py file into an "python -m invokable submodule"
modulename, entry = convert_py_file_to_module(
modulename="mysubprocess", # choose what anything you want, but make sure that the folder "mysubprocess" doesn't exist in your base folder
pythonfile=r"C:\Users\Gamer\anaconda3\envs\dfdir\pytfi.py",
rename_pyfile=False, # renames r"C:\Users\Gamer\anaconda3\envs\dfdir\pytfi.py" -> r"C:\Users\Gamer\anaconda3\envs\dfdir\pytfi.old"
overwrite_existing=True, # if the folder exists
add_main_entry=True, # if there is no entry, 'if __name__ == "__main__" ... will be added
)
print((modulename, entry))
('mysubprocess', 'pytfi')
# Here are some functions that take care of: "Execute the "extended" subprocess (if getattr(sys, 'frozen', False) ...)"
p = subprocess_console(
module=modulename,
entry=entry,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
)
print(p)
# CompletedProcess(args=['C:\\Users\\Gamer\\anaconda3\\envs\\dfdir\\python.exe', '-m', 'mysubprocess.pytfi'], returncode=0, stdout=b'oioou\r\n', stderr=b'')
# All functions:
subprocess_console(module, entry, *args, **kwargs)
subprocess_console_devnull(module, entry, *args, **kwargs)
subprocess_console_popen(module, entry, *args, **kwargs)
subprocess_console_stdout_read(module, entry, *args, **kwargs)
subprocess_no_console_devnull(module, entry, *args, **kwargs)
subprocess_no_console_popen(module, entry, *args, **kwargs)
subprocess_no_console_stdout_read(module, entry, *args, **kwargs)
# This module:
# https://github.com/hansalemaos/env2installer
# can help you with "Run PyInstaller on each entry point submodule (e.g. hello_world/hello_world/run_hello_world.py)..."
Metadata
Release files for pyinstallersubprocess 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyinstallersubprocess-0.10.tar.gz | 5.3 kB | Without provenance | Details for pyinstallersubprocess-0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyinstallersubprocess-0.10-py3-none-any.whl | Python 3 | none | any | Details for pyinstallersubprocess-0.10-py3-none-any.whl |
Total release size: 12.2 kB
Release files / pyinstallersubprocess-0.10.tar.gz
| Download URL | pyinstallersubprocess-0.10.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a8f9cb3ebbc35e73eb7ad08fde47e386c0b62f174b4c6900ac27461e2c111fe
|
|
BLAKE2b-256 checksum How to use checksums |
08549c812c84176fe156fd2737e44b05ae2f7ff30c560f4f6454f91c105e166c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / pyinstallersubprocess-0.10-py3-none-any.whl
| Download URL | pyinstallersubprocess-0.10-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ed5a8233f5403fb4e26b494adf0ec1f558bef23251c8003e6d002b2d810d0cc
|
|
BLAKE2b-256 checksum How to use checksums |
15b9f12710c5a08233cb968a98babd9d81e0581ff80c7a4d5931d284ee48aacb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for pyinstallersubprocess 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.