Skip to content

Commit

Permalink
Purging version folders
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanDuPont committed Apr 21, 2024
1 parent 49e604f commit d9a3202
Show file tree
Hide file tree
Showing 41 changed files with 397 additions and 313 deletions.
80 changes: 79 additions & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
asyncio
dynamixel_sdk
fastapi
jinja2
numpy
opencv-python
pygame
uvicorn[standard]
websockets
websockets
66 changes: 66 additions & 0 deletions requirements_lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
# via uvicorn
dynamixel-sdk==3.7.31 \
--hash=sha256:74e8c112ca6b0b869b196dd8c6a44ffd5dd5c1a3cb9fe2030e9933922406b466
# via -r requirements.in
fastapi==0.110.0 \
--hash=sha256:266775f0dcc95af9d3ef39bad55cff525329a931d5fd51930aadd4f428bf7ff3 \
--hash=sha256:87a1f6fb632a218222c5984be540055346a8f5d8a68e8f6fb647b1dc9934de4b
Expand Down Expand Up @@ -274,6 +277,69 @@ pydantic-core==2.16.3 \
--hash=sha256:fc4ad7f7ee1a13d9cb49d8198cd7d7e3aa93e425f371a68235f784e99741561f \
--hash=sha256:fee427241c2d9fb7192b658190f9f5fd6dfe41e02f3c1489d2ec1e6a5ab1e04a
# via pydantic
pygame==2.5.2 \
--hash=sha256:03879ec299c9f4ba23901b2649a96b2143f0a5d787f0b6c39469989e2320caf1 \
--hash=sha256:074aa6c6e110c925f7f27f00c7733c6303407edc61d738882985091d1eb2ef17 \
--hash=sha256:0e24d05184e4195fe5ebcdce8b18ecb086f00182b9ae460a86682d312ce8d31f \
--hash=sha256:1822d534bb7fe756804647b6da2c9ea5d7a62d8796b2e15d172d3be085de28c6 \
--hash=sha256:1a2a43802bb5e89ce2b3b775744e78db4f9a201bf8d059b946c61722840ceea8 \
--hash=sha256:1c289f2613c44fe70a1e40769de4a49c5ab5a29b9376f1692bb1a15c9c1c9bfa \
--hash=sha256:1f3849f97372a3381c66955f99a0d58485ccd513c3d00c030b869094ce6997a6 \
--hash=sha256:224c308856334bc792f696e9278e50d099a87c116f7fc314cd6aa3ff99d21592 \
--hash=sha256:263b4a7cbfc9fe2055abc21b0251cc17dea6dff750f0e1c598919ff350cdbffe \
--hash=sha256:2b34c73cb328024f8db3cb6487a37e54000148988275d8d6e5adf99d9323c937 \
--hash=sha256:30a8d7cf12363b4140bf2f93b5eec4028376ca1d0fe4b550588f836279485308 \
--hash=sha256:31648d38ecdc2335ffc0e38fb18a84b3339730521505dac68514f83a1092e3f4 \
--hash=sha256:34646ca20e163dc6f6cf8170f1e12a2e41726780112594ac061fa448cf7ccd75 \
--hash=sha256:35632035fd81261f2d797fa810ea8c46111bd78ceb6089d52b61ed7dc3c5d05f \
--hash=sha256:35cf093a51cb294ede56c29d4acf41538c00f297fcf78a9b186fb7d23c0577b6 \
--hash=sha256:39690e9be9baf58b7359d1f3b2336e1fd6f92fedbbce42987be5df27f8d30718 \
--hash=sha256:3b3e619e33d11c297d7a57a82db40681f9c2c3ae1d5bf06003520b4fe30c435d \
--hash=sha256:3b8a6e351665ed26ea791f0e1fd649d3f483e8681892caef9d471f488f9ea5ee \
--hash=sha256:41f8779f52e0f6e6e6ccb8f0b5536e432bf386ee29c721a1c22cada7767b0cef \
--hash=sha256:47a8415d2bd60e6909823b5643a1d4ef5cc29417d817f2a214b255f6fa3a1e4c \
--hash=sha256:485239c7d32265fd35b76ae8f64f34b0637ae11e69d76de15710c4b9edcc7c8d \
--hash=sha256:4f1559e7efe4efb9dc19d2d811d702f325d9605f9f6f9ececa39ee6890c798f5 \
--hash=sha256:4ff21201df6278b8ca2e948fb148ffe88f5481fd03760f381dd61e45954c7dff \
--hash=sha256:5697528266b4716d9cdd44a5a1d210f4d86ef801d0f64ca5da5d0816704009d9 \
--hash=sha256:677e37bc0ea7afd89dde5a88ced4458aa8656159c70a576eea68b5622ee1997b \
--hash=sha256:68c4e8e60b725ffc7a6c6ecd9bb5fcc5ed2d6e0e2a2c4a29a8454856ef16ad63 \
--hash=sha256:6cf2257447ce7f2d6de37e5fb019d2bbe32ed05a5721ace8bc78c2d9beaf3aee \
--hash=sha256:6d58c8cf937815d3b7cdc0fa9590c5129cb2c9658b72d00e8a4568dea2ff1d42 \
--hash=sha256:6fe323acbf53a0195c8c98b1b941eba7ac24e3e2b28ae48e8cda566f15fc4945 \
--hash=sha256:74e1d6284100e294f445832e6f6343be4fe4748decc4f8a51131ae197dae8584 \
--hash=sha256:78fcd7643358b886a44127ff7dec9041c056c212b3a98977674f83f99e9b12d3 \
--hash=sha256:7d0a2794649defa57ef50b096a99f7113d3d0c2e32d1426cafa7d618eadce4c7 \
--hash=sha256:88d1cdacc2d3471eceab98bf0c93c14d3a8461f93e58e3d926f20d4de3a75554 \
--hash=sha256:9b30bc1220c457169571aac998e54b013aaeb732d2fd8744966cb1cfab1f61d1 \
--hash=sha256:9bd738fd4ecc224769d0b4a719f96900a86578e26e0105193658a32966df2aae \
--hash=sha256:9dcff6cbba1584cf7732ce1dbdd044406cd4f6e296d13bcb7fba963fb4aeefc9 \
--hash=sha256:a0769eb628c818761755eb0a0ca8216b95270ea8cbcbc82227e39ac9644643da \
--hash=sha256:a0bd67426c02ffe6c9827fc4bcbda9442fbc451d29b17c83a3c088c56fef2c90 \
--hash=sha256:bc12e4dea3e88ea8a553de6d56a37b704dbe2aed95105889f6afeb4b96e62097 \
--hash=sha256:c13edebc43c240fb0532969e914f0ccefff5ae7e50b0b788d08ad2c15ef793e4 \
--hash=sha256:c1b89eb5d539e7ac5cf75513125fb5f2f0a2d918b1fd6e981f23bf0ac1b1c24a \
--hash=sha256:ce4b6c0bfe44d00bb0998a6517bd0cf9455f642f30f91bc671ad41c05bf6f6ae \
--hash=sha256:cf2191b756ceb0e8458a761d0c665b0c70b538570449e0d39b75a5ba94ac5cf0 \
--hash=sha256:d29a84b2e02814b9ba925357fd2e1df78efe5e1aa64dc3051eaed95d2b96eafd \
--hash=sha256:d75cbbfaba2b81434d62631d0b08b85fab16cf4a36e40b80298d3868927e1299 \
--hash=sha256:d78485c4d21133d6b2fbb504cd544ca655e50b6eb551d2995b3aa6035928adda \
--hash=sha256:d851247239548aa357c4a6840fb67adc2d570ce7cb56988d036a723d26b48bff \
--hash=sha256:daca456d5b9f52e088e06a127dec182b3638a775684fb2260f25d664351cf1ae \
--hash=sha256:dc346965847aef00013fa2364f41a64f068cd096dcc7778fc306ca3735f0eedf \
--hash=sha256:dd2d2650faf54f9a0f5bd0db8409f79609319725f8f08af6507a0609deadcad4 \
--hash=sha256:e58e2b0c791041e4bccafa5bd7650623ba1592b8fe62ae0a276b7d0ecb314b6c \
--hash=sha256:e708fc8f709a0fe1d1876489345f2e443d47f3976d33455e2e1e937f972f8677 \
--hash=sha256:ed9a3d98adafa0805ccbaaff5d2996a2b5795381285d8437a4a5d248dbd12b4a \
--hash=sha256:edda1f7cff4806a4fa39e0e8ccd75f38d1d340fa5fc52d8582ade87aca247d92 \
--hash=sha256:f02c1c7505af18d426d355ac9872bd5c916b27f7b0fe224749930662bea47a50 \
--hash=sha256:f30d1618672a55e8c6669281ba264464b3ab563158e40d89e8c8b3faa0febebd \
--hash=sha256:fe0228501ec616779a0b9c4299e837877783e18df294dd690b9ab0eed3d8aaab
# via -r requirements.in
pyserial==3.5 \
--hash=sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb \
--hash=sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0
# via dynamixel-sdk
python-dotenv==1.0.1 \
--hash=sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca \
--hash=sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a
Expand Down
20 changes: 15 additions & 5 deletions src/api/v2/BUILD.bazel → src/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,30 @@ py_library(
name = "api_src",
srcs = ["api.py"],
deps = [
":robot_src",
"@pypi//fastapi:pkg",
"@pypi//jinja2:pkg",
"@pypi//opencv_python:pkg",
"@pypi//pygame:pkg",
"@pypi//websockets:pkg",
],
)

py_library(
name = "robot_src",
srcs = ["robot.py"],
deps = [
"@pypi//dynamixel_sdk:pkg",
],
)

# This is how we execute the API. This forces the API
# to run under uvicorn, which serves the app for the user.
py_binary(
name = "main",
srcs = ["main.py"],
args = [
"src.api.v2.api:app",
"src.api.api:app",
"--host",
"0.0.0.0",
],
Expand All @@ -39,11 +49,11 @@ py_oci_image(
base = "@py3.11",
binary = ":main",
cmd = [
"src.api.v2.api:app",
"src.api.api:app",
"--host",
"0.0.0.0",
],
entrypoint = ["src/api/v2/main"],
entrypoint = ["src/api/main"],
exposed_ports = ["8000"],
)

Expand All @@ -53,13 +63,13 @@ py_oci_image(
oci_tarball(
name = "tarball",
image = ":image",
repo_tags = ["trentonbot_api_v2:latest"],
repo_tags = ["trentonbot_api:latest"],
visibility = ["//visibility:public"],
)

oci_push(
name = "push",
image = ":image",
remote_tags = ["v0.0.1"],
repository = "trentonbot_api_v2",
repository = "trentonbot_api",
)
58 changes: 50 additions & 8 deletions src/api/v2/README.md → src/api/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@
# TrentonBot API
# API v1

This version of the API uses a local venv to install packages, and only runs locally.

## Creating a venv

Use the following command to create your venv:

```
python3.11 -m venv venv
```

From here, you can source your venv with the following commands.

Windows:

```
.\venv\Scripts\Activate.ps1
```

Linux:

```
. venv/bin/activate
```

## Installing needed packages

You can install packages required for the application using the command:

```
pip install -r requirements.txt
```

## Saving pip requirements

Run the following command to update the `requirements.txt` file, which is needed whenever you install a new package:

```
pip freeze > requirements.txt
```

# API v2

This API allows for interfacing between the webapp and the vehicle code over ROS 2.

Expand All @@ -9,15 +51,15 @@ This API allows for interfacing between the webapp and the vehicle code over ROS
You can test this code locally by running the command:

```
bazel run //src/api/v2:main
bazel run //src/api:main
```

This will start up the API using uvicorn, running on port 8000 unless the port is in use.

If you want to use args with the app, you can run the following:

```
bazel run //src/api/v2:main -- <ARGS>
bazel run //src/api:main -- <ARGS>
```

The extra `--` allows us to skip over the _bazel_ arguments, and start passing arguments directly to our process.
Expand All @@ -29,22 +71,22 @@ The extra `--` allows us to skip over the _bazel_ arguments, and start passing a
The docker image can be built and published locally using the command:

```
bazel run //src/api/v2:tarball
bazel run //src/api:tarball
```

This will publish the image to your local docker images based on the provided tag:

```
INFO: Running command line: bazel-bin/src/api/v2/tarball.sh
INFO: Running command line: bazel-bin/src/api/tarball.sh
f4ba9898d2a2: Loading layer 17.56kB/17.56kB
The image trentonbot_api_v2:latest already exists, renaming the old one with ID sha256:ccb7026cdc6bcb8f6a46a86b8e363581f33e5168f5cab5cde88f77cd8e0539b5 to empty string
Loaded image: trentonbot_api_v2:latest
The image trentonbot_api:latest already exists, renaming the old one with ID sha256:ccb7026cdc6bcb8f6a46a86b8e363581f33e5168f5cab5cde88f77cd8e0539b5 to empty string
Loaded image: trentonbot_api:latest
```

In this case, if you want to run the image locally, you can used the loaded image above to run:

```
docker run -p 8000:8000 trentonbot_api_v2:latest
docker run -p 8000:8000 trentonbot_api:latest
```

This will spin up the docker container locally, and allow you to test from it.
Loading

0 comments on commit d9a3202

Please sign in to comment.