π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Update contrib guide (#207)
Dmytro Mishkine166b216686b
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rstindex 931fc2689..3a76deeda 100644--- a/CONTRIBUTING.rst+++ b/CONTRIBUTING.rst@@ -16,7 +16,7 @@ Everyone is welcomed to get involved with the project. There are different ways- Do a quick search first to see whether others reported a similar issue.- In case you find an unreported bug, please open a new ticket.- Try to provide as much information as possible. Some tips:-+- Clear title and description of the issue.- Explain how to reproduce the error.- Report your packages versions to facilitate the task.@@ -96,9 +96,34 @@ This section provides general guidance for developing code for the project. The- Add tests:- Tests are crucial and we expect you to write unit test for each of the functionalities that you implement.+ It is also a good idea to group the tests for functionalities++ .. code:: python++ class TestMyFunction:+ def test_smoke(self):+ # check defaults parameters, i/o shapes+ pass++ def test_feature_foo(self):+ # test basic functionality+ pass++ def test_feature_bar(self):+ # test another functionality+ pass++ def test_gradcheck(self):+ # test the functionality gradients+ pass++ def test_jit(self):+ # test the functionality using jit modules+ pass+- Tests should cover different devices (CPU and CUDA) and different input batch size. See an example:-.. code:: bash+ .. code:: python@pytest.mark.parametrize("device_type", ("cpu", "cuda"))@pytest.mark.parametrize("batch_size", [1, 2, 5])@@ -110,11 +135,43 @@ This section provides general guidance for developing code for the project. The- We give support to static type checker for Python >= 3.6- Please, read `MyPy cheatsheet <https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html#type-hints-cheat-sheet-python-3>`_ for Python 3.+ - It is recommended to use typing inside the function, when it would increase readability.+ - Always type function input and output, e.g.:++.. code:: python++ def homography_warp(patch_src: torch.Tensor,+ dst_homo_src: torch.Tensor,+ dsize: Tuple[int, int],+ mode: str = 'bilinear',+ padding_mode: str = 'zeros') -> torch.Tensor:- Format your code:- We follow `PEP8 style guide <https://www.python.org/dev/peps/pep-0008>`_.- - Use ``autopep`` to autoformat: https://pypi.org/project/autopep8/#id3+ - Use ``autopep`` to autoformat: https://pypi.org/project/autopep8/#id3 .+ For doing so, just run the following from the repository root++ .. code:: bash++ make autopep8++- Changes to PEP8:++ - Line length is 120 char.+ - W504 (line break after binary operator) is sometimes acceptable. E.g.++.. code:: python++ determinant = A[:, :, 0:1, 0:1] * A[:, :, 1:2, 1:2] -+ A[:, :, 0:1, 1:2] * A[:, :, 1:2, 0:1])++- Using 3rd party libraries:++ - Everything from standard library (https://docs.python.org/3/library/) and PyTorch (https://pytorch.org/) is OK.+ It does`t mean, that one should import urllib just because, but doing it when needed is fine.++Pull Request============diff --git a/setup.cfg b/setup.cfgindex e0d26149e..00a759ff1 100644--- a/setup.cfg+++ b/setup.cfg@@ -8,12 +8,12 @@ universal=1license_file = LICENSE[pep8]-max-line-length = 80+max-line-length = 120[flake8]-max-line-length = 80-ignore = F401,E402,F403,F811-exclude = venv+max-line-length = 120+ignore = E305,E402,E721,E722,E741,F401,F403,F405,F821,F841,F999,W605,F811+exclude = docs/src[coverage:report]exclude_lines =diff --git a/tox.ini b/tox.iniindex 7252336bb..680fc7458 100644--- a/tox.ini+++ b/tox.ini@@ -1,4 +1,4 @@[flake8]-max-line-length = 80+max-line-length = 120ignore = E305,E402,E721,E722,E741,F401,F403,F405,F821,F841,F999,W605,F811exclude = docs/src