Skip to main content

Pydocxrunner

PyPI version Build Status GitHub license

Is Word or Libre Office Writer you favorite IDE? Do you recognize docx as a superior file format? And are you tired of the high effort required to execute the code stored in .docxfiles? Then don't worry, pydocxrunneris the tool of your dreams. pydocxrunner provides a simple command to make a .docx file executable like any normal .py file.

Features

  • Make .docxfiles executable via the python command. Once the file is made executable, pydocxrunner is no longer required.
  • The .docx file can then be executed on any device with python installed.
  • What else do you need?

Example

Assuming you have a file called printquad.docx with the following content:

for i in range(10):
    print(i)

Then you can make it executable using pydocxrunner:

$ pydocxrunner printquad.docx

And execute it (on any device having python3 installed):

$ python3 printquad.docx
0
1
4
9
16
25
36
49
64
81

How it works

Unknown to most, .docx files are .zip files with a fancy name. Also unknown to most, python can execute .zip files. pydocxrunner writes a simple __main__.py file as well as python-docx2txt into the .docx file. The __main__.py script will be executed by the python interpreter and read the contents of the .docx file. This content is then passed to an exec() call.

Caveats

  • This is not tested beyond a few simple statements
  • I do not recommend using this tool for production
  • An internet connection is required when running pydocxrunner as python-docx2txt needs to be downloaded. No connection is required to actually execute the .docx file.
  • You still have to use ' and " for strings, „ and “ will not work.

TODO

  • Make this work with other types of documents
  • Make this work with other languages
  • Find a better solution for installing python-docx2txt

Metadata

Release files for pydocxrunner 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydocxrunner 0.0.3
File Size Uploaded Provenance
pydocxrunner-0.0.3.tar.gz 3.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pydocxrunner 0.0.3
File Interpreter ABI Platform
pydocxrunner-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / pydocxrunner-0.0.3.tar.gz

Download URL pydocxrunner-0.0.3.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
eaab29f62d910b9288765dfc5c7de3cb0817e442b5bdf8b05df38952e34b5a37
BLAKE2b-256 checksum
How to use checksums
e7968fcdd44c74efa04135ff7cf3ab8856d23bfdf6568bffef525ab469792468
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

Release files / pydocxrunner-0.0.3-py3-none-any.whl

Download URL pydocxrunner-0.0.3-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
729f1b83e850cb6f4efea9482c03acbb8087a857cb2c44b70697fee35e326016
BLAKE2b-256 checksum
How to use checksums
e176a421ae55bdb45da85ff5910f1bb32b4dd71c4376ee5c7271fff09cfa1016
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

Security for pydocxrunner 0.0.3

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page