Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI #64

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:

Flake8:
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -28,11 +28,11 @@ jobs:
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- run: poetry install --no-root
- name: Lint with flake8
- name: Lint with Ruff
run: |
poetry run flake8
poetry run ruff check

Mypy:
Type-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -49,6 +49,6 @@ jobs:
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
- run: poetry --version
- run: poetry install --no-root
- name: Lint with mypy
- name: Type-check with mypy
run: |
poetry run mypy
7 changes: 3 additions & 4 deletions data/device_api_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@

* Maddy Guthridge ([email protected])
"""
# import utils
import json

import arrangement
import channels
import device
Expand All @@ -35,10 +38,6 @@
import screen
import transport
import ui
# import utils

import json


modules = [
arrangement,
Expand Down
5 changes: 3 additions & 2 deletions data/transdoc_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@

Rule definitions for transdoc.
"""
import sys
import os
import sys
from typing import Any, cast

import griffe
from griffe import Kind
from scripts.consts import MODULES, PATHS_TO_MODULES

from scripts.consts import MODULES, PATHS_TO_MODULES

# Add `src/*` to PATH so that building doesn't fail
sys.path.extend([
Expand Down
244 changes: 31 additions & 213 deletions poetry.lock

Large diffs are not rendered by default.

72 changes: 41 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
[tool.poetry]
[project]
name = "fl-studio-api-stubs"
version = "37.0.1"

description = "Stub code, type definitions and documentation for the FL Studio Python API"
readme = "README.md"

authors = ["Maddy Guthridge <[email protected]>"]
authors = [{ name = "Maddy Guthridge", email = "[email protected]" }]
license = "LGPL-3.0-only"

repository = "https://github.com/IL-Group/FL-Studio-Api-Stubs/issues"
documentation = "https://il-group.github.io/FL-Studio-API-Stubs/"

keywords = [
"fl-studio",
Expand All @@ -35,6 +33,14 @@ classifiers = [
"Typing :: Typed",
"Typing :: Stubs Only",
]

requires-python = ">= 3.11, < 4.0"

[project.urls]
repository = "https://github.com/IL-Group/FL-Studio-Api-Stubs/issues"
documentation = "https://il-group.github.io/FL-Studio-API-Stubs/"

[tool.poetry]
include = [
# Explicitly include all .py files in `build_lib`, otherwise, they will be
# skipped due to the `.gitignore`.
Expand Down Expand Up @@ -72,18 +78,9 @@ packages = [
{ include = "flpianoroll", from = "build_lib/piano_roll_scripting" },
]

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/IL-Group/FL-Studio-Api-Stubs/issues"
"Online Documentation" = "https://il-group.github.io/FL-Studio-API-Stubs/"


[tool.poetry.dependencies]
# Primary dependencies
python = "^3.11"

[tool.poetry.group.build.dependencies]
# Build dependencies -- required to build the library
transdoc = {extras = ["python"], version = "^1.1.0"}
transdoc = { extras = ["python"], version = "^1.1.0" }
griffe = "^1.0.0"

[tool.poetry.group.docs.dependencies]
Expand All @@ -99,31 +96,44 @@ mkdocs-section-index = "^0.3.8"
[tool.poetry.group.ci.dependencies]
# CI dependencies -- required to run continuous integration, including
# linting, type checking, etc
coverage = "^7.2.2"
autopep8 = "^2.0.2"
mypy = "^1.1.1"
typing-extensions = "^4.5.0"
flake8 = "^7.0.0"
flake8-pyproject = "^1.2.3"
pytest = ">=7.2.2,<9.0.0"
flapi = "^1.0.1"

[tool.flake8]
exclude = [
'.git',
'__pycache__',
'old',
'build',
'dist',
'prebuild_docs',
'build_lib',
]
ignore = ['E501', 'W503']
ruff = "^0.9.6"

[tool.mypy]
check_untyped_defs = true
files = ["src", "scripts", "data"]

[tool.ruff]
line-length = 79

[tool.ruff.lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
]
ignore = ['E501']


[tool.ruff.lint.per-file-ignores]
# Ignore lints that involve significant rewrites in utils library, since it
# is intentionally the same as that in FL Studio
"src/midi_controller_scripting/utils/*" = [
# Ternary operator
"SIM108",
]

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
12 changes: 4 additions & 8 deletions scripts/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
import os
import sys
from pathlib import Path
from shutil import rmtree, copytree, copy
from shutil import copy, copytree, rmtree

import transdoc
from mkdocs.commands.build import build as mkdocs_build
from mkdocs.config import load_config
import transdoc


TRANSDOC_INPUT = Path("src")
"""
Expand Down Expand Up @@ -197,10 +196,7 @@ def generate_module_tree(
# Now write contents for all remaining contents in the directory
for node, sub_tree in tree.items():
# Only adjust the import path if we're in a module
if is_module:
import_path = mod_import_path / node
else:
import_path = Path(node)
import_path = mod_import_path / node if is_module else Path(node)
generate_module_tree(
sub_tree,
mod_path / node,
Expand Down Expand Up @@ -264,7 +260,7 @@ def find_duplicates(src: Path, dest: Path) -> list[Path]:
* `dest` (`Path`): directory where files will be merged into
"""
duplicates = []
for root, dirs, files in os.walk(src):
for root, _dirs, files in os.walk(src):
root_path = Path(root)
dest_root = dest.joinpath(root_path.relative_to(src))
# print(f"Root: {root} -> {dest_root}")
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"""

from pathlib import Path
import transdoc

import transdoc

INPUT = Path("src")
RULES = Path("data/transdoc_rules.py")
Expand Down
3 changes: 2 additions & 1 deletion scripts/check_stubs_against_fl_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import importlib
import inspect
import json

import flapi
from .consts import MODULES

from .consts import MODULES

LibraryItems = dict[str, list[str]]

Expand Down
1 change: 0 additions & 1 deletion scripts/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import os
from pathlib import Path


DOCS_SECTIONS = os.listdir(Path('src'))
"""
List of sections within the docs -- maps to the contents of the src/ directory.
Expand Down
2 changes: 1 addition & 1 deletion src/edison_scripting/enveditor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
'Utils',
]

from .__sample import Editor, EditorSample, MEEditor, Region, Sample
from .__script_dialog import ScriptDialog
from .__sample import Region, Sample, EditorSample, MEEditor, Editor
from .__utils import TUtils, Utils
6 changes: 3 additions & 3 deletions src/midi_controller_scripting/arrangement/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
liveSelectionStart,
)
from .__markers import (
jumpToMarker,
getMarkerName,
addAutoTimeMarker,
getMarkerName,
jumpToMarker,
)
from .__selection import (
selectionStart,
selectionEnd,
selectionStart,
)
from .__time import (
currentTime,
Expand Down
1 change: 1 addition & 0 deletions src/midi_controller_scripting/callbacks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def OnInit():
handle all the events in `OnMidiMsg`.
"""
from typing import Literal

from fl_classes import FlMidiMsg


Expand Down
69 changes: 34 additions & 35 deletions src/midi_controller_scripting/channels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,63 +22,62 @@

* Channels are zero-indexed.
"""
from .__notes import (
midiNoteOn,
quickQuantize,
)
from .__properties import (
channelNumber,
channelCount,
getChannelName,
setChannelName,
channelNumber,
deselectAll,
getChannelColor,
setChannelColor,
isChannelMuted,
muteChannel,
isChannelSolo,
soloChannel,
getChannelVolume,
setChannelVolume,
getChannelIndex,
getChannelMidiInPort,
getChannelName,
getChannelPan,
setChannelPan,
getChannelPitch,
setChannelPitch,
getChannelType,
getChannelVolume,
getRecEventId,
getTargetFxTrack,
incEventValue,
isChannelMuted,
isChannelSelected,
isChannelSolo,
muteChannel,
processRECEvent,
selectAll,
selectChannel,
selectOneChannel,
selectedChannel,
selectAll,
deselectAll,
getChannelMidiInPort,
getChannelIndex,
getTargetFxTrack,
selectOneChannel,
setChannelColor,
setChannelName,
setChannelPan,
setChannelPitch,
setChannelVolume,
setTargetFxTrack,
processRECEvent,
incEventValue,
getRecEventId,
soloChannel,
)
from .__sequencer import (
closeGraphEditor,
getCurrentStepParam,
getGridBit,
getGridBitWithLoop,
setGridBit,
isGridBitAssigned,
getStepParam,
getCurrentStepParam,
isGridBitAssigned,
setGridBit,
setStepParameterByIndex,
updateGraphEditor,
closeGraphEditor,
)
from .__ui import (
isHighLighted,
showGraphEditor,
isGraphEditorVisible,
showEditor,
focusEditor,
showCSForm,
getActivityLevel,
isGraphEditorVisible,
isHighLighted,
showCSForm,
showEditor,
showGraphEditor,
)
from .__notes import (
midiNoteOn,
quickQuantize,
)


__all__ = (
'channelNumber',
Expand Down
3 changes: 2 additions & 1 deletion src/midi_controller_scripting/channels/__properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
channels.setChannelColor(i, 0x9648aa)
```
"""
from typing import Literal, overload

import midi
from typing import overload, Literal


def selectedChannel(
Expand Down
Loading
Loading