Skip to main content

A python tool for analyzing and summarizing a Drafter website in various ways, to simplify grading

Project description

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.

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

analyze_drafter_site-0.4.1.tar.gz (74.5 kB view details)

Uploaded Source

Built Distribution

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

analyze_drafter_site-0.4.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file analyze_drafter_site-0.4.1.tar.gz.

File metadata

  • Download URL: analyze_drafter_site-0.4.1.tar.gz
  • Upload date:
  • Size: 74.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for analyze_drafter_site-0.4.1.tar.gz
Algorithm Hash digest
SHA256 1636067d9fbf9fa5e8b6092600f56a3b9a6753cf7dc80a367321404d5d778f11
MD5 28c8afaa6a8eff653df61e6a860e8f9f
BLAKE2b-256 3ee785e7182ed3409993997e0f8e82f9e0705e2bf0c40681cbb05525ef04b3df

See more details on using hashes here.

File details

Details for the file analyze_drafter_site-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for analyze_drafter_site-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a7d58948721a6fc6316166f0de4b8ab4e4693252c7c2f921d98a544752791e3
MD5 d693a32d0afb9de62433f98184108d26
BLAKE2b-256 a3e31744dcb7cc4639dc9ad5c3b21221d3d6e8980d850178b5c9c5fb5212b217

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