From 6a8fad60a32942e843a70d18b17b58bfcdac80e1 Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 20:43:02 +0900 Subject: [PATCH 1/9] docs: todos README.md --- src/todos/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/todos/README.md b/src/todos/README.md index 3b97a70..6cc394c 100644 --- a/src/todos/README.md +++ b/src/todos/README.md @@ -1,5 +1,8 @@ # :bookmark: My Little Todo App -![test](https://github.com/github/docs/actions/workflows/todos.yml/badge.svg) +

+ FastAPI + Todos CI/CD +

This project includes the simple CRUD todo API sources. The API defines with [FastAPI](https://fastapi.tiangolo.com/). @@ -82,4 +85,7 @@ $ make docker-build # Run docker container with Dockerfile in this project $ make docker-run + +# Push docker image to repository (need to sign in docker hub) +$ REPOSITORY_NAME=*** make docker-push ``` From 2b711daa3daae4bb25a250e8f2388e5768501605 Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 21:00:04 +0900 Subject: [PATCH 2/9] docs: update TODO docs --- src/todos/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/todos/README.md b/src/todos/README.md index 6cc394c..d8a9a01 100644 --- a/src/todos/README.md +++ b/src/todos/README.md @@ -1,13 +1,17 @@ # :bookmark: My Little Todo App

FastAPI + Swagger + Docker +

+

Todos CI/CD

This project includes the simple CRUD todo API sources. The API defines with [FastAPI](https://fastapi.tiangolo.com/). -## How to use +## How to run & use ### :one: Run the app server ```bash # Run main.py @@ -71,7 +75,6 @@ $ curl -X 'DELETE' \ -H 'accept: application/json' ``` - ## ETC ```bash # Formatting codes in this project From f4aa41c966e13e602bf13d0e7bfb8bf397e921df Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 22:32:35 +0900 Subject: [PATCH 3/9] docs: update main README.md --- README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fe184ad..2ed3d50 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,89 @@ -# example-python-monorepo-with-pants - -## Items -- [x] Pants settings -- [x] 3rdparty setting -- [x] linting/formatting setting -- [ ] `grid_maker` - logic -- [ ] `grid_maker` - add docstrings -- [ ] `grid_maker` - test -- [ ] `grid_maker` - Docker -- [ ] `grid_maker` - CI/CD +# My Little Monorepo with Pants +

+ Python + + Ruff + + + Black + + + Docformatter + +

+ +Welcome to "My Little Monorepo with Pants" - +This repository contains an example of a monorepo with Python which utilizes a powerful tool, called [Pants](https://github.com/pantsbuild/pants). Feel free to explore, experiment, and adapt the practices demonstrated here to meet your specific development needs. Whether you're new to monorepos or Pants, this repository aims to be a valuable resource for enhancing your development workflow. 🚀✨ + +## Repository Highlights +* **Pants**: This repository is built on the _**Pants**_ build system. It not only utilizes Pants for code execution but also for various tasks like code formatting, linting, and testing. Additionally, Pants is employed for building and pushing container images (with Docker), as well as managing dependencies. + +* **Simple API Example**: Explore a straightforward CRUD API implemented with [FastAPI](https://github.com/tiangolo/fastapi). This example can be instrumental in understanding Python monorepo concepts. +* **Automated Build**: A streamlined continuous integration (CI) and continuous delivery (CD) process is in place, automated through [GitHub Actions](https://docs.github.com/en/actions). + +## Core Pants Goals +* [run](https://www.pantsbuild.org/docs/python-run-goal): run an executable or script. +* [test](https://www.pantsbuild.org/docs/python-test-goal): run tests with Pytest. +* [fmt](https://www.pantsbuild.org/docs/python-fmt-goal): autoformat source code. +* [lint](https://www.pantsbuild.org/docs/python-lint-goal): lint source code in check-only mode. +* [check](https://www.pantsbuild.org/docs/python-check-goal): run MyPy. +* [repl](https://www.pantsbuild.org/docs/python-repl-goal): open a REPL (standard shell or IPython). +* [package](https://www.pantsbuild.org/docs/python-package-goal): package your code into an asset, e.g. a wheel or a PEX file. +* [publish](https://www.pantsbuild.org/docs/python-publish-goal): how to distribute packages to a repository + + +## Repository Structure +```bash +./ +├── 3rdparty/ +│ ├── BUILD +│ ├── black-requirements.txt +│ ├── black.lock +│ ├── coverage-py-requirements.txt +│ ├── coverage-py.lock +│ ├── docformatter-requirements.txt +│ ├── docformatter.lock +│ ├── pytest-requirements.txt +│ ├── pytest.lock +│ ├── python-default.lock +│ ├── python-requirements.txt +│ ├── ruff-requirements.txt +│ └── ruff.lock +├── BUILD +├── LICENSE +├── README.md +├── pants.ci.toml +├── pants.toml +├── pyproject.toml +├── src/ +│ └── todos/ +│ ├── BUILD +│ ├── Dockerfile +│ ├── Makefile +│ ├── README.md +│ ├── apps/ +│ │ ├── BUILD +│ │ ├── monitor.py +│ │ └── v1/ +│ │ ├── BUILD +│ │ └── todos.py +│ ├── main.py +│ └── models/ +│ └── v1/ +│ ├── BUILD +│ └── todos.py +└── tests/ + └── src/ + └── todos/ + └── apps/ + ├── BUILD + ├── monitor_test.py + └── v1/ + ├── BUILD + └── todos_test.py +``` + +## References +* https://www.pantsbuild.org/ +* https://github.com/pantsbuild/actions +* https://github.com/pantsbuild/example-python From ca85af657fc335d561a7207dcf19e743e6600b2b Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 22:38:31 +0900 Subject: [PATCH 4/9] docs: enhance contents --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2ed3d50..7228c8c 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,10 @@

Welcome to "My Little Monorepo with Pants" - -This repository contains an example of a monorepo with Python which utilizes a powerful tool, called [Pants](https://github.com/pantsbuild/pants). Feel free to explore, experiment, and adapt the practices demonstrated here to meet your specific development needs. Whether you're new to monorepos or Pants, this repository aims to be a valuable resource for enhancing your development workflow. 🚀✨ +This repository contains an example of a monorepo with Python which utilizes a powerful tool, called [Pants](https://www.pantsbuild.org/). Feel free to explore, experiment, and adapt the practices demonstrated here to meet your specific development needs. Whether you're new to monorepos or Pants, this repository aims to be a valuable resource for enhancing your development workflow. 🚀✨ ## Repository Highlights -* **Pants**: This repository is built on the _**Pants**_ build system. It not only utilizes Pants for code execution but also for various tasks like code formatting, linting, and testing. Additionally, Pants is employed for building and pushing container images (with Docker), as well as managing dependencies. +* **Pants**: This repository is built on the _**Pants**_ build system. It not only utilizes Pants for code execution but also for various tasks like code formatting, linting, and testing. Additionally, Pants is employed for building and pushing container images (with [Docker](https://docs.docker.com/), as well as managing dependencies. * **Simple API Example**: Explore a straightforward CRUD API implemented with [FastAPI](https://github.com/tiangolo/fastapi). This example can be instrumental in understanding Python monorepo concepts. * **Automated Build**: A streamlined continuous integration (CI) and continuous delivery (CD) process is in place, automated through [GitHub Actions](https://docs.github.com/en/actions). @@ -87,3 +87,5 @@ This repository contains an example of a monorepo with Python which utilizes a p * https://www.pantsbuild.org/ * https://github.com/pantsbuild/actions * https://github.com/pantsbuild/example-python +* https://blog.pantsbuild.org/pants-pex-and-docker/ +* https://blog.pantsbuild.org/optimizing-python-docker-deploys-using-pants/ From bddb1fe6418684d4ea3b741d0afece88a4275d25 Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 22:39:16 +0900 Subject: [PATCH 5/9] docs: typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7228c8c..069883b 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Welcome to "My Little Monorepo with Pants" - This repository contains an example of a monorepo with Python which utilizes a powerful tool, called [Pants](https://www.pantsbuild.org/). Feel free to explore, experiment, and adapt the practices demonstrated here to meet your specific development needs. Whether you're new to monorepos or Pants, this repository aims to be a valuable resource for enhancing your development workflow. 🚀✨ ## Repository Highlights -* **Pants**: This repository is built on the _**Pants**_ build system. It not only utilizes Pants for code execution but also for various tasks like code formatting, linting, and testing. Additionally, Pants is employed for building and pushing container images (with [Docker](https://docs.docker.com/), as well as managing dependencies. +* **Pants**: This repository is built on the _**Pants**_ build system. It not only utilizes Pants for code execution but also for various tasks like code formatting, linting, and testing. Additionally, Pants is employed for building and pushing container images (with [Docker](https://docs.docker.com/)), as well as managing dependencies. * **Simple API Example**: Explore a straightforward CRUD API implemented with [FastAPI](https://github.com/tiangolo/fastapi). This example can be instrumental in understanding Python monorepo concepts. * **Automated Build**: A streamlined continuous integration (CI) and continuous delivery (CD) process is in place, automated through [GitHub Actions](https://docs.github.com/en/actions). From 037de9748b6478ac1b08ff177df690ec277ca7bf Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 22:42:37 +0900 Subject: [PATCH 6/9] docs: change badge style --- src/todos/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/todos/README.md b/src/todos/README.md index d8a9a01..bf14848 100644 --- a/src/todos/README.md +++ b/src/todos/README.md @@ -1,8 +1,7 @@ # :bookmark: My Little Todo App

- FastAPI - Swagger - Docker + FastAPI + Docker

Todos CI/CD From 0ba4a6874c7090086761364f8edfdb1fd99b9883 Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 22:43:05 +0900 Subject: [PATCH 7/9] docs: change badge position --- src/todos/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/todos/README.md b/src/todos/README.md index bf14848..c6f8e09 100644 --- a/src/todos/README.md +++ b/src/todos/README.md @@ -2,8 +2,6 @@

FastAPI Docker -

-

Todos CI/CD

From 88de1f6bdc1df8d07ffe308469716adf9856fca7 Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 22:44:35 +0900 Subject: [PATCH 8/9] docs: typo --- src/todos/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/todos/README.md b/src/todos/README.md index c6f8e09..66521f0 100644 --- a/src/todos/README.md +++ b/src/todos/README.md @@ -86,6 +86,6 @@ $ make docker-build # Run docker container with Dockerfile in this project $ make docker-run -# Push docker image to repository (need to sign in docker hub) +# Push docker image to a repository (need to sign in docker hub) $ REPOSITORY_NAME=*** make docker-push ``` From 464a3c2f982b8053a11d5b1c68ffcef1cc48f514 Mon Sep 17 00:00:00 2001 From: Eunseo Kim Date: Sun, 7 Jan 2024 22:49:25 +0900 Subject: [PATCH 9/9] docs: make good sentence --- src/todos/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/todos/README.md b/src/todos/README.md index 66521f0..26684c4 100644 --- a/src/todos/README.md +++ b/src/todos/README.md @@ -5,8 +5,7 @@ Todos CI/CD

-This project includes the simple CRUD todo API sources. -The API defines with [FastAPI](https://fastapi.tiangolo.com/). +This project encompasses the source code for a straightforward CRUD todo API, defined using [FastAPI](https://fastapi.tiangolo.com/). ## How to run & use ### :one: Run the app server