Development Guides
Here are a set of detailed guides depending on if you are a public user, Stanford NAV Lab member, or a project maintainer reviewing pull requests or creating new release branches.
Standard GitHub Workflow
Fork gnss_lib_py (look for the “Fork” button), then clone your fork locally:
git clone https://github.com/<your username>/gnss_lib_py
If using poetry, follow the developer install instructions to install pyenv, poetry, and the python dependencies. If using
pip
orconda
for package management instead, usepip install -r requirements.txt
to install dependencies.Create a local branch:
git checkout -b your-name/name-of-your-bugfix-or-feature
Make changes locally and document them appropriately. See the Documentation section for more details.
If the feature branch includes new functionality, you must also:
update the “Code Organization” section of the
README.md
update the “Code Organization” section of
docs/source/index.rst
to match theREADME.md
add a section in the appropriate tutorial notebook located in
notebooks/tutorials/*
if the feature is in a new file, import the file in the module’s import block.
Add tests for the newly added code and ensure the new code is covered. See the Testing section for more details.
When you’re done making changes run all the tests with:
poetry run pytest
Make sure that all tests are passing.
Verify that testing coverage has not decreased:
poetry run pytest --cov=gnss_lib_py/algorithms --cov=gnss_lib_py/navdata --cov=gnss_lib_py/parsers --cov=gnss_lib_py/utils --cov=gnss_lib_py/visualizations --cov-report=html poetry run coverage report
See the Coverage Report section for more details.
Improve code readability by linting it. Run
pylint
to preview issues with the code:poetry run python -m pylint path-to-file-to-lint
Resolve issues that do not impact how you have implemented your functionality, such as conforming to snake case naming, removing TODOs and using suggested defaults.
Ensure that system and IDE dependent files, like those in
.idea
folders for PyCharm and.vscode
folders for VS Code are not committed by updating the.gitignore
file.Add your name to the contributors list.
Commit your changes and publish your branch to GitHub:
git add -A git commit -m "<describe changes in this commit>" git push origin your-name/name-of-your-bugfix-or-feature
Submit a pull request through GitHub. For the base branch in the pull request, select the latest version release branch
vX.Y.Z
(with the highest number of all such branches). Do not target themain
branch in your pull request. In the pull request, add a code review request for a current maintainer of the repository. The reviewers might add comments to ensure compliance with the rest of the code.
Pull Request Review Workflow
Change to the branch in review:
git checkout their-name/name-of-the-bugfix-or-feature
Update your local
poetry
environment to include any new dependencies that might have been added to poetry:poetry install
Review the changes and added code. Look for common sense errors, violated conventions or places where a better implementation is possible. If doing an in-depth review of an algorithm and related tests, verify the correctness of the math and that the tests make valid assumptions.
Verify that documentation is complete and updated if necessary. See the Documentation section for more details on what is expected.
If the feature branch included new functionality, the following should have also been updated:
the “Code Organization” section of the
README.md
the “Code Organization” section of
docs/source/index.rst
to match theREADME.md
the appropriate tutorial notebook located in
notebooks/tutorials/*
with a simple example of the new functionalityif a new file was created, it should likely be imported in the module’s import block.
Verify that all tests run on your system:
poetry run pytest
See the Testing section for more details.
Verify that all status checks are passing on GitHub. Treat failing status checks as failed tests, doc errors or linting issues, depending on the corresponding GitHub Action
Verify that testing coverage has not decreased:
poetry run pytest --cov=gnss_lib_py/algorithms --cov=gnss_lib_py/parsers --cov=gnss_lib_py/utils --cov-report=xml poetry run coverage report
See the Coverage Report section for more details.
Verify that the Pull Request targets the latest version release branch, called
vX.Y.Z
. If it doesn’t target this branch, change the base branch to the latest version release branch. If this branch doesn’t exist, create the latest version release branch frommain
before changing the base.Submit your approval or any comments on GitHub.
New Package Release Workflow
Switch to the latest version release branch (with the highest number):
git checkout -b vX.Y.Z
Open the
pyproject.toml
file and under the[tool.poetry]
group change theversion = X.Y.Z
variable to match the new package version number.Create a new pull request and merge to the
main
branch using the development process above.Go to the releases page on GitHub and click the
Draft a new release
button on the top. ClickChoose a tag
and add a new tag namedX.Y.Z
matching the new package version number. Target themain
branch. Finally, click thePublish release
button.Allow time for the release to build and then check pypi to ensure that the release was built successfully.