Skip to content

Commit

Permalink
Initial publish
Browse files Browse the repository at this point in the history
  • Loading branch information
kmontag committed Jan 30, 2024
0 parents commit 85fcd0d
Show file tree
Hide file tree
Showing 77 changed files with 10,177 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
root = true
[*.py]
max_line_length = 88
19 changes: 19 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- mode: conf-toml -*-

[flake8]
# For integration with `black`. Adapted from
# https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html.
max-line-length = 88

select = C,E,F,W,B,B950

# E501 is the line-length check; we ignore it because B950 (above)
# adds a line-length check that aligns better with `black`'s behavior,
# i.e. it sometimes allows lines a bit above the max length.
extend-ignore = E203,E501

exclude = __ext__,config_schema.py

[pep8]

exclude = __ext__,config_schema.py
20 changes: 20 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: validate
on:
pull_request:
branches: [master]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: libasound2-dev
version: 1.0
- uses: actions/setup-python@v4
with:
python-version: "3.7"
cache: "pip"
- run: pip install -r requirements.txt
- run: make lint
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
__pycache__/
/user.py

/__ext__/System_MIDIRemoteScripts/

# Markers for Makefile tasks which would otherwise have no artifacts.
/.make.*

# Generated set files and project metadata.
/tests/modeStep_tests_project/Backup
/tests/modeStep_tests_project/*.als
!/tests/modeStep_tests_project/_base.als
Empty file added .gitmodules
Empty file.
6 changes: 6 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
3.7.16

# This is the python version that should be used when running dev
# commands. Live's built-in python version (as of v11.3.13) is 3.7.3,
# but that version doesn't have readily-available builds for e.g. M1
# machines.
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
## Testing

Tests work by opening Live, impersonating the MIDI output of the
SoftStep, and checking the messages that Live sends back.

To get this working, you need to configure a "modeStep" control
surface to use "modeStep test" as its inputs and outputs. However,
that source won't show up until tests are actually running, so you'll
need to configure the control surface manually while you're running
tests for the first time.

You can add the test control surface in addition to the main SSCOM
control surface, if you don't want to deal with switching the
input/output when you want to run tests.

To run tests, use:

```shell
make test
```

For debug output:

```shell
DEBUG=1 make test
```

## Linting and type checks

Before submitting a PR, make sure the following are passing:

```shell
make lint # Validates code style
make check # Validates types
```

Some lint errors can be fixed automatically with:

```shell
make fix
```
44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
SYSTEM_MIDI_REMOTE_SCRIPTS_DIR := /Applications/Ableton\ Live\ 11\ Suite.app/Contents/App-Resources/MIDI\ Remote\ Scripts
TEST_PROJECT_DIR = tests/modeStep_tests_project

.PHONY: deps
deps: __ext__/System_MIDIRemoteScripts/.make.decompile .make.pip-install

.PHONY: lint
lint: .make.pip-install
ruff format --check .
ruff check .

.PHONY: fix
fix: .make.pip-install
ruff format .
ruff check --fix .

.PHONY: check
check: .make.pip-install __ext__/System_MIDIRemoteScripts/.make.decompile
pyright .

.PHONY: test
test: .make.pip-install $(TEST_PROJECT_DIR)/default.als $(TEST_PROJECT_DIR)/overrides.als $(TEST_PROJECT_DIR)/standalone.als
pytest

.PHONY: img
img: .make.pip-install
cd img && python generate.py

# Set files with different configurations for testing.
$(TEST_PROJECT_DIR)/%.als: .make.pip-install $(TEST_PROJECT_DIR)/create_set.py
python $(TEST_PROJECT_DIR)/create_set.py $*

__ext__/System_MIDIRemoteScripts/.make.decompile: $(SYSTEM_MIDI_REMOTE_SCRIPTS_DIR) | .make.pip-install
rm -rf $(@D)/
mkdir -p $(@D)/ableton/
# decompyle3 works for most files, and the ones where it doesn't don't
# matter for our purposes.
decompyle3 -r -o $(@D)/ableton/ $(SYSTEM_MIDI_REMOTE_SCRIPTS_DIR)/ableton/

touch $@

.make.pip-install: requirements.txt .python-version
pip install -r requirements.txt
touch .make.pip-install
Loading

0 comments on commit 85fcd0d

Please sign in to comment.