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
15 changes: 15 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[flake8]
max-line-length = 100
ignore = E203, W503
exclude =
.git,
__pycache__,
.venv,
venv,
build,
dist,
*.egg-info,
.tox,
.eggs,
node_modules,
site
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Bug report
about: Create a report to help us improve
title: '[BUG] '
labels: bug
assignees: ''
---

## Bug report

**Summary**
A short summary of the problem.

**Steps to reproduce**
1. Step one to reproduce
2. Step two
3. ...

**Expected behavior**
What you expected to happen.

**Actual behavior**
What actually happened (include error messages / stack traces if available).

**Reproduction code / example**
If possible, provide a minimal code snippet or steps to reproduce.

**Environment**
- bambu-printer-manager version: (e.g. 0.4.5)
- Python version: (e.g. 3.12)
- OS: (e.g. macOS 14.1, Ubuntu 24.04)

**Logs**
If applicable, paste relevant logs or attach files.

**Additional context**
Anything else that might help us debug (screenshots, sample files, printer firmware version, etc.)
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: "Support / Questions"
url: "https://github.com/synman/bambu-printer-manager/discussions"
about: "General questions and support requests"
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
title: '[FEATURE] '
labels: enhancement
assignees: ''
---

## Feature request

**Problem**
Describe the problem or the user need this feature would solve.

**Proposed solution**
Describe the proposed change or API. Prefer short examples showing how developers would use it.

**Why is this important**
Describe the impact and the primary users (e.g., local users, CI automation).

**Alternatives considered**
Other approaches you considered (and why they were not chosen).

**Additional context**
Links to related issues, PRs, or design notes.
39 changes: 39 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Description
<!-- Provide a brief description of the changes in this PR -->

## Type of Change
<!-- Mark the relevant option with an "x" -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Code refactoring
- [ ] Performance improvement
- [ ] Other (please describe):

## Related Issues
<!-- Link to any related issues using #issue_number -->

## Testing
<!-- Describe the tests you ran and their results -->
- [ ] Tested locally
- [ ] Added/updated unit tests
- [ ] All existing tests pass

## Code Quality Checklist
<!-- Ensure all linting and formatting requirements are met -->
- [ ] Code passes Black formatting check (`black --check .`)
- [ ] Code passes isort import sorting check (`isort --check-only .`)
- [ ] Code passes Flake8 linting (`flake8 .`)
- [ ] Code passes Pylint checks (or documented why warnings are acceptable)
- [ ] Pre-commit hooks installed and passing (`pre-commit run --all-files`)
- [ ] CI workflow (lint.yml) passes successfully

## Documentation
<!-- Check all that apply -->
- [ ] Code is self-documenting and/or includes necessary comments
- [ ] README.md updated (if needed)
- [ ] Documentation updated (if needed)

## Additional Notes
<!-- Any additional information that reviewers should know -->
51 changes: 51 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Lint

on:
push:
branches:
- devel
- main
- 'linting-*'
pull_request:
branches:
- devel
- main

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Run Black (check)
run: black --check .

- name: Run isort (check)
run: isort --check-only .

- name: Run Flake8
run: flake8 .

- name: Run Pylint (optional)
continue-on-error: true
run: pylint src/

- name: Run pre-commit checks
run: |
pre-commit install
pre-commit run --all-files
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
.env.production.local
._*
BambuPrinter.log.*
BambuPrinterManager.log.*
/node_modules
/.pnp
.pnp.js
Expand Down
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
- id: mixed-line-ending

- repo: https://github.com/psf/black
rev: 24.1.1
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8

- repo: https://github.com/pycqa/pylint
rev: v3.0.3
hooks:
- id: pylint
args: [--rcfile=.pylintrc]
17 changes: 17 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[MASTER]
jobs=0

[MESSAGES CONTROL]
disable=
missing-module-docstring,
missing-class-docstring,
missing-function-docstring,
too-few-public-methods,
too-many-instance-attributes,
too-many-arguments,
too-many-locals,
too-many-branches,
too-many-statements

[FORMAT]
max-line-length=100
Empty file removed BambuPrinterManager.log.jsonl
Empty file.
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.PHONY: help lint lint-fix format precommit-install

help:
@echo "Available targets:"
@echo " lint - Run all linters (black check, isort check, flake8)"
@echo " lint-fix - Run linters and fix issues (black, isort)"
@echo " format - Auto-format code with black and isort"
@echo " precommit-install - Install pre-commit hooks"

lint:
@echo "Running Black (check only)..."
black --check .
@echo "Running isort (check only)..."
isort --check-only .
@echo "Running Flake8..."
flake8 .
@echo "Lint checks complete!"

lint-fix:
@echo "Running Black..."
black .
@echo "Running isort..."
isort .
@echo "Running Flake8..."
flake8 .
@echo "Lint fixes complete!"

format:
@echo "Formatting with Black..."
black .
@echo "Formatting with isort..."
isort .
@echo "Formatting complete!"

precommit-install:
@echo "Installing pre-commit hooks..."
pre-commit install
@echo "Pre-commit hooks installed!"
22 changes: 21 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
[build-system]
# requires = ["setuptools"]
requires = ["setuptools == 76.1.0"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 100
target-version = ['py312']
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.venv
| venv
| build
| dist
| __pycache__
)/
'''

[tool.isort]
profile = "black"
line_length = 100
known_first_party = ["bpm"]
known_third_party = ["pytest"]

[tool.setuptools.packages.find]
where = ["src/"]
exclude = ["bpm/ftpsclient"]
Expand Down
5 changes: 5 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
black>=24.0.0
isort>=5.13.0
flake8>=7.0.0
pylint>=3.0.0
pre-commit>=3.6.0
Loading