Skip to content

Commit

Permalink
Release v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sco1 authored Aug 7, 2024
2 parents 5fc37f7 + 4dc6e72 commit bba7480
Show file tree
Hide file tree
Showing 22 changed files with 932 additions and 276 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.0
current_version = 0.5.0
commit = False
allow_dirty = True

Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
html/** linguist-documentation
doc/** linguist-documentation
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
Expand All @@ -12,7 +12,7 @@ repos:
- id: isort
name: isort
- repo: https://github.com/pycqa/flake8
rev: 7.1.0
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies:
Expand All @@ -35,6 +35,6 @@ repos:
- id: python-check-blanket-type-ignore
- id: python-use-type-annotations
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
rev: v0.5.6
hooks:
- id: ruff
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog
Versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (`<major>`.`<minor>`.`<patch>`)

## [0.5.0]
### Changed
* #16 Complete reimplementation of CLI

### Added
* Add additional helpers to `pyflysight.config_utils` and `pyflysight.flysight_utils`

### Added


## [v0.4.0]
### Added
* Add derived `total_accel` column to Flysight V2 IMU sensor dataframe, calculated as a vector sum of the `xyz` acceleration components
Expand Down
45 changes: 45 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Contributing
## Development Environment
This project uses [Poetry](https://python-poetry.org/) to manage dependencies. With your fork cloned to your local machine, you can install the project and its dependencies to create a development environment using:

```bash
$ poetry install
```

A [`pre-commit`](https://pre-commit.com) configuration is also provided to create a pre-commit hook so linting errors aren't committed:

```bash
$ pre-commit install
```

[`mypy`](https://mypy-lang.org/) is also used by this project to provide static type checking. It can be invoked using:

```bash
$ mypy .
```

Note that `mypy` is not included as a pre-commit hook.

## Testing & Coverage
A [pytest](https://docs.pytest.org/en/latest/) suite is provided, with coverage reporting from [`pytest-cov`](https://github.com/pytest-dev/pytest-cov). A [`tox`](https://github.com/tox-dev/tox/) configuration is provided to test across all supported versions of Python. Testing will be skipped for Python versions that cannot be found.

```bash
$ tox
```

Details on missing coverage, including in the test suite, is provided in the report to allow the user to generate additional tests for full coverage. Full code coverage is expected for the majority of code contributed to this project. Some exceptions are expected, primarily around code whose functionality relies on either user input or the presence of external drives; these interactions are currently not mocked, though this may change in the future.

## Documentation
### `pdoc`
Autogenerated documentation is provided by [`pdoc`](https://pdoc3.github.io/pdoc/) & deployed on pushes to the `main` branch of the project. The included `tox` configuration will also regenerate the static HTML pages, and you can also invoke manually using:

```bash
$ tox -e pdoc
```

### `cog`
The project README contains some dynamic content generated by [`cog`](https://cog.readthedocs.io/en/latest/). The included `tox` configuration will also these sections, and you can also invoke manually using:

```bash
$ tox -e cog
```
55 changes: 4 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pyflysight
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyflysight/0.4.0?logo=python&logoColor=FFD43B)](https://pypi.org/project/pyflysight/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyflysight/0.5.0?logo=python&logoColor=FFD43B)](https://pypi.org/project/pyflysight/)
[![PyPI](https://img.shields.io/pypi/v/pyflysight?logo=Python&logoColor=FFD43B)](https://pypi.org/project/pyflysight/)
[![PyPI - License](https://img.shields.io/pypi/l/pyflysight?color=magenta)](https://github.com/sco1/pyflysight/blob/main/LICENSE)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/sco1/pyflysight/main.svg)](https://results.pre-commit.ci/latest/github/sco1/pyflysight/main)
Expand Down Expand Up @@ -30,39 +30,15 @@ Options:
--help Show this message and exit.

Commands:
batch Batch flight log processing pipeline.
single Single flight log processing pipeline.
device FlySight device utilities.
logs FlySight device log utilities.
trim FlySight log trimming.
```
<!-- [[[end]]] -->

## CLI Usage
🚨 **NOTE:** CLI functionality is currently still under development. 🚨

### Environment Variables
The following environment variables are provided to help customize pipeline behaviors.

| Variable Name | Description | Default |
|--------------------|-----------------------------------|--------------|
| `PROMPT_START_DIR` | Start path for UI file/dir prompt | `'.'` |

### `pyflysight single`
Process a single FlySight log file.
#### Input Parameters
| Parameter | Description | Type | Default |
|------------------------|--------------------------------|--------------|------------|
| `--log-filepath` | Path to FlySight log to parse. | `Path\|None` | GUI Prompt |

### `pyflysight batch`
Batch process a directory of FlySight log files.
#### Input Parameters
| Parameter | Description | Type | Default |
|------------------------|-----------------------------------------------|--------------|------------|
| `--log-dir` | Path to FlySight log directory to parse. | `Path\|None` | GUI Prompt |
| `--log-pattern` | FlySight log file glob pattern.<sup>1,2</sup> | `str` | `"*.CSV"` |

1. Case sensitivity is deferred to the host OS
2. Recursive globbing requires manual specification (e.g. `**/*.CSV`)

## Internal Data Representation
See: [Data Format](/doc/data_format.md) for a more detailed breakdown of the expected data file formats.

Expand Down Expand Up @@ -119,26 +95,3 @@ The Flysight V2 log output looks something like:
├── SENSOR.CSV
└── TRACK.CSV
```

## Contributing
### Development Environment
This project uses [Poetry](https://python-poetry.org/) to manage dependencies. With your fork cloned to your local machine, you can install the project and its dependencies to create a development environment using:

```bash
$ poetry install
```

A [pre-commit](https://pre-commit.com) configuration is also provided to create a pre-commit hook so linting errors aren't committed:

```bash
$ pre-commit install
```

### Testing & Coverage
A [pytest](https://docs.pytest.org/en/latest/) suite is provided, with coverage reporting from [pytest-cov](https://github.com/pytest-dev/pytest-cov). A [tox](https://github.com/tox-dev/tox/) configuration is provided to test across all supported versions of Python. Testing will be skipped for Python versions that cannot be found.

```bash
$ tox
```

Details on missing coverage, including in the test suite, is provided in the report to allow the user to generate additional tests for full coverage.
64 changes: 59 additions & 5 deletions html/pyflysight/cli.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,64 @@ <h1 class="title">Module <code>pyflysight.cli</code></h1>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="pyflysight.cli.batch"><code class="name flex">
<span>def <span class="ident">batch</span></span>(<span>log_dir: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, log_pattern: str = &lt;typer.models.OptionInfo object&gt;, verbose: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
<span>def <span class="ident">batch</span></span>(<span>log_dir: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, verbose: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Batch flight log processing pipeline.</p></div>
<div class="desc"><p>Batch trim a directory of flight logs.</p>
<p>NOTE: Log trimming is currently only implemented for FlySight V2 hardware.</p></div>
</dd>
<dt id="pyflysight.cli.clear"><code class="name flex">
<span>def <span class="ident">clear</span></span>(<span>flysight_root: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, force: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Clear all logs on device.</p>
<p>WARNING: This action is destructive. All logs on the device will be permanently deleted and
cannot be recovered.</p></div>
</dd>
<dt id="pyflysight.cli.copy"><code class="name flex">
<span>def <span class="ident">copy</span></span>(<span>flysight_root: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, dest: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, exist_ok: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Copy all logs on device to the specified destination.</p></div>
</dd>
<dt id="pyflysight.cli.list"><code class="name flex">
<span>def <span class="ident">list</span></span>(<span>wait_for: int = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>List connected Flysight devices.</p>
<p>If <code>wait_for</code> is &gt; 0, the OS will be polled for up to <code>wait_for</code> seconds for at least one
FlySight device to be connected.</p></div>
</dd>
<dt id="pyflysight.cli.single"><code class="name flex">
<span>def <span class="ident">single</span></span>(<span>log_filepath: pathlib.Path = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
<span>def <span class="ident">single</span></span>(<span>log_dir: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, verbose: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Trim single flight log.</p>
<p>NOTE: Log trimming is currently only implemented for FlySight V2 hardware.</p></div>
</dd>
<dt id="pyflysight.cli.write_default"><code class="name flex">
<span>def <span class="ident">write_default</span></span>(<span>flysight_root: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, backup_existing: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Write default configuration.</p>
<p>WARNING: This action is destructive. All existing configuration information &amp; formatting will be
permanently lost.</p></div>
</dd>
<dt id="pyflysight.cli.write_from_json"><code class="name flex">
<span>def <span class="ident">write_from_json</span></span>(<span>flysight_root: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, config_source: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, backup_existing: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Write previously serialized paramters.</p>
<p>WARNING: This action is destructive. All existing configuration information &amp; formatting will be
permanently lost.</p></div>
</dd>
<dt id="pyflysight.cli.write_from_other"><code class="name flex">
<span>def <span class="ident">write_from_other</span></span>(<span>flysight_root: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, config_source: pathlib.Path = &lt;typer.models.OptionInfo object&gt;, backup_existing: bool = &lt;typer.models.OptionInfo object&gt;) ‑> None</span>
</code></dt>
<dd>
<div class="desc"><p>Single flight log processing pipeline.</p></div>
<div class="desc"><p>Copy configuration from file.</p>
<p>WARNING: This action is destructive. All existing configuration information &amp; formatting will be
permanently lost.</p></div>
</dd>
</dl>
</section>
Expand All @@ -61,9 +109,15 @@ <h2 class="section-title" id="header-functions">Functions</h2>
</ul>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<ul class="two-column">
<li><code><a title="pyflysight.cli.batch" href="#pyflysight.cli.batch">batch</a></code></li>
<li><code><a title="pyflysight.cli.clear" href="#pyflysight.cli.clear">clear</a></code></li>
<li><code><a title="pyflysight.cli.copy" href="#pyflysight.cli.copy">copy</a></code></li>
<li><code><a title="pyflysight.cli.list" href="#pyflysight.cli.list">list</a></code></li>
<li><code><a title="pyflysight.cli.single" href="#pyflysight.cli.single">single</a></code></li>
<li><code><a title="pyflysight.cli.write_default" href="#pyflysight.cli.write_default">write_default</a></code></li>
<li><code><a title="pyflysight.cli.write_from_json" href="#pyflysight.cli.write_from_json">write_from_json</a></code></li>
<li><code><a title="pyflysight.cli.write_from_other" href="#pyflysight.cli.write_from_other">write_from_other</a></code></li>
</ul>
</li>
</ul>
Expand Down
16 changes: 16 additions & 0 deletions html/pyflysight/config_utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ <h1 class="title">Module <code>pyflysight.config_utils</code></h1>
<section>
</section>
<section>
<h2 class="section-title" id="header-functions">Functions</h2>
<dl>
<dt id="pyflysight.config_utils.parse_config_params"><code class="name flex">
<span>def <span class="ident">parse_config_params</span></span>(<span>config_filepath: Path) ‑> dict[str, str]</span>
</code></dt>
<dd>
<div class="desc"><p>Parse raw configuration parameters from the provided file.</p>
<p>Parameters are assumed to be <code>param:val</code> pairs &amp; are returned in their raw form. <code>;</code> is treated
as a comment character &amp; any text following it in a line is ignored.</p></div>
</dd>
</dl>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
Expand Down Expand Up @@ -386,6 +397,11 @@ <h3>Instance variables</h3>
<li><code><a title="pyflysight" href="index.html">pyflysight</a></code></li>
</ul>
</li>
<li><h3><a href="#header-functions">Functions</a></h3>
<ul class="">
<li><code><a title="pyflysight.config_utils.parse_config_params" href="#pyflysight.config_utils.parse_config_params">parse_config_params</a></code></li>
</ul>
</li>
<li><h3><a href="#header-classes">Classes</a></h3>
<ul>
<li>
Expand Down
Loading

0 comments on commit bba7480

Please sign in to comment.