Skip to content

Extensible Logger Refactor #273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 19 commits into from
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
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"containerEnv": {
"BLINKA_FORCEBOARD": "GENERIC_LINUX_PC",
"BLINKA_FORCECHIP": "GENERIC_X86"
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.isort",
"ms-python.debugpy",
"redhat.vscode-yaml",
"tamasfe.even-better-toml"
]
}
},
"image": "mcr.microsoft.com/devcontainers/python:3.13",
"name": "pysquared-dev",
"postCreateCommand": "make .venv pre-commit-install"
}
29 changes: 26 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,34 @@ repos:
#- id: mixed-line-ending
# args: [ --fix=lf ]

- repo: local
hooks:
- id: prevent-type-ignore
name: prevent type ignore annotations
description: 'Enforce that no `# type: ignore` annotations exist in the codebase.'
entry: '# type:? *ignore'
language: pygrep
types: [python]

- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.12.3
hooks:
- id: ruff
- id: ruff-check
args: [--fix]
- id: ruff
- id: ruff-check
args: [--fix, --select, I] # import sorting
- id: ruff-format

# Move back to econchick/interrogate once
# https://github.com/econchick/interrogate/issues/187 has been resolved
- repo: https://github.com/nateinaction/interrogate/
rev: 07d2503 # use-uv branch
hooks:
- id: interrogate
args: [--config=pyproject.toml]
pass_filenames: false # needed if excluding files with pyproject.toml or setup.cfg
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ typecheck: .venv ## Run type check

.PHONY: test
test: .venv ## Run tests
ifeq ($(TEST_SELECT),ALL)
$(UV) run coverage run --rcfile=pyproject.toml -m pytest tests/unit
else
$(UV) run coverage run --rcfile=pyproject.toml -m pytest -m "not slow" tests/unit
endif
@$(UV) run coverage html --rcfile=pyproject.toml > /dev/null
@$(UV) run coverage xml --rcfile=pyproject.toml > /dev/null

Expand Down Expand Up @@ -115,9 +111,8 @@ endef

.PHONY: docs
docs: uv
@$(UV) run mkdocs build
@$(UV) run mkdocs serve
@$(UV) run --group docs mkdocs serve

.PHONY: docs-deploy
docs-deploy: uv
@$(UV) run mkdocs gh-deploy --config-file mkdocs.yaml --force
@$(UV) run --group docs mkdocs gh-deploy --config-file mkdocs.yaml --force
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
# PySquared

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://proveskit.github.io/pysquared/license/)
![CI](https://github.com/proveskit/pysquared/actions/workflows/ci.yaml/badge.svg)

CircuitPython based Flight Software Library for the PROVES Kit. This repo contains all of the core manager components, protocols, and libraries used by the PROVES Kit.

# Development Getting Started
We welcome contributions, so please feel free to join us. If you have any questions about contributing please open an issue or a discussion.

You can find our Getting Started Guide [here](https://proveskit.github.io/pysquared/dev-guide/).

## Supported Boards

| Board Version | Proves Repo | Firmware |
|---------------|--------------------------------------|------------------------------|
| v4 | [proveskit/CircuitPython_RP2040_v4](https://github.com/proveskit/CircuitPython_RP2040_v4) | [proveskit_rp2040_v4](https://circuitpython.org/board/proveskit_rp2040_v4/) |
| v5 | [proveskit/CircuitPython_RP2040_v5](https://github.com/proveskit/CircuitPython_RP2040_v5) | [proveskit_rp2040_v5](https://drive.google.com/file/d/1S_xKkCfLgaMHhTQQ2uGI1fz-TgWfvwOZ/view?usp=drive_link/) |
| v5a | [proveskit/CircuitPython_RP2350_v5a](https://github.com/proveskit/CircuitPython_RP2350_v5a) | [proveskit_rp2350A_V5a](https://github.com/proveskit/flight_controller_board/blob/main/Firmware/FC_FIRM_v5a_V1.uf2) |
Please visit our [docs](https://proveskit.github.io/pysquared/) to get started!
51 changes: 51 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing Guide
Welcome to the contributing guide for PySquared! This guide will help you set up your development environment and get you started with contributing to the repository.

### Setting up your code editor

Every repository comes with a `.devcontainer` directory that contains configuration for a ready-to-use development environment. This environment includes all the necessary tools and dependencies to work on the repository. You can use any code editor that supports dev containers, such as [Visual Studio Code](https://code.visualstudio.com/), to open the repository in a dev container.

### Testing custom versions of PySquared

If you're making a change to PySquared, you can test it in a board specific repository by installing a specific version of PySquared.

Start by pushing your PySquared changes to a branch in the pysquared repository. Then, you can install that version of PySquared in a board specific repository by running the following command:

```sh
PYSQUARED_VERSION=<version_commit_or_branch_name> make install-flight-software BOARD_MOUNT_POINT=<board_mount_point>
```

If you've forgotten how to find your board's mount point, the instructions are in the [Getting Started Guide](getting-started.md).

### Testing Documentation Changes
We use [MkDocs](https://www.mkdocs.org/) to build our documentation. If you make changes to the documentation, you can build and test it locally by running:

```sh
make docs
```

This will generate the documentation and serve it locally. You can then open your web browser and navigate to `http://localhost:8000` to see the changes.

## Continuous Integration (CI)
This repo has a continuous integration system using Github Actions. Anytime you push code to the repo, it will run a series of tests. If you see a failure in the CI, you can click on the details to see what went wrong.

### Common Build Failures
Here are some common build failures you might see and how to fix them:

#### Lint Failure
Every time you make a change in git, it's called a commit. We have a tool called a pre-commit hook that will run before you make each commit to ensure your code is safe and formatted correctly. If you experience a lint failure you can run the following to fix it for you or tell you what's wrong.
```sh
make fmt
```

#### Test Failure
To ensure our code works as we expect we use automated testing. If you're seeing a testing failure in your build, you can see what's wrong by running those tests yourself with:
```sh
make test
```

#### Type Checking Failure
We use a tool called pyright to check our code for type errors. An example of a type error is if you try to add a string and an integer together. Pyright will catch these errors before they cause problems in your code. If you see a type checking failure in your build, you can run the following command to see what the error is:
```sh
make typecheck
```
Loading