Contributing Guide¶
Developer-focused notes. For general info see the main CONTRIBUTING.md.
Links¶
- Repository · Issues · PRs · Discussions
Setup¶
git clone https://github.com/Ajimaru/OctoPrint-TempETA.git
cd OctoPrint-TempETA
python -m venv .venv && source .venv/bin/activate
pip install -e ".[develop]"
pre-commit install
See Getting Started for full instructions.
Workflow¶
- Branch:
feature/<name>,fix/<issue>-<desc>,docs/<name>,refactor/<name>,test/<name> - Code: 4-space indent, English only, docstrings on public APIs, comments explain why
- Test:
pytest(add tests for new code, target ≥70% coverage) - Lint:
pre-commit run --all-files - Commit: Conventional Commits (
feat:,fix:,docs:,style:,refactor:,test:,chore:) - Push & PR: one topic per PR, fill the PR template
Common commands¶
pytest # all tests
pytest tests/test_calculator.py::test_name # single test
pytest --cov=octoprint_temp_eta --cov-report=html
black octoprint_temp_eta tests
isort octoprint_temp_eta tests
flake8 octoprint_temp_eta tests
Code Style¶
Python¶
PEP 8 + OctoPrint conventions. Type hints where useful.
def calculate_eta(self, history: Deque, target: float) -> Optional[float]:
"""Calculate ETA via linear extrapolation. Returns seconds or None."""
if len(history) < 2:
return None
rate = self._calculate_rate(history)
remaining = target - history[-1][1]
return remaining / rate if rate > 0 else None
JavaScript¶
Match existing OctoPrint/Knockout style; use Knockout observables for reactive UI state.
LESS/CSS¶
Use semantic, prefixed class names (.temp-eta-*). Edit LESS, never compiled CSS directly.
Pull Requests¶
PR title uses commit-message format (feat: …, fix: …).
Include in the description:
- What & why the change is needed
- How it was implemented (key decisions)
- Testing done (unit / manual / Python versions)
- Screenshots for UI changes
- Any breaking changes
Checks before requesting review:
- [ ] Tests pass (
pytest) - [ ] Pre-commit clean (
pre-commit run --all-files) - [ ] Docs updated if behavior/API/settings changed
Translations¶
pybabel init -i translations/messages.pot -d translations -l <lang>
# edit translations/<lang>/LC_MESSAGES/messages.po
pybabel compile -d translations
See Internationalization Guide.
Documentation¶
pip install -r requirements-docs.txt
npm install
./scripts/generate-jsdocs.sh
mkdocs serve # local preview
License¶
Contributions are licensed under AGPLv3. Contributors are listed in AUTHORS.md.