Skip to content

Commit

Permalink
reorganize project (#37)
Browse files Browse the repository at this point in the history
* reorganize project

* update robstride package

* Bump version to 0.0.25

* un-bump version
  • Loading branch information
codekansas authored Oct 24, 2024
1 parent eb089af commit 225de5f
Show file tree
Hide file tree
Showing 23 changed files with 96 additions and 82 deletions.
46 changes: 38 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,9 @@ concurrency:
cancel-in-progress: true

jobs:
publish:
publish-python:
timeout-minutes: 10
name: Build and publish

# We don't need to run on all platforms since this package is
# platform-agnostic. The output wheel is something like
# "monotonic_attention-<version>-py3-none-any.whl".
runs-on: ubuntu-latest

steps:
Expand All @@ -47,6 +43,40 @@ jobs:

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}

publish-rust:
timeout-minutes: 10
name: Build and publish
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Cache Cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry
restore-keys: |
${{ runner.os }}-cargo-registry
- name: Cache Cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index
restore-keys: |
${{ runner.os }}-cargo-index
- name: Publish Robstride package to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cd actuator/robstride
cargo publish
12 changes: 7 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
[workspace]

members = [
"actuator/rust/bindings",
"actuator/rust/robstride",
"actuator/bindings",
"actuator/robstride",
]
resolver = "2"

[workspace.package]

version = "0.1.0"
authors = ["Wesley Maa <[email protected]>", "Pawel Budzianowski <[email protected]>", "Benjamin Bolte <[email protected]>"]
edition = "2021"

description = "Actuator package"
authors = ["K-Scale Labs <[email protected]>"]
repository = "https://github.com/kscalelabs/actuator"
license = "MIT"
repository = "https://github.com/kscalelabs/actuator"
documentation = "https://docs.kscale.dev/software/actuators/overview"
readme = "README.md"
4 changes: 2 additions & 2 deletions actuator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Defines the top-level API for the actuator package."""

__version__ = "0.0.23"
__version__ = "0.0.24"

from .rust.bindings import (
from .bindings import (
PyRobstrideMotorConfig as RobstrideMotorConfig,
PyRobstrideMotorControlParams as RobstrideMotorControlParams,
PyRobstrideMotorFeedback as RobstrideMotorFeedback,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]

name = "bindings"
version.workspace = true
edition.workspace = true
Expand All @@ -9,10 +10,12 @@ license.workspace = true
readme.workspace = true

[lib]

name = "bindings"
crate-type = ["cdylib", "rlib"]

[dependencies]

pyo3 = { version = ">= 0.21.0", features = ["extension-module"] }
pyo3-stub-gen = ">= 0.6.0"
tokio = { version = "1.28.0", features = ["full"] }
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ build-backend = "maturin"
name = "bindings"
requires-python = ">=3.9"


[project.optional-dependencies]
test = ["pytest", "pyright", "ruff"]
File renamed without changes.
File renamed without changes.
35 changes: 35 additions & 0 deletions actuator/robstride/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]

name = "robstride"
readme = "README.md"
version = "0.1.1"
description = "Robstride crate"

authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true

[lib]

name = "robstride"
crate-type = ["cdylib", "rlib"]

[dependencies]

serialport = "^4.5.1"
ctrlc = "^3.4.5"
lazy_static = "^1.4.0"
spin_sleep = "^1.2.1"
nix = "^0.26.2"
log = "^0.4.22"

[[bin]]

name = "motors"
path = "src/bin/motors.rs"

[dependencies.clap]

version = "4.3"
features = ["derive"]
5 changes: 5 additions & 0 deletions actuator/robstride/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# robstride

This crate contains the code for controlling the Robstride actuators.

For more information, see the documentation [here](https://docs.kscale.dev/software/actuators/robstride).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 0 additions & 39 deletions actuator/rust/README.md

This file was deleted.

Empty file removed actuator/rust/__init__.py
Empty file.
22 changes: 0 additions & 22 deletions actuator/rust/robstride/Cargo.toml

This file was deleted.

5 changes: 3 additions & 2 deletions actuator/sim/robstride.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def get_feedback(self) -> RobstrideMotorFeedback:
class RobstrideMotorsSim:
def __init__(self, port_name: str, motor_infos: dict[int, str], verbose: bool = False) -> None:
self.port_name = port_name
# breakpoint()
self.motor_configs = {
id: ROBSTRIDE_CONFIGS[RobstrideMotorType.from_str(motor_type)] for id, motor_type in motor_infos.items()
}
Expand All @@ -53,7 +52,9 @@ def send_starts(self) -> None:
print("Motors started")

def send_motor_controls(
self, motor_controls: dict[int, RobstrideMotorControlParams], serial: bool
self,
motor_controls: dict[int, RobstrideMotorControlParams],
serial: bool,
) -> dict[int, RobstrideMotorFeedback]:
feedback: dict[int, RobstrideMotorFeedback] = {}
for motor_id, params in motor_controls.items():
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ignore_missing_imports = true

[[tool.mypy.overrides]]

module = ["actuator.rust.bindings"]
module = ["actuator.bindings"]

disable_error_code = ["no-untyped-def"]

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def run(self) -> None:
url="https://github.com/kscalelabs/actuator",
rust_extensions=[
RustExtension(
target="actuator.rust.bindings",
path="actuator/rust/bindings/Cargo.toml",
target="actuator.bindings",
path="actuator/bindings/Cargo.toml",
binding=Binding.PyO3,
),
],
Expand Down

0 comments on commit 225de5f

Please sign in to comment.