Skip to content

Commit

Permalink
[vPDQ] Add vpdq/CONTRIBUTING.md (#1132)
Browse files Browse the repository at this point in the history
* Add contribution and reformat codes

* Update CONTRIBUTING.md

* PR update
  • Loading branch information
tigerchensh authored Aug 5, 2022
1 parent 3900239 commit 4c20727
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 42 deletions.
41 changes: 38 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Contributing to ThreatExchange
We want to make contributing to this project as easy and transparent as
possible.
If you would like to contribute to python-threatexchange, you can do the following:

[Fork][fork] the repo and then [clone][clone] it locally:

[fork]: https://help.github.com/articles/fork-a-repo/
[clone]: https://help.github.com/articles/which-remote-url-should-i-use/

git clone [email protected]:your-username/ThreatExchange

## Branch locally and develop!
Make a branch in your cloned fork. We suggest naming the branch by feature name
or “issue_XX” where XX is the issue number the branch is associated with. Make
your changes in your branch and test thoroughly. If this is a large feature you
can push your branch to your fork often. This allows you to request feedback for
how things are progressing instead of dumping a large code change all at once.

When making commits to your branch, make sure you write [well-formed][wf] commit
messages and update documentation accordingly (see the next section).

[wf]: https://github.com/erlang/otp/wiki/Writing-good-commit-messages

## Pull Requests
We actively welcome your pull requests.
Expand Down Expand Up @@ -28,4 +46,21 @@ outlined on that page and do not file a public issue.

## License
By contributing to ThreatExchange, you agree that your contributions will be licensed
under the LICENSE file in the root directory of this source tree.
under the LICENSE file in the root directory of this source tree.

## Documenting Changes
It is important to keep documentation up-to-date. Make sure to add and update
docstrings where appropriate.

## Submit a PR
Once you are happy with your changes and ready for a PR, you can submit a PR to
the main project. In most cases you’ll be looking to compare against the Main
branch, but there are instances where you’re making changes that you want to go
into a specific branch. Make sure when submitting your PR that you choose the
right destination branch.

Once you’ve submitted a PR you're waiting on us. In most cases we like to have
a core developer get some eyes on the code and the feature to make sure
there’s no general issues. They might require you to go back and make some more
changes (simply edit your local branch and push to the branch associated with
the PR; it will get updated automagically!) .
40 changes: 1 addition & 39 deletions python-threatexchange/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
# Contributing

If you would like to contribute to python-threatexchange, you can do the following:

[Fork][fork] the repo and then [clone][clone] it locally:

[fork]: https://help.github.com/articles/fork-a-repo/
[clone]: https://help.github.com/articles/which-remote-url-should-i-use/

git clone [email protected]:your-username/ThreatExchange

## Branch locally and develop!
Make a branch in your cloned fork. We suggest naming the branch by feature name
or “issue_XX” where XX is the issue number the branch is associated with. Make
your changes in your branch and test thoroughly. If this is a large feature you
can push your branch to your fork often. This allows you to request feedback for
how things are progressing instead of dumping a large code change all at once.

When making commits to your branch, make sure you write [well-formed][wf] commit
messages and update documentation accordingly (see the next section).

[wf]: https://github.com/erlang/otp/wiki/Writing-good-commit-messages

Please see [CONTRIBUTING](../CONTRIBUTING.md) for how to make contributions develop locally and open PRs
### Code Style
threatexchange uses [black](https://pypi.org/project/black/) for consistent formatting across
the projects python source files. After installing black locally, you can automatically
Expand All @@ -46,23 +25,6 @@ fastest way to do this is
make local_install
threatexchange --help

## Documenting Changes
It is important to keep documentation up-to-date. Make sure to add and update
docstrings where appropriate.

## Submit a PR
Once you are happy with your changes and ready for a PR, you can submit a PR to
the main project. In most cases you’ll be looking to compare against the Main
branch, but there are instances where you’re making changes that you want to go
into a specific branch. Make sure when submitting your PR that you choose the
right destination branch.

Once you’ve submitted a PR you're waiting on us. In most cases we like to have
a core developer get some eyes on the code and the feature to make sure
there’s no general issues. They might require you to go back and make some more
changes (simply edit your local branch and push to the branch associated with
the PR; it will get updated automagically!) .

## Releasing Changes
Releases of the library are managed by a [GitHub action](../.github/workflows/python-threatexchange-release.yaml),
triggered by changes to [version.txt](./version.txt). To create a new release to
Expand Down
58 changes: 58 additions & 0 deletions vpdq/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Contributing
Please see [CONTRIBUTING](../CONTRIBUTING.md) for how to make contributions develop locally and open PRs
### Code Style
vPDQ uses [black](https://pypi.org/project/black/) for consistent formatting across
the projects Python source files and clang-format for formatting CPP source files.
After installing black and clang-format locally, you can automatically format all the vPDQ files by running the following command from the repository root.

```shell
black ./vpdq/
find vpdq/ -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i
```

### Installing Locally
vPDQ has two parts of codes: CPP implementation and python-binding library.
To use vPDQ, ffmpeg is required(https://www.ffmpeg.org/download.html)

To cmake CPP binary files:
```
cd vpdq/cpp/
mkdir -p build
cd build
cmake ..
make
```
To locally install python-binding library:
```
cd vpdq
python vpdq-release.py -i
```

### Running Tests(depends on "Installing Locally")

To run the CPP regression test
```
cd vpdq/cpp/
python regtest.py
```

To run the python-binding library test
```
cd vpdq
py.test
```

## Build local distribution
To create local distribution:
```
cd vpdq
python vpdq-release.py -r
```
The local distribution files are located at vpdq/dist/

## Releasing Changes
Releases of the python-binding library are managed by a [GitHub action](../.github/workflows/vpdq-release.yaml),
triggered by changes to [version.txt](./version.txt). To create a new release to
[PyPI](https://pypi.org/project/vpdq/), update [version.txt](./version.txt)
to the new release name in a PR. Once the PR is approved and merges, the CI process
will publish the new version to PyPI, shortly after a test publish to Test PyPI.

0 comments on commit 4c20727

Please sign in to comment.