Skip to content

Commit

Permalink
Feat: Split off Music Assistant Client into its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Oct 30, 2024
1 parent 7e3b948 commit 9d5cdb7
Show file tree
Hide file tree
Showing 22 changed files with 2,249 additions and 1 deletion.
Binary file added .github/.DS_Store
Binary file not shown.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: daily
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: weekly
4 changes: 4 additions & 0 deletions .github/workflows/.release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"draft": true
}
3 changes: 3 additions & 0 deletions .github/workflows/.release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "1.0.0"
}
12 changes: 12 additions & 0 deletions .github/workflows/auto_approve_dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Auto approve Dependabot PR's

on: pull_request_target

jobs:
auto-approve:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.actor == 'dependabot[bot]'
steps:
- uses: hmarr/auto-approve-action@v4
24 changes: 24 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release Notes drafter (release-please)
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.tag_name }}
release_created: ${{ steps.release.outputs.release_created }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: simple
manifest-file: .github/workflows/.release-please-manifest.json
config-file: .github/workflows/.release-please-config.json
75 changes: 75 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Publish releases

on:
release:
types: [released]

env:
PYTHON_VERSION: "3.11"
BASE_IMAGE_VERSION_STABLE: "1.1.2"
BASE_IMAGE_VERSION_BETA: "1.1.2"

jobs:
build-artifact:
name: Builds python artifact uploads to Github Artifact store and PyPi
runs-on: ubuntu-latest
outputs:
version: ${{ steps.vars.outputs.tag }}
steps:
- uses: actions/[email protected]
- name: Get tag
id: vars
run: >-
echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Validate version number
run: >-
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
if ! [[ "${{ steps.vars.outputs.tag }}" =~ "b" || "${{ steps.vars.outputs.tag }}" =~ "rc" ]]; then
echo "Pre-release: Tag is missing beta suffix (${{ steps.vars.outputs.tag }})"
exit 1
fi
else
if [[ "${{ steps.vars.outputs.tag }}" =~ "b" || "${{ steps.vars.outputs.tag }}" =~ "rc" ]]; then
echo "Release: Tag must not have a beta (or rc) suffix (${{ steps.vars.outputs.tag }})"
exit 1
fi
fi
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install build
run: >-
pip install build tomli tomli-w
- name: Set Python project version from tag
shell: python
run: |-
import tomli
import tomli_w
with open("pyproject.toml", "rb") as f:
pyproject = tomli.load(f)
pyproject["project"]["version"] = "${{ steps.vars.outputs.tag }}"
with open("pyproject.toml", "wb") as f:
tomli_w.dump(pyproject, f)
- name: Build python package
run: >-
python3 -m build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish release to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

# - name: Create Server + Client repo PR (TODO!)
# uses: music-assistant/frontend-release-pr-action@main
# with:
# github_token: ${{ secrets.PRIVILEGED_GITHUB_TOKEN }}
# new_release_version: ${{ env.version }}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will install Python dependencies, run tests and lint
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
continue-on-error: true

steps:
- name: Check out code from GitHub
uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip build setuptools
pip install . .[test]
- name: Lint/test with pre-commit
run: SKIP=no-commit-to-branch pre-commit run --all-files
81 changes: 81 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
repos:
- repo: local
hooks:
- id: ruff-check
name: 🐶 Ruff Linter
language: system
types: [python]
entry: ./run-in-env.sh ruff check --fix
require_serial: true
stages: [pre-commit, pre-push, manual]
- id: ruff-format
name: 🐶 Ruff Formatter
language: system
types: [python]
entry: ./run-in-env.sh ruff format
require_serial: true
stages: [pre-commit, pre-push, manual]
- id: check-ast
name: 🐍 Check Python AST
language: system
types: [python]
entry: ./run-in-env.sh check-ast
- id: check-case-conflict
name: 🔠 Check for case conflicts
language: system
entry: ./run-in-env.sh check-case-conflict
- id: check-docstring-first
name: ℹ️ Check docstring is first
language: system
types: [python]
entry: ./run-in-env.sh check-docstring-first
- id: check-executables-have-shebangs
name: 🧐 Check that executables have shebangs
language: system
types: [text, executable]
entry: ./run-in-env.sh check-executables-have-shebangs
stages: [pre-commit, pre-push, manual]
- id: check-merge-conflict
name: 💥 Check for merge conflicts
language: system
types: [text]
entry: ./run-in-env.sh check-merge-conflict
- id: check-symlinks
name: 🔗 Check for broken symlinks
language: system
types: [symlink]
entry: ./run-in-env.sh check-symlinks
- id: check-toml
name: ✅ Check TOML files
language: system
types: [toml]
entry: ./run-in-env.sh check-toml
- id: codespell
name: ✅ Check code for common misspellings
language: system
types: [text]
entry: ./run-in-env.sh codespell
- id: detect-private-key
name: 🕵️ Detect Private Keys
language: system
types: [text]
entry: ./run-in-env.sh detect-private-key
- id: end-of-file-fixer
name: ⮐ Fix End of Files
language: system
types: [text]
entry: ./run-in-env.sh end-of-file-fixer
stages: [pre-commit, pre-push, manual]
- id: trailing-whitespace
name: ✄ Trim Trailing Whitespace
language: system
types: [text]
entry: ./run-in-env.sh trailing-whitespace-fixer
stages: [pre-commit, pre-push, manual]
- id: mypy
name: mypy
entry: ./run-in-env.sh mypy
language: script
types: [python]
require_serial: true
pass_filenames: false
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# client
# Music Assistant Client

Python client to interact with the Music Assistant Server API
3 changes: 3 additions & 0 deletions music_assistant_client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""Music Assistant Client: Manage a Music Assistant server remotely."""

from .client import MusicAssistantClient # noqa: F401
Loading

0 comments on commit 9d5cdb7

Please sign in to comment.