Skip to content

Commit 5ccf8ab

Browse files
authored
Merge pull request creativecommons#605 from Cronus1007/issue-604
added python guidelines for isort configurations
2 parents 45adcf0 + 60da7a2 commit 5ccf8ab

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

content/contributing-code/python-guidelines/contents.lr

+32
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ focus on the intent of the code and work together with a minimum of friction.
99
---
1010
body:
1111

12+
## Need of Guidelines
13+
14+
These Python Guidelines provides context to the developers who are new to the
15+
codebase and wishes to make any real-world contribution with
16+
`org:creativecommons` and be a part of the organization and learn new things
17+
with the organization.
1218

1319
## Code Formatting
1420

@@ -63,6 +69,32 @@ warning for [Whitespace before ':' (E203)][e203].
6369
[skipe203]: https://github.com/search?q=org%3Acreativecommons+%22noqa%3A+E203%22&type=code
6470
[flake8actions]: https://github.com/search?q=org%3Acreativecommons+%22pipenv+run+flake8%22&type=code
6571

72+
## Handling Imports
73+
74+
### Overview
75+
76+
All the imports in the Python code must be done via [isort][isort], a Python
77+
utility/library to sort imports alphabetically, and automatically separated
78+
into sections and by type.
79+
It provides a command line utility, Python library and
80+
[plugins for various editors](https://github.com/pycqa/isort/wiki/isort-Plugins)
81+
to quickly sort all your imports. It requires Python 3.6+ to run but
82+
supports formatting Python 2 code too.
83+
84+
[isort]: https://github.com/pycqa/isort
85+
86+
87+
### Configuration
88+
89+
There's a good `isort` config which one should follow while contributing
90+
in the Python projects of the creativecommons. These configurations should
91+
be a part of `pyproject.toml` labelled as `[tools.isort]`
92+
93+
- Isort Configuration (`pyproject.toml`): [GitHub Search · org:creativecommons
94+
filename:pyproject.toml][isortconfig]
95+
96+
[isortconfig]: https://github.com/search?q=org%3Acreativecommons+filename:pyproject.toml
97+
6698

6799
## Development Environment
68100

0 commit comments

Comments
 (0)