Skip to content

Curt-Park/python-monorepo-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Monorepo Template

Python Monorepo Template with Pants.

Items

  • Small Python projects with dependency
  • Project execution
  • Formatting (black, isort)
  • Linting (flake8, pylint, pydocstyle)
  • Unit Test
  • Docker build
  • GitHub actions

Project Structure

.
└── libs
    ├── base   # base has add2(int, int)
    └── fancy  # fancy has add3(int, int, int) method which calls add2

Prerequisites

  • For Linux
curl --proto '=https' --tlsv1.2 -fsSL https://static.pantsbuild.org/setup/get-pants.sh | bash
  • For Mac
brew install pantsbuild/tap/pants

How to run

# How to execute
pants run libs/base/main.py
pants run libs/fancy/main.py

# How to format
pants fmt ::             # for all projects
pants fmt libs/base::    # for base
pants fmt libs/fancy::   # for fancy

# How to lint
pants lint ::            # for all projects
pants lint libs/base::   # for base
pants lint libs/fancy::  # for fancy

# How to run unit tests
pants test ::            # for all projects
pants test libs/base::   # for base
pants test libs/fancy::  # for fancy

# Build docker images
pants package docker/Dockerfile.base    # build base
pants package docker/Dockerfile.fancy   # build fancy

References