Skip to content
Open
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
37 changes: 29 additions & 8 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
name: Code style checks
name: Quality checks

on:
pull_request:
push:
branches: [main]
branches: [master]

permissions:
contents: read

concurrency:
group: quality-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: prefix-dev/setup-pixi@v0.10.2
with:
pixi-version: v0.79.0
cache: true
environments: format
- run: pixi run --locked -e format lint

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- name: Install cppcheck
run: sudo apt install cppcheck -y
- uses: pre-commit/action@v3.0.0
- uses: actions/checkout@v7.0.1
- uses: prefix-dev/setup-pixi@v0.10.2
with:
pixi-version: v0.79.0
cache: true
environments: default
- run: pixi run --locked test
- run: pixi run --locked package
205 changes: 12 additions & 193 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,200 +1,19 @@
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# auto-generated documentation
**/docs/_build
**/docs/_out
**/docs/cppapi
**/docs/pyapi

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/*

# Sensitive or high-churn files:
.idea/dataSources/
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
### ROS template
build/
bin/
lib/
msg_gen/
srv_gen/
msg/*Action.msg
msg/*ActionFeedback.msg
msg/*ActionGoal.msg
msg/*ActionResult.msg
msg/*Feedback.msg
msg/*Goal.msg
msg/*Result.msg
msg/_*.py

# Generated by dynamic reconfigure
*.cfgc
/cfg/cpp/
/cfg/*.py

*/cfg/cpp/
*/src/*/cfg/*.py

# Ignore generated docs
*.dox
*.wikidoc

# eclipse stuff
.project
.cproject

# qcreator stuff
CMakeLists.txt.user

srv/_*.py
*.pcd
*.pyc
qtcreator-*
*.user

/planning/cfg
/planning/docs
/planning/src

*~

# Emacs
.#*

# Catkin custom files
CATKIN_IGNORE
### Python template
# Byte-compiled / optimized / DLL files
.pixi/
.venv/
.idea/
.vscode/
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.pytest_cache/
.mypy_cache/
.ruff_cache/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
htmlcov/
build/
dist/
install/
log/
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version
.pyenv2

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
.venv/
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# auto-generated documentation
**/docs/_build
**/docs/_out
**/docs/cppapi
**/docs/pyapi

.ruff_cache/
40 changes: 21 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.6
hooks:
- id: ruff
args:
- "--fix"
- "--exit-non-zero-on-fix"
- id: ruff-format
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.3.5
hooks:
- id: clang-format
args:
- "-i"
- id: cppcheck
args:
- "--suppress=missingInclude"
- "--suppress=unmatchedSuppression"
- "--suppress=unusedFunction"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.10
hooks:
- id: ruff-check
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format
stages: [pre-commit]
- id: ruff-format
name: ruff-format (diff)
args: [--diff]
stages: [manual]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-xml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
37 changes: 37 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Developing DSD

Use [Pixi](https://pixi.sh) to run checks in the same locked environment as CI.
The default environment contains Python test tools and the ROS dependencies used
by the core. The visualization environment adds RQT and Qt; the format environment
contains only code quality tools.

```sh
pixi run --locked test
pixi run --locked package
pixi run --locked -e format format
pixi run --locked -e format lint
```

`format` applies fixes. Review its changes before committing. `lint` checks
formatting without applying formatter changes, following the `bitbots_main`
pre-commit stages. C++ and CMake hooks are omitted because this repository has
neither language.

When changing dependencies, edit `pixi.toml`, run `pixi install` to regenerate the
lockfile, and commit both files. Keep ROS and GUI dependencies out of the format
environment. ROS package dependencies also belong in the corresponding
`package.xml`; ordinary Python runtime dependencies belong in `setup.py`.

Both packages retain their ament Python layout and support standard Python
distribution builds. `package` builds source distributions and wheels and checks
that ROS resources are present and test fixtures are excluded.

Add focused regression tests for parser or runtime changes. Runtime tests use
small fake elements and assert observable stack and event behavior. Tests that
exercise DDS or Qt belong alongside the relevant package's tests and must run
with their real dependencies. Report hardware validation separately from these
checks.

Changes to scheduling, action outcomes, error recovery, parameter syntax, or
registration should describe compatibility and migration. Use issues to compare
options before introducing a new public contract.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
1 change: 1 addition & 0 deletions dynamic_stack_decider/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.md
7 changes: 7 additions & 0 deletions dynamic_stack_decider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# dynamic_stack_decider

A framework for persistent actions selected by reevaluable decision trees.

See the [repository documentation](https://github.com/bit-bots/dynamic_stack_decider)
for usage and development instructions. ROS dependencies are installed through
rosdep or the repository's Pixi environment.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING, Union
from typing import TYPE_CHECKING

from dynamic_stack_decider.logger import get_logger

Expand Down Expand Up @@ -68,7 +68,7 @@ def perform(self, reevaluate=False):

:param reevaluate: True if the current method call is a reevaluate of the state. Meaning the module is not on top of the stack.
"""
msg = "You should override perform() in %s" % self.__class__.__name__
msg = f"You should override perform() in {self.__class__.__name__}"
raise NotImplementedError(msg)

def interrupt(self):
Expand All @@ -77,7 +77,7 @@ def interrupt(self):
"""
self._dsd.interrupt()

def publish_debug_data(self, label: str, data: Union[dict, list, int, float, str, bool]):
def publish_debug_data(self, label: str, data: dict | list | int | float | str | bool):
"""
Publish debug data. Can be viewed using the DSD visualization

Expand Down
Loading
Loading