mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-09-30 19:21:33 +02:00
1. bambu_mqtt.py: Added hms_errors to the completion callback data, which includes the HMS error codes when a print fails
2. archive.py: Updated update_archive_status() to accept an optional failure_reason parameter
3. main.py: Added auto-detection of failure reasons:
- status == "aborted" → failure_reason = "User cancelled"
- status == "failed" with HMS errors → maps module codes to reasons:
- Module 0x07 (Filament) → "Filament runout"
- Module 0x0C (Motion Controller) → "Layer shift"
- Module 0x05 (Nozzle) → "Clogged nozzle"
Frontend changes:
1. ArchivesPage.tsx:
- Badge now shows "cancelled" for aborted prints, "failed" for failed prints
- "Failed Prints" collection and "Hide Failed" filter now include both failed and aborted statuses
2. EditArchiveModal.tsx: Failure reason field now shows for both failed and aborted prints
New tests added:
- test_hms_errors_included_in_failed_completion_callback
- test_aborted_status_when_cancelled
The HMS error module mapping is basic and can be expanded as you observe more failure types. The actual Bambu HMS error codes are documented in their wiki - we can add
more mappings as needed.
77 lines
2.0 KiB
TOML
77 lines
2.0 KiB
TOML
[project]
|
|
name = "bambuddy"
|
|
version = "0.1.5"
|
|
description = "Archive and manage Bambu Lab 3MF files"
|
|
requires-python = ">=3.11"
|
|
|
|
[tool.ruff]
|
|
target-version = "py311"
|
|
line-length = 120
|
|
exclude = [
|
|
".git",
|
|
".venv",
|
|
"venv",
|
|
"__pycache__",
|
|
"static",
|
|
"frontend",
|
|
"*.pyc",
|
|
]
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # Pyflakes
|
|
"I", # isort
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"UP", # pyupgrade
|
|
"ARG", # flake8-unused-arguments
|
|
"SIM", # flake8-simplify
|
|
]
|
|
ignore = [
|
|
"E501", # line too long (handled by formatter)
|
|
"B008", # do not perform function calls in argument defaults (FastAPI Depends)
|
|
"B904", # raise from (too noisy)
|
|
"ARG001", # unused function argument (common in FastAPI)
|
|
"ARG002", # unused method argument
|
|
"SIM108", # ternary operator (readability preference)
|
|
"SIM102", # nested if (readability preference)
|
|
"SIM105", # contextlib.suppress (readability preference)
|
|
"UP038", # isinstance tuple syntax (readability preference)
|
|
]
|
|
|
|
# Allow autofix for all enabled rules
|
|
fixable = ["ALL"]
|
|
unfixable = []
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
# Tests can have unused imports and assertions
|
|
"**/tests/**" = ["F401", "F811", "ARG"]
|
|
# Init files often have unused imports for re-export
|
|
"**/__init__.py" = ["F401"]
|
|
# main.py needs early logging setup before other imports
|
|
"backend/app/main.py" = ["E402"]
|
|
# MQTT client has some unused variables for debugging
|
|
"backend/app/services/bambu_mqtt.py" = ["F841"]
|
|
|
|
[tool.ruff.lint.isort]
|
|
known-first-party = ["backend"]
|
|
force-single-line = false
|
|
combine-as-imports = true
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "double"
|
|
indent-style = "space"
|
|
skip-magic-trailing-comma = false
|
|
line-ending = "auto"
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["backend/tests"]
|
|
python_files = ["test_*.py"]
|
|
python_functions = ["test_*"]
|
|
asyncio_mode = "auto"
|
|
filterwarnings = [
|
|
"ignore::DeprecationWarning",
|
|
]
|