Skip to content

Commit

Permalink
Merge branch 'main' into improve-namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
medley56 authored Sep 1, 2024
2 parents 42d5e2c + 7e44cb4 commit 6a45a6b
Show file tree
Hide file tree
Showing 37 changed files with 2,031 additions and 574 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
## Code changes will send a PR to the following users
* @medley56
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Title of PR

Brief description of changes. If you write good commit messages, put the concatenated list of messages here.


## Checklist
- [ ] Changes are fully implemented without dangling issues or TODO items
- [ ] Deprecated/superseded code is removed or marked with deprecation warning
- [ ] Current dependencies have been properly specified and old dependencies removed
- [ ] New code/functionality has accompanying tests and any old tests have been updated to match any new assumptions
- [ ] The changelog.md has been updated
12 changes: 12 additions & 0 deletions .github/workflows/run-pycodestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Run PyCodeStyle
on: pull_request
jobs:
pylint:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Build Docker image
run: docker build . --file Dockerfile --target style --tag space-packet-parser-style:latest
- name: Run PyCodeStyle in Docker
run: docker run -i space-packet-parser-style:latest
12 changes: 12 additions & 0 deletions .github/workflows/run-pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Run Pylint
on: pull_request
jobs:
pylint:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
- name: Build Docker image
run: docker build . --file Dockerfile --target lint --tag space-packet-parser-lint:latest
- name: Run Pylint in Docker
run: docker run -i space-packet-parser-lint:latest
11 changes: 4 additions & 7 deletions .github/workflows/test-python-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ on:
python-version:
required: true
type: string
bitstring-version:
required: false
type: string
default: ""
jobs:
test:
name: Run Tests in Docker
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Build Test Docker Image
run: docker build . --file Dockerfile --build-arg BASE_IMAGE_PYTHON_VERSION=${{ inputs.python-version }} --build-arg BITSTRING_VERSION=${{ inputs.bitstring-version }} --tag space-packet-parser-${{ inputs.python-version }}-test:latest
- name: Check out repo
uses: actions/checkout@v4
- name: Build test Docker image
run: docker build . --file Dockerfile --target test --build-arg BASE_IMAGE_PYTHON_VERSION=${{ inputs.python-version }} --tag space-packet-parser-${{ inputs.python-version }}-test:latest
- name: Run Tests in Docker
run: docker run -i space-packet-parser-${{ inputs.python-version }}-test:latest
10 changes: 2 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
name: Test with Matrix of Python Versions
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
on: pull_request
jobs:
python-version-matrix:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
bitstring-version: ["", "3.0.0", "4.1.2"]
uses: ./.github/workflows/test-python-version.yml
with:
python-version: ${{ matrix.python-version }}
bitstring-version: ${{ matrix.bitstring-version }}
python-version: ${{ matrix.python-version }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ Thumbs.db
#######################
.idea
.project
.run

# Virtual environment #
#######################
venv
.venv

# Configurations #
##################
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ build:
post_create_environment:
# Install poetry
- pip install poetry
# Tell poetry to not use a virtual environment
# Tell poetry to not create a new virtual environment but use the current one
- poetry config virtualenvs.create false
post_install:
# Install dependencies. Our doc building dependencies are part of the dev group
- poetry install
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install

sphinx:
configuration: docs/source/conf.py
7 changes: 5 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cff-version: 1.2.0
title: 'space_packet_parser'
type: software
version: '4.1.0'
version: '4.2.0'
description: A CCSDS telemetry packet decoding library based on the XTCE packet format description standard.
license: BSD-3-Clause
abstract: The space_packet_parser Python library is a generalized, configurable packet decoding library for CCSDS telemetry
Expand All @@ -21,9 +21,12 @@ authors:
- email: [email protected]
name: Michael Chambliss
orcid: "0009-0003-7493-0542"
- email: [email protected]
name: Greg Lucas
orcid: "0000-0003-1331-1863"
maintainers:
- email: [email protected]
name: Gavin Medley
orcid: "0000-0002-3520-9715"
repository-code: "https://github.com/medley56/space_packet_parser"
url: "TBD"
url: "https://space-packet-parser.readthedocs.io"
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
# Python version with which to test (must be supported and available on dockerhub)
ARG BASE_IMAGE_PYTHON_VERSION

FROM python:${BASE_IMAGE_PYTHON_VERSION}-slim

# Optional bitstring version
ARG BITSTRING_VERSION
FROM python:${BASE_IMAGE_PYTHON_VERSION:-3.12}-slim AS test

USER root

Expand All @@ -29,7 +26,6 @@ ENV PATH="$PATH:/root/.local/bin"

COPY space_packet_parser $INSTALL_LOCATION/space_packet_parser
COPY tests $INSTALL_LOCATION/tests
COPY pylintrc $INSTALL_LOCATION
COPY pyproject.toml $INSTALL_LOCATION
# LICENSE.txt is referenced by pyproject.toml
COPY LICENSE.txt $INSTALL_LOCATION
Expand All @@ -44,10 +40,21 @@ RUN pip install --upgrade pip
# Install all dependencies (including dev deps) specified in pyproject.toml
RUN poetry install

RUN if [ -n "${BITSTRING_VERSION}" ]; then pip install bitstring==$BITSTRING_VERSION; fi

ENTRYPOINT pytest --cov-report=xml:coverage.xml \
--cov-report=term \
--cov=space_packet_parser \
--junitxml=junit.xml \
tests


FROM test AS lint

COPY pylintrc $INSTALL_LOCATION

ENTRYPOINT pylint space_packet_parser

FROM test AS style

COPY pycodestyle.ini $INSTALL_LOCATION

ENTRYPOINT pycodestyle --config=pycodestyle.ini space_packet_parser
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Space Packet Parser

----------
![Test Status](https://github.com/medley56/space_packet_parser/actions/workflows/tests.yml/badge.svg)
![Doc Status](https://readthedocs.org/projects/space-packet-parser/badge/?version=latest)
[![Test Status](https://github.com/medley56/space_packet_parser/actions/workflows/tests.yml/badge.svg)](https://github.com/medley56/space_packet_parser/actions/workflows/tests.yml)
[![Doc Status](https://readthedocs.org/projects/space-packet-parser/badge/?version=latest)](https://readthedocs.org/projects/space-packet-parser/)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7735001.svg)](https://doi.org/10.5281/zenodo.7735001)

Documentation: https://space-packet-parser.readthedocs.io/en/latest/
Documentation: [https://space-packet-parser.readthedocs.io/en/latest/](https://space-packet-parser.readthedocs.io/en/latest/)

Space Packet Parser is a package for decoding CCSDS telemetry packets according to an XTCE or CSV packet structure definition.
It is based on the UML model of the XTCE spec and aims to support all but the most esoteric elements of the
Expand All @@ -20,3 +21,10 @@ Resources:
pip install space_packet_parser
```

## Missions using Space Packet Parser

[<img src="https://imap.princeton.edu/sites/g/files/toruqf1601/files/imap-mark-hor-multicolor-dark.png" alt="IMAP" height="70"/>](https://imap.princeton.edu/)
[<img src="https://clarreo-pathfinder.larc.nasa.gov/wp-content/uploads/sites/133/2019/08/clarreo_pathfinder_mission_patch_design_v4_decal_1_24_17.png" alt="CLARREO" height="140"/>](https://clarreo-pathfinder.larc.nasa.gov/)
[<img src="https://lasp.colorado.edu/libera/files/2021/02/Libera-Logo-HiRes.png" alt="Libera" height="70"/>](https://lasp.colorado.edu/libera/)
[<img src="https://lasp.colorado.edu/ctim/files/2023/01/CTIM_LOGO_350x100_centered_transparent.png" alt="CTIM-FD" height="70"/>](https://lasp.colorado.edu/ctim/)
[<img src="https://mms.gsfc.nasa.gov/images/promotional_materials/mms_decal_rgb_4in_trabk_72dpi.png" alt="MMS-FEEPS" height="140"/>](https://lasp.colorado.edu/mms/sdc/public/)
19 changes: 16 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,52 @@
version: '3'

services:
lint:
image: space-packets-linting:latest
build:
target: lint

style:
image: space-packets-style:latest
build:
target: style

3.8-tests:
image: space-packets-3.8-test:latest
build:
target: test
args:
- BASE_IMAGE_PYTHON_VERSION=3.8

3.9-tests:
image: space-packets-3.9-test:latest
build:
target: test
args:
- BASE_IMAGE_PYTHON_VERSION=3.9

3.10-tests:
image: space-packets-3.10-test:latest
build:
target: test
args:
- BASE_IMAGE_PYTHON_VERSION=3.10

3.11-tests:
image: space-packets-3.11-test:latest
build:
target: test
args:
- BASE_IMAGE_PYTHON_VERSION=3.11

3.12-tests:
image: space-packets-3.12-test:latest
build:
target: test
args:
- BASE_IMAGE_PYTHON_VERSION=3.12

3.11-tests-min-deps:
image: space-packets-3.11-test:latest
build:
target: test
args:
- BASE_IMAGE_PYTHON_VERSION=3.11
- BITSTRING_VERSION=3.0.0
29 changes: 22 additions & 7 deletions docs/source/changelog.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
# Change Log
This is a log of changes made to the library over time

## Long Term To-Do List
- Add frame transfer parsing layer on top of CCSDS parsing layer
- Support BooleanExpression in a ContextCalibrator
- Add ByteOrderList support to encodings in xtcedef (search for TODOs)
- Support multiple `xtce:Unit` elements for compound units
This is a log of changes made to the library over time. For planned upcoming changes, please check the GitHub issue
list and release milestones.

## Version Release Notes
Release notes for the `space_packet_parser` library

### v5.0.0 (unreleased)
- BREAKING: Replace `bitstring` objects with native Python bytes objects
- Remove dependency on the `bitstring` library
- Much faster parsing speed
- Users that are passing `bitstring.ConstBitStream` objects to `generator` will need to pass a
binary filelike object instead
- Fix EnumeratedParameterType to handle duplicate labels
- Add error reporting for unsupported and invalid parameter types

### v4.2.0 (released)
- Parse short and long descriptions of parameters
- Implement equality checking for SequenceContainer objects and Parameter objects
- Include parameter short description and long description in ParsedDataItems
- Add support for AbsoluteTimeParameterType and RelativeTimeParameterType
- Add support for BooleanParameterType
- Drop support for bitstring <4.0.1
- Support BooleanExpression in a ContextCalibrator
- Default read size is changed to a full file read on file-like objects
- Improve error handling for invalid/unsupported parameter types

### v4.1.1 (released)
- Allow Python 3.12

Expand Down
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"autoapi.extension"
]

myst_enable_extensions = [
"html_image"
]

autoapi_type = 'python'
autoapi_dirs = ['../../space_packet_parser']

Expand Down
8 changes: 8 additions & 0 deletions docs/source/contents.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. toctree::
:maxdepth: 1
:caption: Contents:

users.md
developers.md
changelog.md
autoapi/index.rst
26 changes: 16 additions & 10 deletions docs/source/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,19 @@ To run all tests in docker containers (tests against many versions of python), r
docker-compose up --build && docker-compose down
```

## Making a Pull Request
Feel free to fork this repo and submit a PR!
- If you are working on an issue, link your PR to that issue.
- All PRs should be destined for the `main` branch (trunk-based development).
- Reviews are required before merging and our automated tests must pass.
- Please fill out the PR template that is populated when creating a PR in the GitHub interface.

## Release Process
Reference: [https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)

1. Create a release candidate branch named according to the version to be released. This branch is used to polish
the release while work continues on dev (towards the next release). The naming convention is `release/X.Y.Z`
the release but is fundamentally not different from any other feature branch in trunk-based development.
The naming convention is `release/X.Y.Z`.

2. Bump the version of the package to the version you are about to release, either manually by editing `pyproject.toml`
or by running `poetry version X.Y.Z` or bumping according to a valid bump rule like `poetry version minor`
Expand All @@ -31,32 +39,30 @@ Reference: [https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-

4. Update `changelog.md` to reflect that the version is now "released" and revisit `README.md` to keep it up to date.

5. Open a PR to merge the release branch into master. This informs the rest of the team how the release
process is progressing as you polish the release branch.
5. Open a PR to merge the release branch into main. This informs the rest of the team how the release
process is progressing as you polish the release branch. You may need to rebase the release branch onto
any recent changes to `main` and resolve any conflicts on a regular basis.

6. When you are satisfied that the release branch is ready, merge the PR into `master`.
6. When you are satisfied that the release branch is ready, merge the PR into `main`.

7. Check out the `master` branch, pull the merged changes, and tag the newly created merge commit with the
7. Check out the `main` branch, pull the merged changes, and tag the newly created merge commit with the
desired version `X.Y.Z` and push the tag upstream.

```bash
git tag -a X.Y.Z -m "version release X.Y.Z"
git push origin X.Y.Z
```

8. Ensure that you have `master` checked out and build the package (see below).
8. Ensure that you have `main` checked out and build the package (see below).
Check that the version of the built artifacts is as you expect (should match the version git tag and the
output from `poetry version --short`).

9. Optionally distribute the artifacts to PyPI/Nexus if desired (see below).

10. Open a PR to merge `master` back into `dev` so that any changes made during the release process are also captured
in `dev`.


## Building and Distribution
1. Ensure that `poetry` is installed by running `poetry --version`.

2. To build the distribution archives, run `poetry build`.

3. To upload the wheel to Nexus, run `poetry publish`. You will need credentials to sign into PyPI.
3. To upload the wheel to Nexus, run `poetry publish`. You will need credentials to sign in to PyPI.
Loading

0 comments on commit 6a45a6b

Please sign in to comment.