Skip to content

iamhatesz/pyconpl-2025

Repository files navigation

Modern Python monorepos

A talk for PyCon PL 2025.

Examples to show

Project structure

Run:

make install

and:

make install-one package=data-access

Cross-package edits & parallel testing

Add to src/libs/data-access/src/data_access/db.py:

def add_user(user: User) -> User:
    # Persisting the user in the database
    return user

Add to src/apps/api/src/api/app.py:

@app.post("/users")
async def create_user(user: User) -> User:
    return add_user(user)

Scoped CI

Add to src/apps/api/src/api/app.py:

@app.get("/health")
async def health() -> str:
    return "OK"

Dependency check

Add to src/apps/api/src/api/app.py:

@app.get("/sum")
async def get_sum() -> int:
    return int(np.array([1, 2, 3]).sum())

Add to src/apps/api/tests/test_app.py:

def test_get_sum_returns_results(client: TestClient) -> None:
    response = client.get("/sum")
    assert response.status_code == 200
    assert response.text == "6"

Add numpy.

Remove the new endpoint.

About

The example repository from my presentation "Modern Python monorepos".

Resources

Stars

Watchers

Forks