Skip to main content

analyze_drafter_site

codecov CI

A Python tool for analyzing and summarizing Drafter websites in various ways, to simplify grading.

Install it from PyPI

pip install analyze_drafter_site

Usage

Command Line Interface

Analyze a Drafter website Python file:

$ python -m analyze_drafter_site path/to/site.py
# or
$ analyze_drafter_site path/to/site.py

Output Formats

By default, the tool outputs to stdout and creates three files in the ./dist directory:

  • dist/analysis.csv - All complexity and dataclass data in CSV format
  • dist/analysis.mmd - Mermaid class diagram and function call graph
  • dist/analysis.html - Full HTML report with tables and rendered diagrams

Command Line Options

$ analyze_drafter_site --help

Options:
  --output-dir TEXT         Output directory for all files (default: ./dist)
  --csv / --no-csv          Output CSV data to file (default: on)
  --csv-file TEXT           CSV output filename (default: analysis.csv)
  --mermaid / --no-mermaid  Output Mermaid diagrams to file (default: on)
  --mermaid-file TEXT       Mermaid output filename (default: analysis.mmd)
  --html / --no-html        Output HTML report to file (default: on)
  --html-file TEXT          HTML output filename (default: analysis.html)
  --stdout / --no-stdout    Output plain text to stdout (default: on)

Examples

Specify a custom output directory:

$ analyze_drafter_site site.py --output-dir ./results

Generate only HTML output with custom filename:

$ analyze_drafter_site site.py --no-csv --no-mermaid --html-file report.html

Generate all outputs with custom directory and filenames:

$ analyze_drafter_site site.py \
  --output-dir ./grading \
  --csv-file results.csv \
  --mermaid-file diagrams.mmd \
  --html-file report.html

Disable stdout, only generate files:

$ analyze_drafter_site site.py --no-stdout

Programmatic Usage

from analyze_drafter_site import Analyzer, calculate_complexity

# Read your code
with open('site.py') as f:
    code = f.read()

# Calculate complexity
tree, complexity_by_section = calculate_complexity(code)

# Analyze details
analyzer = Analyzer()
analyzer.analyze(code)

# Access results
print(analyzer.get_dataclass_attribute_csv())
print(analyzer.generate_mermaid_class_diagram())

Development

Read the CONTRIBUTING.md file.

Metadata

Release files for analyze-drafter-site 0.4.1

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

Source distribution (sdist)

Source distribution for analyze-drafter-site 0.4.1
File Size Uploaded Provenance
analyze_drafter_site-0.4.1.tar.gz 74.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for analyze-drafter-site 0.4.1
File Interpreter ABI Platform
analyze_drafter_site-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 96.8 kB

Release files / analyze_drafter_site-0.4.1.tar.gz

Download URL analyze_drafter_site-0.4.1.tar.gz
Size 74.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1636067d9fbf9fa5e8b6092600f56a3b9a6753cf7dc80a367321404d5d778f11
BLAKE2b-256 checksum
How to use checksums
3ee785e7182ed3409993997e0f8e82f9e0705e2bf0c40681cbb05525ef04b3df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Release files / analyze_drafter_site-0.4.1-py3-none-any.whl

Download URL analyze_drafter_site-0.4.1-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a7d58948721a6fc6316166f0de4b8ab4e4693252c7c2f921d98a544752791e3
BLAKE2b-256 checksum
How to use checksums
a3e31744dcb7cc4639dc9ad5c3b21221d3d6e8980d850178b5c9c5fb5212b217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Security for analyze-drafter-site 0.4.1

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