We want to make contributing to this project as easy and transparent as possible.
We actively welcome your pull requests.
- Fork the repo and create your branch from
main
. - If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.
- Ensure the test suite passes.
- Make sure your code lints.
- If you haven't already, complete the Contributor License Agreement ("CLA").
- In your editor, install the editorconfig extension which should ensure that you are following the same standards as us.
- Dynabench uses pre-commit hooks to ensure style consistency and prevent common mistakes. Enable it by:
pip install pre-commit && pre-commit install
After this pre-commit hooks will be run before every commit.
-
Read the editorconfig file to understand the exact coding style preferences.
-
Ideally, black and isort should be run via pre-commit hooks. But if for some reason you want to run black and isort separately follow this:
pip install black==22.3.0 isort==4.3.21
black ./(mmf|tests|tools)/**/*.py
isort -rc (mmf|tests|tools)
We are using yoyo-migrations tool to do our schema migrations in a systematic manner. By default, yoyo should run any pending migrations automatically to your database.
To add or update the database schema, you will have to create a new migration following these steps:
cd api
- Call
yoyo new ./migrations -m "Message describing your schema change"
- This will open up an editor with all of the previous dependency migrations already added.
In the
step
call inside the template, you will add two queries, first argument is the query you actually want to perform and second is the query to rollback your change. - Add your migration queries, save the file and exit the editor.
- yoyo should create a new migration script for your queries.
- Commit these, create a PR and next time anybody launches there server after the pull, migrations should get applied automatically.
An example of adding api_token
field to table users
looks like following:
"""
Add api_token to users
"""
from yoyo import step
__depends__ = {}
steps = [
step(
"ALTER TABLE users ADD COLUMN api_token VARCHAR(255)",
"ALTER TABLE users DROP COLUMN api_token",
)
]
You can read more on yoyo in its documentation.
NOTE: Don't do manual CUD queries to database anymore, this can leave yoyo in a weird state
In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Facebook's open source projects.
Complete your CLA here: https://code.facebook.com/cla
We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.
Facebook has a bounty program for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.
By contributing to dynabench, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree.