You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Some additions to the CONTRIBUTING guide
- how to run black if so desired
- install instructions for devs (following GH action)
- running tests
- minor fixups
If there is a guide on how to best add new models, it would be a good
idea to link it here, since I imagine this is what many contributors
would need most help with.
* [skip ci] empty commit to skip ci
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+46-5Lines changed: 46 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ Contriubtions to `timm` for code, documentation, tests are more than welcome!
4
4
5
5
There haven't been any formal guidelines to date so please bear with me, and feel free to add to this guide.
6
6
7
-
# Code
7
+
# Coding style
8
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
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
10
11
11
A few specific differences from Google style (or black)
12
12
1. Line length is 120 char. Going over is okay in some cases (e.g. I prefer not to break URL across lines).
@@ -51,8 +51,15 @@ This is YES:
51
51
52
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
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.
54
+
In general, if you add new code, formatting it with black using the following options should result in a style that is compatible with the rest of the code base:
55
+
56
+
```
57
+
black --skip-string-normalization --line-length 120 <path-to-file>
58
+
```
55
59
60
+
Avoid formatting code that is unrelated to your PR though.
61
+
62
+
PR with pure formatting / style fixes will be accepted but only in isolation from functional changes, best to ask before starting such a change.
56
63
57
64
# Documentation
58
65
@@ -64,8 +71,42 @@ When type annotations are used for a function, as per the Google pyguide, they s
64
71
65
72
There are a LOT of gaps in current documentation relative to the functionality in timm, please, document away!
66
73
67
-
# Questions
74
+
# Installation
68
75
69
-
If you have any questions about contribution, where / how to contribute, please ask in the Discussions (there is a `Contributing` topic).
76
+
Create a Python virtual environment using Python 3.10. Inside the environment, install the following test dependencies:
Since the whole test suite takes a lot of time to run locally (a few hours), you may want to select a subset of tests relating to the changes you made by using the `-k` option of [`pytest`](https://docs.pytest.org/en/7.1.x/example/markers.html#using-k-expr-to-select-tests-based-on-their-name). Moreover, running tests in parallel (in this example 4 processes) with the `-n` option may help:
101
+
102
+
```
103
+
pytest -k "substring-to-match" -n 4 tests/
104
+
```
105
+
106
+
## Building documentation
107
+
108
+
Please refer to [this document](https://github.com/huggingface/pytorch-image-models/tree/main/hfdocs).
109
+
110
+
# Questions
71
111
112
+
If you have any questions about contribution, where / how to contribute, please ask in the [Discussions](https://github.com/huggingface/pytorch-image-models/discussions/categories/contributing) (there is a `Contributing` topic).
0 commit comments