Skip to main content

Execute Python scripts and Jupyter notebooks, generating Word documents with output, images, and markdown

Project description

Auto-DOCX

A professional Python tool that executes Python scripts and Jupyter notebooks, automatically generating formatted Word documents with output, images, and markdown content.

Features

  • ✅ Execute Python scripts (.py) and Jupyter notebooks (.ipynb)
  • ✅ Capture stdout output and matplotlib images
  • ✅ Render markdown cells from notebooks
  • ✅ Generate professional Word documents with monospaced formatting
  • ✅ Include source code by default (use --no-source to exclude)
  • ✅ Save and reuse Python environment and roll number settings
  • ✅ Command-line interface with flexible options

Installation

From PyPI

pip install auto-docx

From source

# Clone the repository
cd AUTO_DOCX

# Install in development mode
pip install -e .

Usage

Basic Usage

# Execute a Python script
auto-docx my_script.py

# Execute a Jupyter notebook
auto-docx my_notebook.ipynb

Command-Line Options

auto-docx <script_path> [options]

Arguments:
  script_path              Path to the Python file (.py) or notebook (.ipynb)

Options:
  -o, --output PATH        Custom output path for the Word document
  --no-source              Exclude source code from the document
  --timeout SECONDS        Timeout for execution (default: 300)
  -v, --verbose            Enable verbose output
  -r, --roll-no ROLL       Roll number to include in document header
  --save-roll              Save roll number as default for future runs
  --list-envs              List available Python environments
  --env ENV                Select environment by name or index
  --save-env               Save environment as default for future runs
  --python PATH            Path to Python executable
  -h, --help               Show help message

Examples

# Basic execution
auto-docx my_script.py

# Execute notebook with custom output
auto-docx notebook.ipynb -o results/output.docx

# Set roll number and save for future use
auto-docx script.py --roll-no 123456789 --save-roll

# Use specific Python environment and save it
auto-docx script.py --env 3 --save-env

# List available environments
auto-docx --list-envs

# Exclude source code, set timeout
auto-docx my_script.py --no-source --timeout 60

Output Format

The generated Word document includes:

  1. Header - Document title (filename) and roll number
  2. Source Code - The script/notebook source code (included by default)
  3. Output - Captured stdout, images, and rendered markdown cells

All code sections use Courier New monospaced font for proper formatting.

Configuration

Settings are saved to ~/.auto_docx_config.json:

{
  "env": "3",
  "roll_no": "123456789"
}

Once saved with --save-env or --save-roll, these values are automatically used in future runs.

Project Structure

AUTO_DOCX/
├── pyproject.toml          # Project configuration
├── requirements.txt        # Dependencies
├── README.md               # This file
└── src/
    └── auto_docx/
        ├── __init__.py         # Package initialization
        ├── main.py             # Entry point and CLI
        ├── executor.py         # Script execution logic
        ├── document.py         # Word document generation
        └── notebook_runner.py  # Jupyter notebook execution

License

MIT License - See LICENSE file for details.

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

auto_docx-1.0.3.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

auto_docx-1.0.3-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file auto_docx-1.0.3.tar.gz.

File metadata

  • Download URL: auto_docx-1.0.3.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.17

File hashes

Hashes for auto_docx-1.0.3.tar.gz
Algorithm Hash digest
SHA256 91de7a00078c0a7df723980635bdeed0103842d7b5bcac00962ba9ef9e2fa87c
MD5 498f44669bdd71de27dec95ddad78382
BLAKE2b-256 add062fdbd9cbafc31757add92f3d71f879889035a47a8961d247de773644679

See more details on using hashes here.

File details

Details for the file auto_docx-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: auto_docx-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.17

File hashes

Hashes for auto_docx-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8631b3555908484e6a48dac316c8eb71cdfe7885b85561caed6935e009062a5d
MD5 b577ee5161990b5eadc5eb10667d13b1
BLAKE2b-256 80455868da5c62e2a86b4b0766abb5a743870de23a0bdfd63b76b488102f1c69

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