Skip to content
Closed
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
42 changes: 42 additions & 0 deletions .github/workflows/ci-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Continuous Integration for Python

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


jobs:
test:
name: Test main package
strategy:
fail-fast: false
matrix:
python-version:
- "3.12"
- "3.14"
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
permissions:
contents: read

steps:
- name: Check out the code
uses: actions/checkout@v6

- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
python-version: ${{ matrix.python-version }}

- name: Install Python dependencies
run: make setup-ci

- name: Static analysis on tests
run: make lint
27 changes: 18 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,29 @@ help: ## Display help information for Makefile targets
# ----------------------------------------------------------

.PHONY: setup
setup: setup-python ## Set up the development environment
setup: setup-simple ## Set up the development environment
@echo "Development environment setup complete."

.PHONY: rebuild-venv
rebuild-venv: ## Rebuild the Python virtual environment from scratch
@echo "Rebuilding the Python virtual environment..."
@uv venv -p $(PYTHON_VERSION) --clear
$(MAKE) setup-python
$(MAKE) setup-simple

.PHONY: setup-python
setup-python: ## Set up the development environment for Python
@echo "Setting up the development environment for Python..."
.PHONY: setup-simple
setup-simple: ## Set up a Python environment without development dependencies
@echo "Setting up a simple Python environment..."
@uv lock --check-exists
@uv sync --no-dev -p $(PYTHON_VERSION)
@echo "Python environment setup complete."

.PHONY: setup-ci
setup-ci: ## Set up the CI environment
@echo "Setting up the CI environment..."
@uv lock --check-exists
@uv sync --dev -p $(PYTHON_VERSION)
@echo "CI environment setup complete."

# ----------------------------------------------------------
# Test
# ----------------------------------------------------------
Expand All @@ -55,12 +62,12 @@ lint: lint-python lint-shell ## Lint all artifacts
.PHONY: lint-python
lint-python: ## Lint all Python scripts
@echo "Linting Python scripts..."
@uv run ruff check scripts/
@uv run ruff check src/

.PHONY: lint-shell
lint-shell: ## Lint all shell scripts
@echo "Linting shell scripts..."
@find . -type f -exec grep -q '^#!.*sh' {} \; -exec docker run --rm -it -v "$$(pwd):/mnt" $(SHELLCHECK) -x {} +
# @find . -type f -exec grep -q '^#!.*sh' {} \; -exec docker run --rm -it -v "$$(pwd):/mnt" $(SHELLCHECK) -x {} +

# ----------------------------------------------------------
# Clean Up
Expand All @@ -69,7 +76,9 @@ lint-shell: ## Lint all shell scripts
.PHONY: clean
clean: ## Clean up generated artifacts
rm -rf .coverage
rm -rf .ruff_cache
rm -rf .mypy_cache
find . -name __pycache__ -exec rm -rf {} +
find . -name "*.egg-info" -exec rm -rf {} +

clean-all: ## Clean expensive generated artifacts
rm -rf .ruff_cache
rm -rf .mypy_cache
13 changes: 1 addition & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,8 @@ requires-python = ">=3.12"

[dependency-groups]
dev = [
"bandit[toml]>=1.9.4", # Security assessment
"hypothesis[cli]>=6.151.9", #
"mypy>=1.19.1", # Python typing
"pre-commit>=4.5.1", #
"pytest-cov>=7.1.0", # Test coverage
"pytest-mock>=3.15.1", #
"pytest>=9.0.2", # Testing framework
"python-call-graph>=2.1.6", #
"ruff>=0.15.7", # Linter and Formatter for Python
"ty>=0.0.24", #
"types-psutil>=7.2.2.20260130", #
"uv-bump>=0.4.2", # Update versions in pyproject.toml
"vulture>=2.15", # Dead code analysis
"ruff>=0.15.10", # Linter and Formatter for Python
"types-pyyaml>=6.0.12.20250915", # Stub with types for PyYAML
]

Expand Down
16 changes: 16 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
"""Spotify playlist utilities."""

from .auth import get_spotify_client
from .fetch import get_all_playlists_metadata, get_full_playlist
from .io import list_local_playlists, load_playlist, save_playlist
from .models import Playlist, Track

__all__ = [
"Playlist",
"Track",
"get_all_playlists_metadata",
"get_full_playlist",
"get_spotify_client",
"list_local_playlists",
"load_playlist",
"save_playlist",
]
6 changes: 6 additions & 0 deletions src/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Entry point for the Spotify CLI."""

from .cli import cli

if __name__ == "__main__":
cli()
Loading