Skip to content

Latest commit

 

History

History
79 lines (54 loc) · 1.37 KB

CODING_CONVENTION.md

File metadata and controls

79 lines (54 loc) · 1.37 KB

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

SQL Alchemy

DO

class Owners(Base):
    __tablename__ = "Owners"
    owner_id = Column("OwnerID", Integer, primary_key=True, autoincrement=True)
    creation_time = DateNowColumn("CreationTime")
    name = Column("Name", String(255))

DONT

class Owners(Base):
    __tablename__ = "Owners"
    OwnerID = Column(Integer, primary_key=True, autoincrement=True)
    CreationTime = DateNowColumn()
    Name = Column(String(255))

Structure

(#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