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.27.tar.gz (7.5 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.27-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: codeanim-0.0.27.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.1 Linux/6.8.0-1017-azure

File hashes

Hashes for codeanim-0.0.27.tar.gz
Algorithm Hash digest
SHA256 85379e072a0e750d4662e2ea9fcab0eb9d2767da439b6b5ffc80812297adfcec
MD5 d2ad3bfd494048f5a985941547cb8cbf
BLAKE2b-256 0883b2e1050d30ce8ee64a01eb2fbaaa00a1bd7d3b41934d76b0e3c76263047e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: codeanim-0.0.27-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.1 Linux/6.8.0-1017-azure

File hashes

Hashes for codeanim-0.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 1d0a10e16a1f2f564b47c4895559284a1240dbe90d34aac5f359b2e3ead46e67
MD5 c69887c16ab2eebe92b0792ad81e2a7c
BLAKE2b-256 8ce57c93ed19ae83ae30843669d2dff6007361263325f6596ef7654c9293afb3

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