pyinstallersubprocess


Namepyinstallersubprocess JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/pyinstallersubprocess
Summarysubprocess for pyinstaller
upload_time2023-03-12 13:41:08
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords subprocess pyinstaller
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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:



```python

"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."

```



```python

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)..."





```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/pyinstallersubprocess",
    "name": "pyinstallersubprocess",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "subprocess,pyinstaller",
    "author": "Johannes Fischer",
    "author_email": "<aulasparticularesdealemaosp@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/08/54/9c812c84176fe156fd2737e44b05ae2f7ff30c560f4f6454f91c105e166c/pyinstallersubprocess-0.10.tar.gz",
    "platform": null,
    "description": "\n# subprocess for pyinstaller \n\n\n\n## pip install pyinstallersubprocess\n\n\n\n### Based on https://github.com/pyinstaller/pyinstaller/issues/6362#issuecomment-968156787\n\n\n\nRead the post before using this module.\n\n\n\nHere is the most important part:\n\n\n\n```python\n\n\"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\"]).\n\nExtend those subprocess.run() calls to:\n\nif getattr(sys, 'frozen', False):\n\n    subprocess.run([os.path.join(sys._MEIPASS, \"entry_point_foo\")])\n\nelse:\n\n    subprocess.run([sys.executable, \"-m\", \"hello_word.entry_point_foo\"])\n\nRun 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.\"\n\n```\n\n\n\n```python\n\nimport subprocess\n\nfrom pyinstallersubprocess import (\n\nconvert_py_file_to_module,\n\nsubprocess_console,\n\nsubprocess_console_devnull,\n\nsubprocess_console_popen,\n\nsubprocess_console_stdout_read,\n\nsubprocess_no_console_devnull,\n\nsubprocess_no_console_popen,\n\nsubprocess_no_console_stdout_read)\n\n\n\n\n\n# The function convert_py_file_to_module turns the py file into an \"python -m invokable submodule\"\n\n\n\nmodulename, entry = convert_py_file_to_module(\n\n    modulename=\"mysubprocess\", # choose what anything you want, but make sure that the folder \"mysubprocess\" doesn't exist in your base folder\n\n    pythonfile=r\"C:\\Users\\Gamer\\anaconda3\\envs\\dfdir\\pytfi.py\", \n\n    rename_pyfile=False, # renames r\"C:\\Users\\Gamer\\anaconda3\\envs\\dfdir\\pytfi.py\" -> r\"C:\\Users\\Gamer\\anaconda3\\envs\\dfdir\\pytfi.old\"\n\n    overwrite_existing=True, # if the folder exists \n\n    add_main_entry=True, # if there is no entry, 'if __name__ == \"__main__\" ... will be added \n\n)\n\n\n\nprint((modulename, entry))\n\n('mysubprocess', 'pytfi')\n\n\n\n# Here are some functions that take care of: \"Execute the \"extended\" subprocess (if getattr(sys, 'frozen', False) ...)\"\n\np = subprocess_console(\n\n    module=modulename,\n\n    entry=entry,\n\n    stdout=subprocess.PIPE,\n\n    stderr=subprocess.PIPE,\n\n    stdin=subprocess.PIPE,\n\n)\n\n\n\nprint(p)\n\n# CompletedProcess(args=['C:\\\\Users\\\\Gamer\\\\anaconda3\\\\envs\\\\dfdir\\\\python.exe', '-m', 'mysubprocess.pytfi'], returncode=0, stdout=b'oioou\\r\\n', stderr=b'')\n\n\n\n\n\n# All functions:\n\n\n\nsubprocess_console(module, entry, *args, **kwargs)\n\nsubprocess_console_devnull(module, entry, *args, **kwargs)\n\nsubprocess_console_popen(module, entry, *args, **kwargs)\n\nsubprocess_console_stdout_read(module, entry, *args, **kwargs)\n\nsubprocess_no_console_devnull(module, entry, *args, **kwargs)\n\nsubprocess_no_console_popen(module, entry, *args, **kwargs)\n\nsubprocess_no_console_stdout_read(module, entry, *args, **kwargs)\n\n\n\n# This module:\n\n# https://github.com/hansalemaos/env2installer\n\n# can help you with \"Run PyInstaller on each entry point submodule (e.g. hello_world/hello_world/run_hello_world.py)...\"\n\n\n\n\n\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "subprocess for pyinstaller",
    "version": "0.10",
    "split_keywords": [
        "subprocess",
        "pyinstaller"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15b9f12710c5a08233cb968a98babd9d81e0581ff80c7a4d5931d284ee48aacb",
                "md5": "23c3406a438eeb79e6efb72dd4f6d11c",
                "sha256": "5ed5a8233f5403fb4e26b494adf0ec1f558bef23251c8003e6d002b2d810d0cc"
            },
            "downloads": -1,
            "filename": "pyinstallersubprocess-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "23c3406a438eeb79e6efb72dd4f6d11c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6921,
            "upload_time": "2023-03-12T13:41:07",
            "upload_time_iso_8601": "2023-03-12T13:41:07.125201Z",
            "url": "https://files.pythonhosted.org/packages/15/b9/f12710c5a08233cb968a98babd9d81e0581ff80c7a4d5931d284ee48aacb/pyinstallersubprocess-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "08549c812c84176fe156fd2737e44b05ae2f7ff30c560f4f6454f91c105e166c",
                "md5": "fc080eb60abac7f98d6f40c368d2dbd7",
                "sha256": "4a8f9cb3ebbc35e73eb7ad08fde47e386c0b62f174b4c6900ac27461e2c111fe"
            },
            "downloads": -1,
            "filename": "pyinstallersubprocess-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "fc080eb60abac7f98d6f40c368d2dbd7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5259,
            "upload_time": "2023-03-12T13:41:08",
            "upload_time_iso_8601": "2023-03-12T13:41:08.830924Z",
            "url": "https://files.pythonhosted.org/packages/08/54/9c812c84176fe156fd2737e44b05ae2f7ff30c560f4f6454f91c105e166c/pyinstallersubprocess-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-12 13:41:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "pyinstallersubprocess",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pyinstallersubprocess"
}
        
Elapsed time: 0.23613s