Skip to main content

A tool that automates presentation of software demos.

Project description

CodeAnim

CodeAnim is a tool to help you animate VS Code. It provides methods that enable you to type, move the cursor, and send commands to VS Code. It works by sending keystrokes using the pynput library.

Installation

We recommend install CodeAnim using pipx.

pipx install codeanim

Usage

CodeAnim runs commands from Markdown files where codeanim commands are enclosed in a python codeanim fence.

Example

Create a Markdown file called codeanim-markdown-demo.md with the following contents:

# A Markdown Header

Some text to be read.

```python codeanim
# Bring VS Code to the front
vscode.activate()

# Open myfile.py
vscode.focus("myfile.py")

# Insert print("Hello, World!") into myfile.py
write('print("Hello, World!")\n')

# Execute the script
vscode.run()
```

To execute the CodeAnim commands in the Markdown file:

codeanim codeanim-markdown-demo.md

Flags

  • Set -v or --verbose to enable verbose mode. Commands will be printed out as they are executed.
  • Set --live to enable presentation mode. In this mode, a wait() will be injected after every codeanim fence.

Development

We use Poetry for development.

git clone https://github.com/shadanan/codeanim.git
cd codeanim
poetry install

Formatting

This project adopts the Ruff formatter and is enforced by a GitHub action.

VS Code

Useful extensions when developing CodeAnim:

Tests

There aren't any unit tests yet. In the tests folder, there is an end-to-end test that uses CodeAnim to open the scratch.py file, types out some code, and executes it. To run the test:

./e2e-test.sh

Then, validate that it worked by observing that the animation runs, types out:

print("Hello, World!")

And executes the script.

Limitations

CodeAnim currently only works on MacOS because of a dependency on AppleScript, which is used to switch to the VS Code window. Also, many of the commands send Mac specific keystrokes. With some effort, CodeAnim can be made to work on other platforms.

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

codeanim-0.0.28.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.

codeanim-0.0.28-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file codeanim-0.0.28.tar.gz.

File metadata

  • Download URL: codeanim-0.0.28.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for codeanim-0.0.28.tar.gz
Algorithm Hash digest
SHA256 d7139122141bc595fe29fa6cdf90b759d3ff5dfe5d970bc9bc096bb5aabc3ffc
MD5 2a015b931d34f851762873d71973dde2
BLAKE2b-256 33a18885ddd8a2a0eae90b089fb8af4c12b2e29e05d403f8ec1dda4263ec4320

See more details on using hashes here.

File details

Details for the file codeanim-0.0.28-py3-none-any.whl.

File metadata

  • Download URL: codeanim-0.0.28-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for codeanim-0.0.28-py3-none-any.whl
Algorithm Hash digest
SHA256 02e586e53ec7e6b52d2758cd9e4c0a0d17661ca48cbad2476019ebf7f371d3d5
MD5 fddc96411c2fab08a2debd19005bb6dd
BLAKE2b-256 cb8facb7307451e0166141e375624bd21f51c829d0bbc067ba4ca6da099e713c

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