Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit e302802

Browse files
authored
Merge pull request #164 from datafold/erezsh-contributing
Create CONTRIBUTING.md
2 parents 9bb9093 + 3b493bd commit e302802

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

CONTRIBUTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Contributing to data-diff
2+
3+
Contributions are very welcome! We'll be happy to help you in the process.
4+
5+
## What should I know before I get started?
6+
7+
Go through the README and the documentation, and make sure that you understand how data-diff works.
8+
9+
## How to contribute?
10+
11+
### Reporting bugs
12+
13+
Please report the bug with as many details as you can.
14+
15+
1. Include the exact command that you used. Make sure to run data-diff with the `-d` flag for debug output.
16+
2. Provide the entire output of the command. (stdout, logs, exception)
17+
3. If possible, show us how we could reproduce the bug. i.e. how to set up an environment in which it occurs.
18+
19+
(When pasting, always make sure to redact sensitive information, like passwords.)
20+
21+
If data-diff returns incorrect results, i.e. false-positive or false-negative, please also include the original values.
22+
23+
Before you report a bug, make sure it doesn't already exist.
24+
25+
See [issues](/datafold/data-diff/issues/).
26+
27+
### Suggesting Enhancements
28+
29+
We are always interested to hear about how we can make data-diff better!
30+
31+
If you'd like us to support a new database, you should open an issue for it, if there isn't one already. If it already exists, make sure to vote for it with a :thumbsup:, to help us priortize it.
32+
33+
The same goes for other technical requests, like missing features, or gaps in the documentation.
34+
35+
See [issues](/datafold/data-diff/issues/).
36+
37+
For questions, and non-technical discussions, see [discussions](/datafold/data-diff/discussions).
38+
39+
### Contributing code
40+
41+
#### Code style
42+
43+
All code should be formatted with `black -l 120`.
44+
45+
When in doubt, use the existing code as a guideline, or ask.
46+
47+
#### Get started (setup)
48+
49+
To get started, first clone the repository. For example `git clone https://github.com/datafold/data-diff`.
50+
51+
Once inside, you can install the dependencies.
52+
53+
- Option 1: Run `poetry install` to install them in a virtual env. You can then run data-diff using `poetry run data-diff ...` .
54+
55+
- Option 2: Run `pip install -e .` to install them, and data-diff, in the global context.
56+
57+
At the bare minimum, you need MySQL to run the tests.
58+
59+
You can create a local MySQL instance using `docker-compose up mysql`. The URI for it will be `mysql://mysql:Password1@localhost/mysql`. If you're using a different server, make sure to update `TEST_MYSQL_CONN_STRING` in `tests/common.py`. For your convenience, we recommend creating `tests/local_settings.py`, and to override the value there.
60+
61+
You can also run a few servers at once. For example `docker-compose up mysql postgres presto`.
62+
63+
Make sure to update the appropriate `TEST_*_CONN_STRING`, so that it will be included in the tests.
64+
65+
#### Run the tests
66+
67+
You can run the tests with `unittest`.
68+
69+
When running against multiple databases, the tests can take a long while.
70+
71+
To save time, we recommend running them with `unittest-parallel`.
72+
73+
When debugging, we recommend using the `-f` flag, to stop on error. Also, use the `-k` flag to run only the individual test that you're trying to fix.
74+
75+
#### Implementing a new database.
76+
77+
New databases should be added as a new module in the `data-diff/databases/` folder.
78+
79+
Make sure to update the `DATABASE_TYPES` dictionary in `tests/test_database_types.py`, so that it will be included in the tests.
80+
81+
If possible, please also add the database setup to `docker-compose.yml`, so that we can run and test it for ourselves. If you do, also update the CI (`ci.yml`).

0 commit comments

Comments
 (0)