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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file codeanim-0.0.26.tar.gz
.
File metadata
- Download URL: codeanim-0.0.26.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5911e03c400726a61dd1ce7d862f3baa37c759bbd5dd86e302e485c3d1cf7749 |
|
MD5 | f53c67b676b5ab79bcf9fb86093a5b94 |
|
BLAKE2b-256 | cf68cffe1af399761d9fea40d6ca9c23288e604feae9d04110bb10b31eaad459 |
File details
Details for the file codeanim-0.0.26-py3-none-any.whl
.
File metadata
- Download URL: codeanim-0.0.26-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1021-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a82b213ef3ec047b5717971f561b187ab283a92c72e3900fc8efbd4d79b76da6 |
|
MD5 | 0ec8bb9c994f547b376cd49aa785ecf9 |
|
BLAKE2b-256 | 1819b8c92d6ad3c83bb2ccb481064f71f7cba34cf3e1ff7d95527263bd06fda3 |