Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 946 Bytes

CODING_CONVENTION.md

File metadata and controls

57 lines (37 loc) · 946 Bytes

Opinionated decisions

TODO:

pytest

DO

import pytest

@pytest.fixture
def my_ficture():
    ...

DONT

from pytest import fixture

@fixture
def my_ficture():
    ...

datetime

DO

from datetime import datetime, timedelta
delay = datetime.now() + timedelta(hours=1)

DONT

import datetime
delay = datetime.datetime.now() + datetime.timedelta(hours=1)

ALWAYS DO

from __future__ import annotations

Structure

(DIRACGrid#268)

  • __init__.py should not contain code, but __all__
  • at a package level (router for example) we have one file per system (configuration.py for example)
  • If we need more files (think of jobs, which have the sandbox, the joblogging, etc), we put them in a sub module (e.g routers.job). The code goes in a specific file (job.py, joblogging.py) but we use the the init.py to expose the specific file