Development
Last updated
Last updated
This guide walks you through the workflow for developing new metrics in the SDMetrics library.
Have you defined your metric? Before you begin development, we recommend you read the guide, file an issue and wait for our feedback. This will prevent any throwaway work and help us release the metric faster.
Get your machine for local development.
on GitHub and then clone your fork locally
2. Install your local copy. We recommend using a virtual environment, such as virtualenv or conda.
3. Create a branch for local development
4. Now you can develop your metric locally on your branch.
Please thoroughly test and verify changes before making a pull request
Your new metric should include at least one associated test method. It's likely that you have multiple use cases or scenarios. Write a separate test method for each.
Each test should validate only the code that you wrote. If you are using another library, assume that it works properly when being passed the right values and use the mock
package to mock any random behavior. Do not read or write to any file system or database.
Write your unit tests inside the tests
folder, which contains the same hierarchy as sdmetrics
. Begin the filename with test_
. For example, if your metric code is written inside:
Then the corresponding unit tests should be written in:
Unit tests should use only the unittest
and pytest
modules. Each test method should start with the test_
prefix and have descriptive names about the scenario covered.
Your changes should also pass the existing tests and style checks in the library.
Check the style of your code using lint:
Run the full test suite:
Tip! During development, you can also run a subset of tests for convenience.
Run make test-all
to test all supported Python versions.
Get a full coverage report:
When you are done developing your metric and testing, you can make a pull request. This lets us know that your code is ready for review.
Make sure you've committed all changes to your branch and pushed it to GitHub
Then, you can make a pull request through the SDMetrics GitHub site.
Click the button below to make your pull request.
And that's it! A member of the core SDV team will review your changes and leave feedback on the pull request. Your code may require a few changes before it's ready to be merged.
The SDV open source team is a passionate but small group of maintainers. We appreciate your time and patience as we review your contributions! Feel free to reach out to us via your GItHub issue or Slack with any questions or concerns.