Skip to content

Commit e959087

Browse files
committed
[WIP] Added CONTRIBUTING.md
1 parent 6325180 commit e959087

File tree

2 files changed

+150
-1
lines changed

2 files changed

+150
-1
lines changed

CONTRIBUTING.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Contributing to Torchvision
2+
3+
We want to make contributing to this project as easy and transparent as possible.
4+
5+
## TL;DR
6+
7+
We appreciate all contributions. If you are interested in contributing to Torchvision, there are many ways to help out.
8+
Your contributions may fall into the following categories:
9+
10+
- It helps the project if you could
11+
- Report issues you're facing
12+
- Give a :+1: on issues that others reported and that are relevant to you
13+
14+
- Answering queries on the issue tracker, investigating bugs are very valuable contributions to the project.
15+
16+
- You would like to improve the documentation. This is no less important than improving the library itself!
17+
If you find a typo in the documentation, do not hesitate to submit a GitHub pull request.
18+
19+
- If you are planning to contribute back bug-fixes, please do so without any further discussion.
20+
21+
- If you plan to contribute new features, utility functions or extensions, please first open an issue and discuss the feature with us.
22+
23+
## Issues
24+
25+
We use GitHub issues to track public bugs. Please ensure your description is
26+
clear and has sufficient instructions to be able to reproduce the issue.
27+
28+
## Development installation
29+
30+
### Install PyTorch Nightly
31+
32+
```bash
33+
conda install pytorch -c pytorch-nightly
34+
# or with pip (see https://pytorch.org/get-started/locally/)
35+
# pip install numpy
36+
# pip install --pre torch -f https://download.pytorch.org/whl/nightly/cu102/torch_nightly.html
37+
```
38+
39+
### Install Torchvision
40+
```bash
41+
git clone https://github.com/pytorch/vision.git
42+
cd vision
43+
python setup.py install
44+
# or, for OSX
45+
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
46+
# for C++ debugging, please use DEBUG=1
47+
# DEBUG=1 python setup.py install
48+
pip install flake8 typing mypy pytest scipy
49+
```
50+
You may also have to install `libpng-dev` and `libjpeg-turbo8-dev` libraries:
51+
```bash
52+
conda install libpng jpeg
53+
```
54+
55+
## Development Process
56+
57+
If you plan to modify the code or documentation, please follow the steps below:
58+
59+
1. Fork the repository and create your branch from `master`.
60+
2. If you have modified the code (new feature or bug-fix), please add unit tests.
61+
3. If you have changed APIs, update the documentation. Make sure the documentation builds.
62+
4. Ensure the test suite passes.
63+
5. Make sure your code passes `flake8` formatting check.
64+
65+
For more details about pull requests,
66+
please read [GitHub's guides](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).
67+
68+
If you would like to contribute a new model, please see [here](#New-model).
69+
70+
If you would like to contribute a new dataset, please see [here](#New-dataset).
71+
72+
### Code formatting and typing
73+
74+
New code should be compatible with Python 3.X versions and be compliant with PEP8. To check the codebase, please run
75+
```bash
76+
flake8 --config=setup.cfg .
77+
```
78+
79+
The codebase has type annotations, please make sure to add type hints if required. We use `mypy` tool for type checking:
80+
```bash
81+
mypy --config-file mypy.ini
82+
```
83+
84+
### Unit tests
85+
86+
If you have modified the code by adding a new feature or a bug-fix, please add unit tests for that. To run a specific
87+
test:
88+
```bash
89+
pytest test/<test-module.py> -vvv -k <test_myfunc>
90+
# e.g. pytest test/test_transforms.py -vvv -k test_crop
91+
```
92+
93+
If you would like to run all tests:
94+
```bash
95+
pytest test -vvv
96+
```
97+
98+
### Documentation
99+
100+
Torchvision uses [Google style](http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
101+
for formatting docstrings. Length of line inside docstrings block must be limited to 120 characters.
102+
103+
Please, follow the instructions to build and deploy the documentation locally.
104+
105+
#### Install requirements
106+
107+
```bash
108+
cd docs
109+
pip install -r requirements.txt
110+
```
111+
112+
#### Build
113+
114+
```bash
115+
cd docs
116+
make html
117+
```
118+
119+
#### Local deployment
120+
121+
Please, use python 3.X for the command below:
122+
```bash
123+
cd docs/build/html
124+
python -m http.server <port>
125+
# e.g. python -m http.server 1234
126+
```
127+
Then open the browser at `0.0.0.0:<port>` (e.g. `0.0.0.0:1234`)
128+
129+
### New model
130+
131+
TDB
132+
133+
### New dataset
134+
135+
TDB
136+
137+
### Pull Request
138+
139+
If all previous checks (flake8, mypy, unit tests) are passing, please send a PR. Submitted PR will pass other tests on
140+
different operation systems, python versions and hardwares.
141+
142+
For more details about pull requests workflow,
143+
please read [GitHub's guides](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).
144+
145+
## License
146+
147+
By contributing to Torchvision, you agree that your contributions will be licensed
148+
under the LICENSE file in the root directory of this source tree.

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ You can find the API documentation on the pytorch website: https://pytorch.org/d
136136

137137
Contributing
138138
============
139-
We appreciate all contributions. If you are planning to contribute back bug-fixes, please do so without any further discussion. If you plan to contribute new features, utility functions or extensions, please first open an issue and discuss the feature with us.
139+
140+
See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
140141

141142
Disclaimer on Datasets
142143
======================

0 commit comments

Comments
 (0)