Skip to content

Commit a32c4ef

Browse files
authored
Create CONTRIBUTING.md
1 parent a0772f0 commit a32c4ef

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

CONTRIBUTING.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
*This guideline is very much a work-in-progress.*
2+
3+
Contriubtions to `timm` for code, documentation, tests are more than welcome!
4+
5+
There haven't been any formal guidelines to date so please bear with me, and feel free to add to this guide.
6+
7+
# Code
8+
9+
Code linting and auto-format (black) are not currently in place but open to consideration. In the meantime, the style to follow is (mostly) aligned with Google's guide: https://google.github.io/styleguide/pyguide.html
10+
11+
A few specific differences from Google style (or black)
12+
1. Line length is 120 char. Going over is okay in some cases (e.g. I prefer not to break URL across lines).
13+
2. Hanging indents are always prefered, please avoid aligning arguments with closing brackets or braces.
14+
15+
Example, from Google guide, but this is a NO here:
16+
```
17+
# Aligned with opening delimiter.
18+
foo = long_function_name(var_one, var_two,
19+
var_three, var_four)
20+
meal = (spam,
21+
beans)
22+
23+
# Aligned with opening delimiter in a dictionary.
24+
foo = {
25+
'long_dictionary_key': value1 +
26+
value2,
27+
...
28+
}
29+
```
30+
This is YES:
31+
32+
```
33+
# 4-space hanging indent; nothing on first line,
34+
# closing parenthesis on a new line.
35+
foo = long_function_name(
36+
var_one, var_two, var_three,
37+
var_four
38+
)
39+
meal = (
40+
spam,
41+
beans,
42+
)
43+
44+
# 4-space hanging indent in a dictionary.
45+
foo = {
46+
'long_dictionary_key':
47+
long_dictionary_value,
48+
...
49+
}
50+
```
51+
52+
When there is descrepancy in a given source file (there are many origins for various bits of code and not all have been updated to what I consider current goal), please follow the style in a given file.
53+
54+
PR with pure formatting / style fixes will be accepted but only in isolation from functional changes, best to ask before starting such a change.
55+
56+
57+
# Documentation
58+
59+
As with code style, docstrings style based on the Google guide: guide: https://google.github.io/styleguide/pyguide.html
60+
61+
The goal for the code is to eventually move to have all major functions and `__init__` methods use PEP484 type annotations.
62+
63+
When type annotations are used for a function, as per the Google pyguide, they should **NOT** be duplicated in the docstrings, please leave annotations as the one source of truth re typing.
64+
65+
There are a LOT of gaps in current documentation relative to the functionality in timm, please, document away!
66+
67+
# Questions
68+
69+
If you have any questions about contribution, where / how to contribute, please ask in the Discussions (there is a `Contributing` topic).
70+
71+

0 commit comments

Comments
 (0)