Name | scriptmerge JSON |
Version |
3.1.0
JSON |
| download |
home_page | None |
Summary | Convert Python packages into a single script |
upload_time | 2024-12-11 17:50:40 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | Copyright (c) 2012, Michael Williamson All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
compile
oooscript
scriptmerge
stickytape
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# scriptmerge
Convert Python packages into a single script as a standalone `.py` file or a `.pyz` file.
Scriptmerge can be used to convert a Python script and any Python modules
it depends on into a single-file Python script.
If you want output to be a `.py` file can use the `compilepy` command which outputs a `.py` file.
If you want output to be a `.pyz` file can use the `compilepyz` command which outputs a `.pyz` file.
The `.pyz` is a [zipapp](https://docs.python.org/3/library/zipapp.html) `.pyz` file.
It is recommended to use the `.pyz` file as it is a more modern way to distribute Python applications and it is faster to build and to load.
I also recommend checking out [PyInstaller](http://www.pyinstaller.org/).
Since scriptmerge relies on correctly analyzing both your script and any dependent modules,
it may not work correctly in all circumstances.
## Documentation
See the [documentation](https://github.com/Amourspirit/python-scriptmerge/wiki/) for more information.
## Installation
```sh
pip install scriptmerge
```
## Usage
You can tell scriptmerge which directories to search using the `--add-python-path` argument.
For instance:
```sh
scriptmerge compilepy scripts/blah --add-python-path . > /tmp/blah-standalone
```
Or to output directly to a file:
```sh
scriptmerge compilepy scripts/blah --add-python-path . --output-file /tmp/blah-standalone
```
You can also point scriptmerge towards a Python binary that it should use
sys.path from, for instance the Python binary inside a virtualenv:
```sh
scriptmerge compilepyz scripts/blah --python-binary _virtualenv/bin/python --output-file /tmp/blah-standalone
```
Scriptmerge cannot automatically detect dynamic imports,
but you can use `--add-python-module` to explicitly include modules:
```sh
scriptmerge compilepyz scripts/blah --add-python-module blah.util
```
Scriptmerge can exclucde modules from be added to output.
This is useful in special cases where is it known that a module is not required to run the methods being used in the output.
An example might be a script that is being used as a LibreOffice macro.
You can use `--exclude-python-module` to explicitly exclude modules.
`--exclude-python-module` takes one or more regular expressions
In this example module `blah` is excluded entirly.
`blah\.*` matches modules such as `blah.__init__`, `blah.my_sub_module`.
```sh
scriptmerge compilepyz scripts/blah --exclude-python-module blah\.*
```
By default, scriptmerge will ignore the shebang in the script
and use `"#!/usr/bin/env python3"` in the output file.
To copy the shebang from the original script,
use `--copy-shebang`:
```sh
scriptmerge compilepy scripts/blah --copy-shebang --output-file /tmp/blah-standalone
```
Scritpmerge can strip all doc strings and comments from imported modules using the `--clean` option.
```sh
scriptmerge --clean
```
To see all scriptmerge options:
```sh
scriptmerge --help
```
As you might expect with a program that munges source files, there are a
few caveats:
* Due to the way that scriptmerge generates the output file, your script
source file should be encoded using UTF-8. If your script doesn't declare
its encoding in its first two lines, then it will be UTF-8 by default
as of Python 3.
* When using `compilepy` Your script shouldn't have any ``from __future__`` imports.
* Anything that relies on the specific location of files will probably
no longer work. In other words, ``__file__`` probably isn't all that
useful.
* Any files that aren't imported won't be included. Static data that
might be part of your project, such as other text files or images,
won't be included.
# Credits
Scriptmerge is a fork of [stickytape](https://pypi.org/project/stickytape/).
Credit goes to Michael Williamson as the original author.
Raw data
{
"_id": null,
"home_page": null,
"name": "scriptmerge",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "compile, oooscript, scriptmerge, stickytape",
"author": null,
"author_email": "\":Barry-Thomas-Paul: Moss\" <bigbytetech@gmail.com>, Michael Williamson <mike@zwobble.org>",
"download_url": "https://files.pythonhosted.org/packages/1c/c9/59102510ce1a10da6333e7c7bb7feb6e1852b302152712e3609fc476cf1d/scriptmerge-3.1.0.tar.gz",
"platform": null,
"description": "# scriptmerge\n\nConvert Python packages into a single script as a standalone `.py` file or a `.pyz` file.\n\nScriptmerge can be used to convert a Python script and any Python modules\nit depends on into a single-file Python script.\n\nIf you want output to be a `.py` file can use the `compilepy` command which outputs a `.py` file.\nIf you want output to be a `.pyz` file can use the `compilepyz` command which outputs a `.pyz` file.\n\nThe `.pyz` is a [zipapp](https://docs.python.org/3/library/zipapp.html) `.pyz` file.\nIt is recommended to use the `.pyz` file as it is a more modern way to distribute Python applications and it is faster to build and to load.\n\nI also recommend checking out [PyInstaller](http://www.pyinstaller.org/).\n\nSince scriptmerge relies on correctly analyzing both your script and any dependent modules,\nit may not work correctly in all circumstances.\n\n## Documentation\n\nSee the [documentation](https://github.com/Amourspirit/python-scriptmerge/wiki/) for more information.\n\n\n## Installation\n\n```sh\npip install scriptmerge\n```\n\n## Usage\n\nYou can tell scriptmerge which directories to search using the `--add-python-path` argument.\nFor instance:\n\n```sh\nscriptmerge compilepy scripts/blah --add-python-path . > /tmp/blah-standalone\n```\n\nOr to output directly to a file:\n\n```sh\nscriptmerge compilepy scripts/blah --add-python-path . --output-file /tmp/blah-standalone\n```\n\nYou can also point scriptmerge towards a Python binary that it should use\nsys.path from, for instance the Python binary inside a virtualenv:\n\n```sh\nscriptmerge compilepyz scripts/blah --python-binary _virtualenv/bin/python --output-file /tmp/blah-standalone\n```\n\nScriptmerge cannot automatically detect dynamic imports,\nbut you can use `--add-python-module` to explicitly include modules:\n\n```sh\nscriptmerge compilepyz scripts/blah --add-python-module blah.util\n```\n\nScriptmerge can exclucde modules from be added to output.\nThis is useful in special cases where is it known that a module is not required to run the methods being used in the output.\nAn example might be a script that is being used as a LibreOffice macro.\nYou can use `--exclude-python-module` to explicitly exclude modules.\n\n`--exclude-python-module` takes one or more regular expressions\n\nIn this example module `blah` is excluded entirly.\n`blah\\.*` matches modules such as `blah.__init__`, `blah.my_sub_module`.\n\n```sh\nscriptmerge compilepyz scripts/blah --exclude-python-module blah\\.*\n```\n\nBy default, scriptmerge will ignore the shebang in the script\nand use `\"#!/usr/bin/env python3\"` in the output file.\nTo copy the shebang from the original script,\nuse `--copy-shebang`:\n\n```sh\nscriptmerge compilepy scripts/blah --copy-shebang --output-file /tmp/blah-standalone\n```\n\nScritpmerge can strip all doc strings and comments from imported modules using the `--clean` option.\n\n```sh\nscriptmerge --clean\n```\n\nTo see all scriptmerge options:\n\n```sh\nscriptmerge --help\n```\n\nAs you might expect with a program that munges source files, there are a\nfew caveats:\n\n* Due to the way that scriptmerge generates the output file, your script\n source file should be encoded using UTF-8. If your script doesn't declare\n its encoding in its first two lines, then it will be UTF-8 by default\n as of Python 3.\n\n* When using `compilepy` Your script shouldn't have any ``from __future__`` imports.\n\n* Anything that relies on the specific location of files will probably\n no longer work. In other words, ``__file__`` probably isn't all that\n useful.\n\n* Any files that aren't imported won't be included. Static data that\n might be part of your project, such as other text files or images,\n won't be included.\n\n# Credits\n\nScriptmerge is a fork of [stickytape](https://pypi.org/project/stickytape/).\n\nCredit goes to Michael Williamson as the original author.\n",
"bugtrack_url": null,
"license": "Copyright (c) 2012, Michael Williamson All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Convert Python packages into a single script",
"version": "3.1.0",
"project_urls": {
"Documentation": "https://github.com/Amourspirit/python-scriptmerge/wiki",
"Homepage": "https://github.com/Amourspirit/python-scriptmerge/tree/scriptmerge",
"Issues": "https://github.com/Amourspirit/python-scriptmerge/tree/scriptmerge/issues",
"Repository": "https://github.com/Amourspirit/python-scriptmerge/tree/scriptmerge"
},
"split_keywords": [
"compile",
" oooscript",
" scriptmerge",
" stickytape"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d983eeec5b9f45321bc430001ac2c3205a0e533d75e0c2121fe0d4b5908648ec",
"md5": "4e0dc1c6d29e4acaa8f3e5d798d89d15",
"sha256": "e14ee40c76a166aa20c0b811b018d2facecd50c7cc31a542e39b64a6e4615c5c"
},
"downloads": -1,
"filename": "scriptmerge-3.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e0dc1c6d29e4acaa8f3e5d798d89d15",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 20318,
"upload_time": "2024-12-11T17:50:38",
"upload_time_iso_8601": "2024-12-11T17:50:38.124609Z",
"url": "https://files.pythonhosted.org/packages/d9/83/eeec5b9f45321bc430001ac2c3205a0e533d75e0c2121fe0d4b5908648ec/scriptmerge-3.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1cc959102510ce1a10da6333e7c7bb7feb6e1852b302152712e3609fc476cf1d",
"md5": "81ee146b40f9b9d95ea002869cbc548d",
"sha256": "54f0fa8890f530de0205ade49bd76391528970e9092929d4e5453ce7bd111dcd"
},
"downloads": -1,
"filename": "scriptmerge-3.1.0.tar.gz",
"has_sig": false,
"md5_digest": "81ee146b40f9b9d95ea002869cbc548d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 15648,
"upload_time": "2024-12-11T17:50:40",
"upload_time_iso_8601": "2024-12-11T17:50:40.702686Z",
"url": "https://files.pythonhosted.org/packages/1c/c9/59102510ce1a10da6333e7c7bb7feb6e1852b302152712e3609fc476cf1d/scriptmerge-3.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-11 17:50:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Amourspirit",
"github_project": "python-scriptmerge",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "scriptmerge"
}