Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
DaVinci
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LHCb
DaVinci
Commits
6629e21d
Commit
6629e21d
authored
1 year ago
by
Eduardo Rodrigues
Committed by
Patrick Koppenburg
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add documentation on style, type hints and pre-commit hooks
parent
fe6bad57
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1103
Draft: Add AnalysisHelpers to DaVinci Stack
,
!925
Add documentation on style, type hints and pre-commit hooks
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/guide/developing.rst
+25
-2
25 additions, 2 deletions
doc/guide/developing.rst
with
25 additions
and
2 deletions
doc/guide/developing.rst
+
25
−
2
View file @
6629e21d
...
...
@@ -22,8 +22,31 @@ Alternatively, especially for small changes, a development environment can be bu
git lb-use DaVinci
Coding conventions
------------------
Coding conventions, style and type hints
----------------------------------------
Python code in the stack follows the `PEP8 guidelines <https://peps.python.org/pep-0008/>`_
and other general good practices:
* Include comments and documentation ("docstrings") when the intent of a line, function, class, or module is not obvious.
* Factor code into functions when there is repetition and/or for clarity.
* When modifying an existing file, following the conventions of the surrounding code.
Style and formatting checks are implemented in continuous integration (see subsection below)
via `pre-commit <https://pre-commit.com/>`_ hooks.
The following hooks are implemented: `Black`, `codespell`, `Flake8`, `pre-commit-hooks`, `pyupgrade`.
Refer to the repository `.pre-commit-config.yaml` for the actual implementation details.
Developers are encouraged to run the hooks locally prior to pushing to the repositories.
This is easily done with the following:
.. code-block:: bash
pre-commit install # only needed once to install pre-commit
pre-commit run --all-files # example to run all hooks on all files
Static typing (hints) is available in Python 3 and the offline stack now implements type hints and checking thereof.
Type hints are for now not compulsory but are strongly encouraged.
Tests and continuous integration
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment