We welcome contributions of all kinds: code, documentation, feedback and support. If you use Meerkat in your work (blogs posts, research, company) and find it useful, spread the word!
This contribution borrows from and is heavily inspired by Huggingface transformers.
If you encounter any steps that are missing from this guide, we'd appreciate if you open an issue or a pull request to improve it.
There are 4 ways you can contribute:
- Issues: raising bugs, suggesting new features
- Fixes: resolving outstanding bugs
- Features: contributing new features
- Documentation: contributing documentation or examples
Do your best to follow these guidelines when submitting an issue or a feature request.
However, we actively encourage that you
- file an incomplete issue than no issue at all
- suggest a feature that you are not sure how to implement, and even if you're unsure if it's a good idea
If you are unsure about something, don't hesitate to ask.
First, we would really appreciate it if you could make sure the bug was not already reported (use the search bar on GitHub under Issues).
If you didn't find anything, please use the bug issue template to file a GitHub issue.
A world-class feature request addresses the following points:
- Motivation first:
- Is it related to a problem/frustration with the library? If so, please explain why. Providing a code snippet that demonstrates the problem is best.
- Is it related to something you would need for a project? We'd love to hear about it!
- Is it something you worked on and think could benefit the community? Awesome! Tell us what problem it solved for you.
- Write a full paragraph describing the feature;
- Provide a code snippet that demonstrates its future use;
- In case this is related to a paper, please attach a link;
- Attach any additional information (drawings, screenshots, etc.) you think may help.
If your issue is well written we're already 80% of the way there by the time you post it.
Before writing code, we strongly advise you to search through the existing PRs or issues to make sure that nobody is already working on the same thing. If you are unsure, it is always a good idea to open an issue to get some feedback.
You will need basic git
proficiency to be able to contribute to
meerkat
. git
is not the easiest tool to use but it has the greatest
manual. Type git --help
in a shell and enjoy. If you prefer books, Pro
Git is a very good reference.
Follow these steps to start contributing:
-
Fork the repository by clicking on the 'Fork' button on the repository's page. This creates a copy of the code under your GitHub user account.
-
Clone your fork to your local disk, and add the base repository as a remote:
$ git clone [email protected]:<your GitHub handle>/meerkat.git $ cd meerkat $ git remote add upstream https://github.com/hazyresearch/meerkat.git
-
Create a new branch off of the
main
branch to hold your development changes:$ git fetch upstream $ git checkout -b a-descriptive-name-for-my-changes upstream/dev
Do not work directly on the
main
branch. -
Meerkat manages dependencies using
setuptools
. From the base of themeerkat
repo, install the project in editable mode with all the extra dependencies with$ pip install -e ".[all]"
If meerkat was already installed in the virtual environment, remove it with
pip uninstall meerkat-ml
before reinstalling it in editable mode with the above command. -
Develop features on your branch.
As you work on the features, you should make sure that the test suite passes:
$ pytest
Meerkat relies on
black
andisort
to format its source code consistently. After you make changes, autoformat them with:$ make autoformat
Meerkat also uses
flake8
to check for coding mistakes. Quality control runs in CI, however you should also run the same checks with:$ make lint
Note: if you have a bunch of unused import warnings, you can run
autoflake --remove-all-unused-imports . -ri
to remove them. (You may need to pip install autoflake.)If you're modifying documents under
docs/source
, make sure to validate that they can still be built. This check also runs in CI. To run a local check make sure you have installed the documentation builder requirements, by runningpip install -r docs/requirements.txt
from the root of this repository and then run:$ make docs
You can use
pre-commit
to make sure you don't forget to format your code properly, the dependency should already be made available bysetuptools
.Just install
pre-commit
from the base of themeerkat
directory with$ pre-commit install
Once you're happy with your changes, add changed files using
git add
and make a commit withgit commit
to record your changes locally:$ git add modified_file.py $ git commit
Please write good commit messages.
It is a good idea to sync your copy of the code with the original repository regularly. This way you can quickly account for changes:
$ git fetch upstream $ git rebase upstream/dev
Push the changes to your account using:
$ git push -u origin a-descriptive-name-for-my-changes
-
Once you are satisfied (and the checklist below is done), go to the webpage of your fork on GitHub. Click on 'Pull request' to send your changes to the project maintainers for review.
Important: Ensure that the you create a pull request onto meerkat's
dev
branch. The drop down menus at the top of the "Open a pull request page" should lookbase repository: hazyresearch/meerkat base: main <- head repository: <your GitHub handle>/meerkat compare: <your branch name>
-
It's ok if maintainers ask you for changes. It happens to core contributors too! So everyone can see the changes in the Pull request, work in your local branch and push the changes to your fork. They will automatically appear in the pull request.
- The title of your pull request should be a summary of its contribution;
- If your pull request addresses an issue, please mention the issue number in the pull request description to make sure they are linked (and people consulting the issue know you are working on it);
- To indicate a work in progress please prefix the title with
[WIP]
. These are useful to avoid duplicated work, and to differentiate it from PRs ready to be merged; - Make sure existing tests pass;
- Add high-coverage tests.
- All public methods must have informative docstrings that work nicely with sphinx.
An extensive test suite is included to test the library behavior. Library tests can be found in the tests folder.
From the root of the
repository, here's how to run tests with pytest
for the library:
$ make test
You can specify a smaller set of tests in order to test only the feature you're working on.
Per the checklist above, all PRs should include high-coverage tests.
To produce a code coverage report, run the following pytest
pytest --cov-report term-missing,html --cov=meerkat .
This will populate a directory htmlcov
with an HTML report.
Open htmlcov/index.html
in a browser to view the report.
For documentation strings, Meerkat follows the google style.