Skip to content

Latest commit

 

History

History
46 lines (42 loc) · 3.78 KB

STYLEGUIDE.md

File metadata and controls

46 lines (42 loc) · 3.78 KB

Conda Style Guide

In an effort to decrease the context switching/learning barrier between the different projects within the Conda org, a standard set of code styles is defined. The intention of these guidelines is not to overburden or complicate the contribution process; if any style starts to become a burden, its inherent benefit should be reevaluated.

Policy Tooling
0
Use black (or darker for preexisting projects). black darker
1
Use isort. isort
2
Prefer f-strings over all other string formatting styles (e.g. str.format, c-style). flake8-use-fstring
3
Prefer pathlib over os.path. flake8-use-pathlib
4
Use typing (or gradually enforce for preexisting projects). flake8-annotations
4.1
Define typing aliases at the top of files.
4.2
Use TYPE_CHECKING import guard. flake8-typing-imports
5
Define loggers at the top of files.
6
Only use assert in tests. flake8-useless-assert
7
Use American English. flake8-spellcheck
7.1
Use inclusive language. See these other great resources for details:
7.2
Use descriptive variable names:
  • no one-char variables
  • avoid abbreviations
  • avoid overloading builtins
flake8-variables-names
8
When indicating a change that requires a future version of Python (or dropping a currently-supported version), use the following format:
# FUTURE: <minimum Python requirement>, <details>
e.g.:
# FUTURE: Python 3.9+, replace with ...
9
All public functions and module constants must include a docstring. flake8-docstrings docformatter
9.1
Module constants are documented using Sphinx autodoc syntax:
# before constant
#: The Answer to the Ultimate Question of Life
ANSWER = 42

# or inline
ANSWER = 42 #: Life
sphinx.ext.autodoc
Other Tooling
flake8-bugbear
flake8-simplify