Skip to content
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
74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: CI

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 src/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics

- name: Type check with mypy
run: |
mypy src/
continue-on-error: true

- name: Test with pytest
run: |
pytest --cov=unifi_client --cov-report=xml --cov-report=term
Comment on lines +40 to +43
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mypy type checking step is configured with 'continue-on-error: true', which means type checking failures won't fail the CI build. Given that the pyproject.toml configures mypy with strict type checking options (disallow_untyped_defs, disallow_incomplete_defs, etc.), and the decorator at line 154-162 of unifi.py may have type annotation issues, the CI might be silently passing despite type errors. Consider either fixing the type issues and removing 'continue-on-error: true', or documenting why type checking is allowed to fail.

Copilot uses AI. Check for mistakes.

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

build:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,5 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/

.DS_Store
8 changes: 8 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include README.md
include LICENSE
include pyproject.toml
recursive-include src *.py
Copy link

Copilot AI Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing py.typed file in the package. Since this package provides type hints and uses mypy for type checking (as configured in pyproject.toml), it should include an empty 'py.typed' marker file in src/unifi_client/ to indicate that the package supports typing per PEP 561. This allows users of the library to benefit from type checking. Also ensure MANIFEST.in includes this file with 'recursive-include src *.typed'.

Copilot uses AI. Check for mistakes.
recursive-include tests *.py
global-exclude __pycache__
global-exclude *.py[co]
global-exclude .DS_Store
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.PHONY: help install install-dev test coverage lint format type-check clean build publish-test publish

help:
@echo "Available commands:"
@echo " install - Install package"
@echo " install-dev - Install package with dev dependencies"
@echo " test - Run tests"
@echo " coverage - Run tests with coverage report"
@echo " lint - Run flake8 linter"
@echo " format - Format code with black"
@echo " type-check - Run mypy type checker"
@echo " clean - Remove build artifacts"
@echo " build - Build package"
@echo " publish-test - Publish to Test PyPI"
@echo " publish - Publish to PyPI"

install:
pip install -e .

install-dev:
pip install -e ".[dev]"

test:
pytest -v

coverage:
pytest --cov=unifi_client --cov-report=html --cov-report=term-missing

lint:
flake8 src/ tests/

format:
black src/ tests/

format-check:
black --check src/ tests/

type-check:
mypy src/

clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf htmlcov/
rm -rf .coverage
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name '*.pyc' -delete

build: clean
python -m build

publish-test: build
twine upload --repository testpypi dist/*

publish: build
twine upload dist/*

all: format lint type-check test
Loading
Loading