Skip to content

Commit ca7a974

Browse files
committed
Create releasable version
1 parent 0ca9905 commit ca7a974

File tree

13 files changed

+111
-33
lines changed

13 files changed

+111
-33
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: Grub4K

.github/workflows/checks.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Checks
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
check:
13+
name: Code check
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.10'
20+
- name: Install hatch
21+
run: pip install hatch
22+
- name: Run check
23+
run: hatch fmt --check

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
# trusted publishing
16+
id-token: write
17+
# creating a release
18+
contents: write
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.10'
25+
- name: Install hatch
26+
run: pip install hatch
27+
28+
- name: Build package
29+
run: hatch build
30+
31+
- name: Create release
32+
env:
33+
GH_TOKEN: ${{ github.token }}
34+
tag: ${{ github.ref_name }}
35+
run: |
36+
gh release create --notes-from-tag "${tag}" dist/*
37+
38+
- name: Publish to PyPI
39+
uses: pypa/[email protected]

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
*.pyc
2+
/dist/
3+
/vrcar/_version.py

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# vrcar
22
VR controlled Raspberry Pi car
33

4+
Initially developed using the [Freenove 4WD](<https://store.freenove.com/products/fnk0043>), a [Raspberry Pi 4 Model B 4GB](<https://www.raspberrypi.com/products/raspberry-pi-4-model-b/?variant=raspberry-pi-4-model-b-4gb>) and a [Meta Quest 3](<https://www.meta.com/de/en/quest/quest-3>)
5+
6+
## Usage
7+
The client is easiest installed using [`pipx`](<https://pipx.pypa.io/>):
8+
9+
```shell
10+
pipx install "vrcar[pygame,vr]"
11+
```
12+
13+
These are what the available groups will be able to load:
14+
- `pygame`
15+
- Window with the camera video feed
16+
- Keyboard controls
17+
- Joystick controls
18+
- `vr`
19+
- Camera video feed in the headset
20+
- Headset rotation controls camera rotation
21+
422
## License
5-
`vrcar` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
23+
`vrcar` is distributed under the terms of the [MIT](<https://spdx.org/licenses/MIT.html>) license.

pyproject.toml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling"]
2+
requires = ["hatchling", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -34,9 +34,6 @@ vr = [
3434
# "PyOpenGL-accelerate",
3535
"Pillow",
3636
]
37-
server = [
38-
# TODO
39-
]
4037

4138
[project.scripts]
4239
vrcar = "vrcar.__main__:main"
@@ -47,7 +44,10 @@ Issues = "https://github.com/Grub4K/vrcar/issues"
4744
Source = "https://github.com/Grub4K/vrcar"
4845

4946
[tool.hatch.version]
50-
path = "vrcar/__init__.py"
47+
source = "vcs"
48+
49+
[tool.hatch.build.hooks.vcs]
50+
version-file = "vrcar/_version.py"
5151

5252
[tool.hatch.envs.default]
5353
path = ".venv"
@@ -62,18 +62,6 @@ init = "pre-commit install -c pre-commit.yml"
6262
deinit = "pre-commit uninstall"
6363
vrcar = "python -m vrcar {args}"
6464

65-
[tool.hatch.envs.testing]
66-
installer = "uv"
67-
features = ["testing"]
68-
69-
[tool.hatch.envs.testing.scripts]
70-
testing = "python -m vrcar.client.provider.testing"
71-
72-
[tool.hatch.envs.server]
73-
detached = true
74-
installer = "uv"
75-
features = ["server"]
76-
7765
[tool.hatch.envs.hatch-static-analysis]
7866
dependencies = ["ruff==0.4.*"]
7967
config-path = "pyproject.toml"

vrcar/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
22

3-
__version__ = "0.1.0"
4-
version_tuple = tuple(map(int, __version__.split(".")))
3+
from vrcar._version import __version__, __version_tuple__
4+
5+
__all__ = ["__version__", "__version_tuple__"]

vrcar/__main__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,16 @@ def parse_args():
6060

6161

6262
def main():
63+
import logging
64+
65+
import vrcar
6366
import vrcar.log
6467

68+
logger = logging.getLogger(vrcar.__name__)
69+
6570
vrcar.log.setup(name_length=30, debug=True)
71+
logger.info(f"{vrcar.__name__} v{vrcar.__version__}")
72+
6673
args = parse_args()
6774

6875
if args.mode == "server":

vrcar/client/provider/__init__.py

Whitespace-only changes.
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import importlib.resources
34
import importlib.util
45
import logging
56
import threading
@@ -23,6 +24,7 @@
2324
import io
2425

2526
logger = logging.getLogger(__name__)
27+
resources = importlib.resources.files()
2628

2729

2830
class OpenXRProvider:
@@ -36,8 +38,8 @@ def __init__(self):
3638
self._context = xr.ContextObject(
3739
instance_create_info=xr.InstanceCreateInfo(
3840
application_info=xr.ApplicationInfo(
39-
application_name="vrcar",
40-
application_version=xr.Version(*vrcar.version_tuple),
41+
application_name=vrcar.__name__,
42+
application_version=xr.Version(*vrcar.__version_tuple__),
4143
),
4244
enabled_extension_names=[
4345
xr.KHR_OPENGL_ENABLE_EXTENSION_NAME,
@@ -59,11 +61,8 @@ def __enter__(self):
5961

6062
self._texture = GL.glGenTextures(1)
6163

62-
with open("shader/plane.vert") as file:
63-
vertex_shader_data = file.read()
64-
65-
with open("shader/plane.frag") as file:
66-
fragment_shader_data = file.read()
64+
vertex_shader_data = resources.joinpath("plane.vert").read_text()
65+
fragment_shader_data = resources.joinpath("plane.frag").read_text()
6766

6867
try:
6968
vertex_shader = shaders.compileShader(

0 commit comments

Comments
 (0)