We encourage contributions to the datasetinsights repo, including but not limited to following categories:
- You want to improve the documentation of existing module.
- You want to provide bug-fix for an outstanding issue.
- You want to implement a new feature to support new type of perception package outputs.
Here are some steps to setup datasetinsights virtual environment with on your machine:
- Install poetry, git and pre-commit
- Create a virtual environment. We recommend using miniconda
conda create -n dins-dev python=3.8
conda activate dins-dev
- Clone a copy of datasetinsights from source:
git clone https://github.com/Unity-Technologies/datasetinsights.git
cd datasetinsights
- Install datasetinsights in
develop
mode:
poetry install
This will symlink the Python files from the current local source tree into the installed virtual environment install.
The develop
mode also includes Python packages such as pytest and black.
- Install pre-commit hook to
.git
folder.
pre-commit install
# pre-commit installed at .git/hooks/pre-commit
Adding new Python dependencies to datasetinsights environment using poetry like:
poetry add numpy@^1.18.4
Make sure you only add the desired packages instead of adding all dependencies. Let package management system resolve for dependencies. See poetry add for detail instructions.
The datasetinsights package contains the following modules:
- commands This module contains the cli commands.
- datasets This module contains different datasets. The dataset classes contain knowledge on how the dataset should be loaded into memory.
- io This module contains functionality that relates to writing/downloading/uploading to/from different sources.
- stats This module contains code for visualizing and gathering statistics on the dataset
We use pytest to run tests located under tests/
. Run the entire test suite with
pytest
or run individual test files, like:
pytest tests/test_visual.py
for individual test suites.
We follow Black code style for this repository. The max line length is set at 80. We enforce this code style using Black to format Python code. In addition to Black, we use isort to sort Python imports.
Before submitting a pull request, run:
pre-commit run --all-files
Fix all issues that were highlighted by flake8. If you want to skip exceptions such as long url lines in docstring, add # noqa: E501 <describe reason>
for the specific line violation. See this to learn more about how to ignore flake8 errors.
Some editors support automatically formatting on save. For example, in vscode
Datasetinsights uses Google style for formatting docstrings. Length of line inside docstrings block must be limited to 80 characters with exceptions such as long urls or tables.
Follow instructions here.