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.1.tar.gz (13.7 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.1-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for auto_docx-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e61acf0b340b079dfc2ebb1c7bfa0ca1a3078a4572be89da8f366064161c09e2
MD5 0ea5e9a6c63f45e6127f1cebf96f60b8
BLAKE2b-256 d4618216af74e5230e37535cc72def376c38a906d1b9b8c493ddbf899bc800ba

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for auto_docx-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e9b98cc1de0a9086f134f3c94f429b2aabe8478ea21353b67dd09cd4299dff3
MD5 4e17950c50f96d641eb21716a1aac67b
BLAKE2b-256 4a59b975335a36d48ea8a20f6001cfeb8b29aacb8f6c8b80a81c49a9727d28b0

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