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

Download files

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

Source Distribution

pydocxrunner-0.0.3.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

pydocxrunner-0.0.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pydocxrunner-0.0.3.tar.gz.

File metadata

  • Download URL: pydocxrunner-0.0.3.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pydocxrunner-0.0.3.tar.gz
Algorithm Hash digest
SHA256 eaab29f62d910b9288765dfc5c7de3cb0817e442b5bdf8b05df38952e34b5a37
MD5 62c126079eeaedf02c81ed99a0ce04f4
BLAKE2b-256 e7968fcdd44c74efa04135ff7cf3ab8856d23bfdf6568bffef525ab469792468

See more details on using hashes here.

File details

Details for the file pydocxrunner-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pydocxrunner-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pydocxrunner-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 729f1b83e850cb6f4efea9482c03acbb8087a857cb2c44b70697fee35e326016
MD5 3d7d0a8b83b8e87012ebfc68a1442f01
BLAKE2b-256 e176a421ae55bdb45da85ff5910f1bb32b4dd71c4376ee5c7271fff09cfa1016

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

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