Skip to content

Commit 0393c23

Browse files
authored
Merge pull request #223 from virtuald/commands
Move robotpy-commands-v2 into mostrobotpy
2 parents de9e485 + 5713aab commit 0393c23

File tree

100 files changed

+9222
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+9222
-5
lines changed

.github/workflows/dist.yml

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,38 @@ jobs:
7171
./rdev.sh ci check-tag
7272
7373
#
74-
# Build other wheels first (OS-specific, not python specific)
74+
# Build pure wheels first
75+
#
76+
77+
build-pure:
78+
runs-on: ubuntu-latest
79+
steps:
80+
- uses: actions/checkout@v4
81+
with:
82+
fetch-depth: 0
83+
84+
- name: Install python
85+
uses: actions/setup-python@v5
86+
with:
87+
python-version: '3.13'
88+
89+
- name: Install deps
90+
shell: bash
91+
run: |
92+
python -m pip --disable-pip-version-check install -r rdev_requirements.txt
93+
94+
- name: Build + test wheels
95+
shell: bash
96+
run: |
97+
./rdev.sh ci build-pure-wheels
98+
99+
- uses: actions/upload-artifact@v4
100+
with:
101+
name: "pypi-pure"
102+
path: dist
103+
104+
#
105+
# Build other wheels next (OS-specific, not python specific)
75106
#
76107

77108
build-other:
@@ -120,7 +151,7 @@ jobs:
120151

121152
build-meson:
122153
runs-on: ${{ matrix.os }}
123-
needs: [setup_concurrency, build-other]
154+
needs: [setup_concurrency, build-other, build-pure]
124155
strategy:
125156
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
126157
fail-fast: true
@@ -169,6 +200,12 @@ jobs:
169200
path: dist-other
170201
merge-multiple: true
171202

203+
- uses: actions/download-artifact@v4
204+
with:
205+
pattern: "pypi-pure"
206+
path: dist-other
207+
merge-multiple: true
208+
172209
#
173210
# Platform specific setup
174211
#
@@ -215,6 +252,12 @@ jobs:
215252
SCCACHE_WEBDAV_USERNAME: ${{ secrets.WPI_ARTIFACTORY_USERNAME }}
216253
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.WPI_ARTIFACTORY_TOKEN }}
217254

255+
# install + test pure wheels here because this covers all platforms and they need
256+
# the meson wheels to run
257+
- name: Install and test pure wheels
258+
run: |
259+
python -m devtools ci install-test-pure-wheels
260+
218261
- name: Ensure all headers are accounted for
219262
run: |
220263
python -m devtools ci scan-headers
@@ -394,6 +437,12 @@ jobs:
394437
path: dist/
395438
merge-multiple: true
396439

440+
- uses: actions/download-artifact@v4
441+
with:
442+
pattern: pypi-pure
443+
path: dist/
444+
merge-multiple: true
445+
397446
- name: Publish to PyPI
398447
uses: pypa/gh-action-pypi-publish@release/v1
399448
with:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Next install dependencies using pip:
3333

3434
Then run these commands to build all the wheels for the current operating system.
3535

36+
./rdev.sh ci build-pure-wheels
3637
./rdev.sh ci build-other-wheels
3738
./rdev.sh ci build-meson-wheels
3839

devtools/__main__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,24 @@ def info(ctx: Context):
4747

4848
@main.command()
4949
@click.argument("package", required=False)
50+
@click.option("--test", default=False, is_flag=True)
5051
@click.pass_obj
51-
def develop(ctx: Context, package: str):
52+
def develop(ctx: Context, package: str, test: bool):
5253
"""Install robotpy packages in editable mode"""
5354
if package:
5455
for project in ctx.subprojects.values():
5556
if project.name == package:
5657
project.develop()
58+
if test:
59+
project.test()
5760
break
5861
else:
5962
raise click.BadParameter(f"invalid package {package}")
6063
else:
6164
for project in ctx.subprojects.values():
6265
project.develop()
66+
if test:
67+
project.test()
6368

6469

6570
@main.command()

devtools/ci.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def build_other_wheels(ctx: Context, no_test: bool):
6969
"""
7070

7171
for project in ctx.subprojects.values():
72-
if project.is_meson_project():
72+
if project.is_meson_project() or not project.is_native_project():
7373
continue
7474

7575
with ctx.handle_exception(project.name):
@@ -130,6 +130,34 @@ def build_meson_wheels(ctx: Context, no_test: bool, cross: T.Optional[str]):
130130
project.test(install_requirements=True)
131131

132132

133+
@ci.command()
134+
@click.pass_obj
135+
def build_pure_wheels(ctx: Context):
136+
for project in ctx.subprojects.values():
137+
if project.is_meson_project() or project.is_native_project():
138+
continue
139+
140+
ctx.install_build_deps(subproject=project)
141+
project.build_wheel(
142+
wheel_path=ctx.wheel_path,
143+
other_wheel_path=ctx.other_wheel_path,
144+
install=False,
145+
config_settings=[],
146+
)
147+
148+
149+
@ci.command()
150+
@click.pass_obj
151+
def install_test_pure_wheels(ctx: Context):
152+
for project in ctx.subprojects.values():
153+
if project.is_meson_project() or project.is_native_project():
154+
continue
155+
156+
with ctx.handle_exception(project.name):
157+
ctx.install_from_wheel(subproject=project)
158+
project.test(install_requirements=True)
159+
160+
133161
@ci.command()
134162
@click.pass_obj
135163
def scan_headers(ctx: Context):

devtools/ctx.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ def install_build_deps(
142142
*[str(req) for req in internal],
143143
)
144144

145+
def install_from_wheel(self, *, subproject: Subproject):
146+
self.run_pip(
147+
"install",
148+
"--no-index",
149+
"--find-links",
150+
str(self.wheel_path),
151+
"--find-links",
152+
str(self.other_wheel_path),
153+
subproject.pyproject_name,
154+
)
155+
145156
def run_pip(self, *args: str, cwd=None, installing_build_deps: bool = False):
146157
if installing_build_deps:
147158
python = self.build_python

devtools/subproject.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ def is_semiwrap_project(self) -> bool:
4444
def is_meson_project(self) -> bool:
4545
return (self.path / "meson.build").exists()
4646

47+
def is_native_project(self) -> bool:
48+
for req in self.build_requires:
49+
if req.name == "hatch-robotpy":
50+
return True
51+
52+
return False
53+
4754
#
4855
# Tasks
4956
#

devtools/update_pyproject.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ def update_requirements(self):
160160
def _update_maven(self, info: ProjectInfo):
161161
data = info.data
162162
iter = (
163-
data["tool"]["hatch"]["build"]["hooks"]
163+
data["tool"]["hatch"]["build"]
164+
.get("hooks", {})
164165
.get("robotpy", {})
165166
.get("maven_lib_download", [])
166167
)

docs/api.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,28 @@ These are special devices for use with the XRP product.
145145
:maxdepth: 1
146146

147147
xrp
148+
149+
.. _command_v2_api:
150+
151+
Commands V2 API
152+
---------------
153+
154+
Objects in this package allow you to implement a robot using the
155+
latest version of WPILib's Command-based programming. Command
156+
based programming is a design pattern to help you organize your
157+
robot programs, by organizing your robot program into components
158+
based on :class:`.Command` and :class:`.Subsystem`
159+
160+
Each one of the objects in the Command framework has detailed
161+
documentation available. If you need more information, for examples,
162+
tutorials, and other detailed information on programming your robot
163+
using this pattern, we recommend that you consult the Java version of the
164+
`FRC Control System documentation <https://docs.wpilib.org/en/latest/docs/software/commandbased/index.html>`_
165+
166+
167+
.. toctree::
168+
169+
commands2
170+
commands2.button
171+
commands2.cmd
172+
commands2.sysid

docs/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,9 @@
111111

112112
# XRP
113113
gen_package(root, "xrp")
114+
115+
# Commands
116+
gen_package(root, "commands2")
117+
gen_package(root, "commands2.button")
118+
gen_package(root, "commands2.cmd")
119+
gen_package(root, "commands2.sysid")

rdev.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,7 @@ robot = false
140140
[subprojects."robotpy-xrp"]
141141
py_version = "wrapper"
142142
robot = false
143+
144+
[subprojects."robotpy-commands-v2"]
145+
py_version = "wrapper"
146+
robot = true

0 commit comments

Comments
 (0)