Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History

README.md

Outline

Codat Documentation Code Utils

A CLI tool for extracting, managing and checking code snippets from Codat documentation. Currently consists of two commands

  • extract: This will find every markdown file in the docs directory containing a code snippet. It will then extract those snippets into files under a temp/ directory.
  • check: This will copy those files into a container with all nessecary Codat SDK dependancies and perform checks that the imports and code are correct and would build.

Development

This project uses uv for dependency management.

# Install dependencies
uv sync

# Install development dependencies
uv sync --extra dev

Usage

# Run the code extractor
uv run code-util extract

# Run compiler checks on extracted code, (can only be done on lang at a time)
uv run code-util check -l programming-language

# Get help in the cli
uv run code-util --help

Structure

  • main.py - Entrypoint for the CLI.
  • code_finder/ - module for code relating to the CodeFinder class a.k.a the functionality to scan through markdown documents.
  • code_checker/ - module for code relating to the CodeChecker class a.k.a the functionality to build containers and run commands in them.
  • code_checker/docker/ - docker files, scripts and config that the containers use.
  • temp/ - Generated code snippets (gitignored).
  • files_with_code.txt - List of files containing code (gitignored).

Dependancies

  • Click - Framework for building CLIs.
  • Docker SDK For Python - Library for interacting with the Docker API.
  • Pytest - Python Unit testing Framework.
  • Pyfakefs - Python utility for faking a filesystem during testing.

Notes

  • Hard coded to only deal with python, javascript(typescript) and C#
  • Javascript container uses a private npm package. Please set PAT_TOKEN and CODAT_EMAIL env vars in order to build.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.