Home

Awesome

SPKB

SolidPython-based Keyboard Builder

API Documentation on ReadTheDocs Python package

Action Shot

A SolidPython-based library for building custom keyboards with Python and OpenSCAD.

Some portions ported from Clojure, originally from the Dactyl Keyboard and my fork thereof, the Dactyl Lynx Keyboard.

Using SPKB

Installing

Simply install the library in your project, using your preferred package manager.

Poetry:

poetry add spkb

PDM:

pdm add

pipenv:

pipenv install spkb

Usage

In your project, you can simply import what you need from the submodules of spkb:

from spkb.switch_plate import plate_thickness, mx_plate
from spkb.board_mount import stm32_blackpill
from spkb.keycaps import sa_double_length, sa_cap

See the sidebar of the documentation for a reference of what's available.

Examples

See the example scripts in the examples/ directory. You can run them by setting PYTHONPATH to include the current directory:

env PYTHONPATH=$PWD poetry run python examples/stm32_blackpill_mount.py

Developing SPKB

Prerequisites

Installing dependencies

poetry install

Usage

For simply generating interesting key testers, see the example scripts in the examples/ directory.

Running tests

You can run simple tests from some of the submodules:

poetry run python -m spkb.keycaps         # Renders the built-in keycap approximations
poetry run python -m spkb.single_key_pcb  # Renders a simple approximation of a single-key PCB
poetry run python -m spkb.single_tester   # Renders a single-key tester
poetry run python -m spkb.keyswitch.base  # Renders a switch socket negative, plate with board mount, and dummy switch shape
poetry run python -m spkb.keyswitch.choc  # Renders a switch socket with backplate for a Kailh Choc switch
poetry run python -m spkb.keyswitch.mx    # Renders a switch socket with backplate for an MX-style switch

# Deprecated modules
poetry run python -m spkb.switch_plate    # Renders a variety of keyswitch plates (sockets)
poetry run python -m spkb.keyswitch       # Renders a basic approximation of an MX-style switch body

You can also run all module tests and check for appropriate outputs with this script:

scripts/run-module-tests.sh

Documentation

You can view the documentation online on ReadTheDocs.

You can also view the generated API documentation locally by running pdoc:

poetry run pdoc -n -t templates spkb

Links

License

This project is released under the BSD 3-Clause License.