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-sourceto 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:
- Header - Document title (filename) and roll number
- Source Code - The script/notebook source code (included by default)
- 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.
Metadata
Release files for auto-docx 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| auto_docx-1.0.3.tar.gz | 16.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| auto_docx-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.0 kB
Release files / auto_docx-1.0.3.tar.gz
| Download URL | auto_docx-1.0.3.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
91de7a00078c0a7df723980635bdeed0103842d7b5bcac00962ba9ef9e2fa87c
|
|
BLAKE2b-256 checksum How to use checksums |
add062fdbd9cbafc31757add92f3d71f879889035a47a8961d247de773644679
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.17
|
Release files / auto_docx-1.0.3-py3-none-any.whl
| Download URL | auto_docx-1.0.3-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8631b3555908484e6a48dac316c8eb71cdfe7885b85561caed6935e009062a5d
|
|
BLAKE2b-256 checksum How to use checksums |
80455868da5c62e2a86b4b0766abb5a743870de23a0bdfd63b76b488102f1c69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.17
|