Skip to content

Commit

Permalink
Official PPLib Python Implementation (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansen4857 authored Dec 6, 2023
1 parent 1602258 commit fa137cf
Show file tree
Hide file tree
Showing 34 changed files with 4,026 additions and 67 deletions.
1 change: 1 addition & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ GUI:

PathPlannerLib:
- 'pathplannerlib/**'
- 'pathplannerlib-python/**'

workflows:
- '.github/workflows/**'
61 changes: 61 additions & 0 deletions .github/workflows/pplib-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,67 @@ jobs:
# name: pplib-coverage
# files: pathplannerlib/build/reports/jacoco/test/jacocoTestReport.xml

test-python:
name: "[PPLib Python] Unit Tests"
runs-on: ubuntu-22.04
container: wpilib/ubuntu-base:22.04

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
working-directory: ./pathplannerlib-python
run: |
python -m pip install --upgrade pip
pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
working-directory: ./pathplannerlib-python
run: pytest

build-python:
name: "[PPLib Python] Build"
runs-on: ubuntu-22.04
container: wpilib/ubuntu-base:22.04
needs: [test-python]

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
working-directory: ./pathplannerlib-python
run: |
python -m pip install --upgrade pip
pip install build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set version
run: sed -i "s/0.0.0/${{ env.VERSION_NAME }}/g" pyproject.toml
working-directory: ./pathplannerlib-python

- name: Build
working-directory: ./pathplannerlib-python
run: python -m build

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: robotpy-pathplannerlib
path: pathplannerlib-python/dist

build-docker:
strategy:
fail-fast: false
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,34 @@ jobs:
with:
working-directory: pathplannerlib

- name: Move to docs dir
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install python dependencies
working-directory: ./pathplannerlib-python
run: |
python -m pip install --upgrade pip
pip install build handsdown mkdocs mkdocs-material
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Generate python docs
working-directory: ./pathplannerlib-python
run: |
handsdown --external https://github.com/mjansen4857/pathplanner.git -o docsmd -n pathplannerlib --theme=material --create-configs include pathplannerlib
python -m mkdocs build
- name: Move java/cpp to docs dir
working-directory: pathplannerlib/build/docs
run: |
mkdir docs
sudo mv javadoc docs/java
sudo mv cpp/html docs/cpp
- name: Move python to docs dir
run: |
sudo mv pathplannerlib-python/docs pathplannerlib/build/docs/docs/python
- name: Deploy generated documentation to GitHub Pages
uses: s0/[email protected]
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/publish-pplib-python.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build PPLib Release

on:
workflow_dispatch:
inputs:
version:
type: string
description: The full version string, i.e. 2024.0.0-alpha-1 or 2024.1.1
required: true

jobs:
build:
name: "Build & Publish to PyPI"
runs-on: ubuntu-22.04
environment:
name: pypi
url: https://pypi.org/project/robotpy-pathplannerlib/
permissions:
id-token: write

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
working-directory: ./pathplannerlib-python
run: |
python -m pip install --upgrade pip
pip install build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Set version
run: sed -i "s/0.0.0/${{ github.event.inputs.version }}/g" pyproject.toml
working-directory: ./pathplannerlib-python

- name: Build
working-directory: ./pathplannerlib-python
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: pathplannerlib-python/dist/
4 changes: 4 additions & 0 deletions pathplannerlib-python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/dist
/*.egg-info
/docs
/docsmd
21 changes: 21 additions & 0 deletions pathplannerlib-python/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Michael Jansen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
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.
Empty file.
Loading

0 comments on commit fa137cf

Please sign in to comment.