Please search issue tracker before creating a new issue (problem or an improvement request). Feel free to add issues related to the project.
If you feel that you can fix or implement it yourself, please read a few paragraphs below to learn how to submit your changes.
tests/. You can skip this step if the effort to create tests for your change is unreasonable. Changes without tests are still going to be considered by us.
We will review your pull request as soon as possible. Thank you for contributing!
Get the latest development version. Fork and clone the repo:
$ git clone firstname.lastname@example.org:<your-username>/dvc.git
Make sure that you have Python 3.8 or higher installed. On macOS, we recommend
brew to install Python. For Windows, we recommend an official
pip version 20.3+ is required.
Install DVC in editable mode with
pip install -e ".[all,tests]". But before we
do that, we strongly recommend creating a
$ cd dvc $ python3 -m venv .env $ source .env/bin/activate $ pip install -e ".[all,tests]"
Install coding style pre-commit hooks with:
$ pip install pre-commit $ pre-commit install
That's it. You should be ready to make changes, run tests, and make commits! If you experience any problems, please don't hesitate to ping us in our chat.
We have unit tests in
tests/unit/ and functional tests in
Consider writing the former to ensure complicated functions and classes behave
For specific functionality, you will need to use functional tests alongside
pytest fixtures to create a temporary
directory, Git and/or DVC repo, and bootstrap some files. See the
docstring for some usage examples.
The simplest way to run tests:
$ cd dvc $ python -m tests
pytest to run the full test suite and report the result. At the very
end you should see something like this:
$ python -m tests ... ============= 434 passed, 6 skipped, 8 warnings in 131.43 seconds ==============
Otherwise, for each failed test you should see the following output, to help you identify the problem:
... [gw2] [ 84%] FAILED tests/unit/test_progress.py::TestProgressAware::test tests/unit/test_prompt.py::TestConfirm::test_eof tests/test_updater.py::TestUpdater::test ... =================================== FAILURES =================================== ____________________________ TestProgressAware.test ____________________________ ... ======== 1 failed, 433 passed, 6 skipped, 8 warnings in 137.49 seconds =========
You can pass any additional arguments to the script that will override the
To run a single test case:
$ python -m tests tests/func/test_metrics.py::TestCachedMetrics
To run a single test function:
$ python -m tests tests/unit/utils/test_fs.py::test_get_inode
To pass additional arguments:
$ python -m tests --pdb
This tests require additional effort to set up, so they are skipped by default. However, running code tests locally may be necessary when changing core source code.
Install requirements for whatever remotes you are going to test:
$ pip install -e ".[s3]" $ pip install -e ".[azure]" $ pip install -e ".[gdrive]" $ pip install -e ".[gs]" # or $ pip install -e ".[all]"
You will need to update your environment throughout subsequent steps, so we created a template for you:
$ cp tests/remotes_env.sample tests/remotes_env
Then uncomment the lines you need and fill in the values, the details are explained in remote-specific subsections. To activate these environment variables, use:
$ source tests/remotes_env
If one of your colleagues has already gone through this guide, you could just
ask for their
remotes_env file and Google Cloud credentials, and skip any env
(component): (short description) (long description) Fixes #(GitHub issue id).
remote: add support for Amazon S3 Fixes #123