Skip to content

Commit 98326ab

Browse files
Add versioned dev_requirements for py 3.8 3.9 3.10
Different version of python have different dev requirements. Previously, `dev_requirements.txt` was generated for python3.8 and assumed to work for other versions of python. That was more or less a safe assumption, except is now causing problems. Specifically, gtsam is not available on python 3.10, but we'd like to add it as a dev requirement for python 3.8 and 3.9. `symforce_requirements_test.py` cannot be run until symforce has been installed, but one might reasonably want to `pip install -r dev_requirements.txt` before installing symforce (to use the pinned build depencies during installation). To make this circular dependency less painful for the user, I'm adding - `dev_requirements_38.txt` - `dev_requirements_39.txt` - `dev_requirements_310.txt` so that the correct dev requirements can be installed before symforce installation for any supported python version. Modified `test/symforce_requirements_test.py` to only test/update the `dev_requirements_XY.txt` of the python version being used. Since the public CI is already running this test, it will guarentee that none of these files will go out of date. Needed to amend both ci.yml and docs.yml to use the correct `dev_requirements_XY.txt`. Also needed to update the `README.md` accordingly.
1 parent 559e521 commit 98326ab

File tree

7 files changed

+760
-11
lines changed

7 files changed

+760
-11
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
libeigen3-dev
7676
7777
- name: Install python dependencies
78-
run: pip install -r dev_requirements.txt
78+
run: pip install -r dev_requirements_$(${{ matrix.python }} -c 'import sys; print(f"{sys.version_info.major}{sys.version_info.minor}")').txt
7979

8080
- name: Run cmake build
8181
run: |
@@ -87,14 +87,11 @@ jobs:
8787
cmake --build build -j $(nproc)
8888
8989
# - lcmtypes need to be available for tests
90-
# - Exact contents of dev_requirements.txt depend on python version. Need to update file to
91-
# match current python version to avoid failure of corresponding gen test. symforce needs
92-
# to be on the PYTHONPATH to run gen test in this manner.
90+
# - symforce needs to be on the PYTHONPATH to run tests in this manner.
9391
- name: Run tests
9492
run: |
9593
pip install build/lcmtypes/python2.7
9694
export PYTHONPATH=$PYTHONPATH:$(pwd)
97-
${{ matrix.python }} test/symforce_requirements_test.py --update
9895
ctest --test-dir build -j $(nproc) || true
9996
ctest --test-dir build -j $(nproc) --rerun-failed --output-on-failure
10097

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
pandoc
2424
2525
- name: Install python dependencies
26-
run: pip install -r dev_requirements.txt
26+
run: pip install -r dev_requirements_$(python3 -c 'import sys; print(f"{sys.version_info.major}{sys.version_info.minor}")').txt
2727

2828
- name: Run cmake build
2929
run: |

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ pip install -e .
565565

566566
This will build the C++ components of SymForce, but you won't be able to run `pip install -e .` repeatedly if you need to rebuild C++ code. If you're changing C++ code and rebuilding, you should build with CMake directly as described <a href="#build-with-cmake">below</a>.
567567

568-
`pip install .` will not install pinned versions of SymForce's dependencies, it'll install any compatible versions. It also won't install all packages required to run all of the SymForce tests and build all of the targets (e.g. building the docs or running the linters). If you want all packages required for that, you should `pip install .[dev]` instead (or one of the other groups of extra requirements in our `setup.py`). If you additionally want pinned versions of our dependencies, which are the exact versions guaranteed by CI to pass all of our tests, you can install them from `pip install -r dev_requirements.txt`.
568+
`pip install .` will not install pinned versions of SymForce's dependencies, it'll install any compatible versions. It also won't install all packages required to run all of the SymForce tests and build all of the targets (e.g. building the docs or running the linters). If you want all packages required for that, you should `pip install .[dev]` instead (or one of the other groups of extra requirements in our `setup.py`). If you additionally want pinned versions of our dependencies, which are the exact versions guaranteed by CI to pass all of our tests, you can install them from `pip install -r dev_requirements_XY.txt` (where `X` and `Y` are the major and minor versions of your python; e.g. `dev_requirements_38.txt` for python3.8).
569569

570570
## Build with CMake
571571

@@ -574,8 +574,9 @@ SymForce into your Python environment, so you'll need to add it to your PYTHONPA
574574

575575
Install python requirements:
576576
```bash
577-
pip install -r dev_requirements.txt
577+
pip install -r dev_requirements_38.txt
578578
```
579+
(or `dev_requirements_39.txt`/`dev_requirements_310.txt` for python3.9 and python3.10, respectively).
579580

580581
Build SymForce (requires C++14 or later):
581582
```bash

0 commit comments

Comments
 (0)