Skip to content

Commit

Permalink
[torchcodec] Add contributing guide (#66)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #66

I copied the relevant sections from torchvision:

https://github.com/pytorch/vision/blob/main/CONTRIBUTING.md

Reviewed By: NicolasHug

Differential Revision: D59344144

fbshipit-source-id: ad0bf8dc8a496ad9b88f4fc57f050b00b53f31fe
  • Loading branch information
ahmadsharif1 authored and facebook-github-bot committed Jul 9, 2024
1 parent d69971b commit 8d7c088
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Contributing to TorchCodec

You can contribute to this project by writing code, fixing issues or simply by
using the library and reporting your feedback.

## Development installation

### Dependencies

Start by installing the **nightly** build of PyTorch following the
[official instructions](https://pytorch.org/get-started/locally/). Note that the
official instructions may ask you to install TorchCodec itself. If you are doing
development on TorchCodec, you should not install prebuilt TorchCodec packages.

To build, run and test locally you will need the following packages
(dependencies):

1. C++ compiler+linker (g++) and C++ runtime library (libstdc++). This is
typically available on a baseline Linux installation already.
1. python
1. cmake
1. pkg-config
1. libtorch (this is part of Pytorch)
1. ffmpeg
1. pytest (for testing)

You can install these using your favorite package manager. Example, for conda
use:

```bash
# After installing the nightly pytorch version run this:
conda install cmake pkg-config ffmpeg pytest -c conda-forge
```

### Clone and build torchcodec

```bash
git clone https://github.com/pytorch-labs/torchcodec.git
cd torchcodec

pip install -e ".[dev]" --no-build-isolation -vv

# This should decode the sample video and generate a png file that is a frame in the video.
python test/decoders/manual_smoke_test.py
```

### Running unit tests

To run python tests run:

```bash
pytest test -vvv
```

To run C++ tests run:

```bash
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=1 -DCMAKE_PREFIX_PATH=$(python3 -c 'import torch;print(torch.utils.cmake_prefix_path)) ..
cmake --build . -- VERBOSE=1
ctest --rerun-failed --output-on-failure
```
## Development Process
TBD
### Code formatting and typing
TBD
## License
By contributing to TorchCodec, you agree that your contributions will be
licensed under the LICENSE file in the root directory of this source tree.
Contributors are also required to
[sign our Contributor License Agreement](https://code.facebook.com/cla).

0 comments on commit 8d7c088

Please sign in to comment.