Skip to main content

A small tool to bundle a python file and all its imports into a single file.

Project description

compyner

ComPYner is a small tool to bundle a python file and all its imports into a single file. This was created due to the limitations of the micropython implementation on the spike prime, where there is no filesystem to store multiple files. We are aware that there are better ways to implement what we have done, but this is the least ugly code that will run on spike primes micropython.

Installation

Install compyner with pip, or another tool using PyPI:

pip install compyner

Usage

[!WARNING] This tool is not extensively tested and may not work as expected. Use at your own risk. Feel free to open an issue if you encounter any problems.

compyner <input> -o <output>

This command will read the file at <input>, "compyne" it and writes the result to <output>

If the -o/--output argument is not used, the result will be saved with the same name as the input file but with the suffix .cpyd.py.

Excluding modules

If any modules are imported that are in the standard library, these need to be excluded. Normally, the script detects these imports and excludes them automatically, but this does not work for some, like the collections module. Modules that are only availible in the standard library of the target environment should be excluded as well.

Modules that should be excluded should be passed as a space-seperated list to the --exclude argument.

Example

compyner main.py --exclude math -o output.py

This will combine the file main.py with all the files it imports, except for math, and output the result to output.py.

Known issues

None at the moment.

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

compyner-0.3.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

compyner-0.3.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file compyner-0.3.1.tar.gz.

File metadata

  • Download URL: compyner-0.3.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Windows/10

File hashes

Hashes for compyner-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ac992122d07c65eaf8432ea31ec1556198d1957ba654bb8465751507c6fe38c8
MD5 464c2db5a7ccde06dc7af937938cf2ac
BLAKE2b-256 f3f6f3de9fc2a2a6af2111b6a6546b48fa2bdaea784ee7469bcc9eaf4cd2b263

See more details on using hashes here.

File details

Details for the file compyner-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: compyner-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.13.3 Windows/10

File hashes

Hashes for compyner-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00787cbbdc4d476076ce41552cbccf3c6796fcc1fbf326b586fe5cb4f940b033
MD5 ca1c1e6fe688d52922c339bd4f77859b
BLAKE2b-256 2b99115be72b07b5d9651d8d64ae2f2104e41a97ca8c8c9f1eb46c1586ade038

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page