mirror of
https://github.com/wassname/pytorch-lightning.git
synced 2026-09-09 11:32:07 +08:00
+36
-2
@@ -74,12 +74,46 @@ A lot of good work has already been done in project mechanics (requirements.txt,
|
||||
```
|
||||
autopep8 -v -r --max-line-length 120 --in-place .
|
||||
```
|
||||
3. Documentation is using [Napoleon formatting with Google style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
|
||||
|
||||
### Documentation
|
||||
|
||||
We are using Sphinx with Napoleon extension.
|
||||
Moreover we set Google style to follow with type convention.
|
||||
|
||||
- [Napoleon formatting with Google style](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)
|
||||
- [ReStructured Text (reST)](https://docs.pylonsproject.org/projects/docs-style-guide/)
|
||||
- [Paragraph-level markup](https://www.sphinx-doc.org/en/1.5/markup/para.html)
|
||||
|
||||
See following short example of a sample function taking one position string and optional
|
||||
|
||||
```python
|
||||
from typing import Optional
|
||||
|
||||
def my_func(param_a: int, param_b: Optional[float] = None) -> str:
|
||||
"""Sample function.
|
||||
|
||||
Args:
|
||||
param_a: first parameter
|
||||
param_b: second parameter
|
||||
|
||||
Return:
|
||||
sum of both numbers
|
||||
|
||||
Example:
|
||||
Sample doctest example...
|
||||
>>> my_func(1, 2)
|
||||
3
|
||||
|
||||
.. note:: If you want to add something.
|
||||
"""
|
||||
p = param_b if param_b else 0
|
||||
return str(param_a + p)
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
Test your work locally to speed up your work since so you can focus only in particular (failing) test-cases.
|
||||
To setup a local development environment, install both local and test dependecies:
|
||||
To setup a local development environment, install both local and test dependencies:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip install -r tests/requirements.txt
|
||||
|
||||
Reference in New Issue
Block a user