Skip to content

Commit

Permalink
use uv workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverlambson committed Aug 21, 2024
1 parent 8e63524 commit b49929f
Show file tree
Hide file tree
Showing 23 changed files with 86 additions and 76 deletions.
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ WORKDIR /app
RUN chown bored-charts:bored-charts /app

COPY --chown=bored-charts uv.lock pyproject.toml ./
COPY --chown=bored-charts boredcharts/__init__.py ./boredcharts/__init__.py
RUN mkdir -p boredcharts/ && \
touch README.md && \
COPY --chown=bored-charts bored-charts/pyproject.toml ./bored-charts/pyproject.toml
COPY --chown=bored-charts bored-charts/src/boredcharts/__init__.py ./bored-charts/src/boredcharts/__init__.py
COPY --chown=bored-charts example/pyproject.toml ./example/pyproject.toml
COPY --chown=bored-charts example/src/bcexample/__init__.py ./example/src/bcexample/__init__.py
RUN touch README.md bored-charts/README.md example/README.md && \
uv sync --locked --no-dev

COPY --chown=bored-charts ./ /app/
Expand Down
3 changes: 3 additions & 0 deletions bored-charts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# bored-charts

Build easy, minimal, PDF-able data reports with markdown and python.
32 changes: 32 additions & 0 deletions bored-charts/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[project]
name = "bored-charts"
dynamic = ["version"]
description = "Easy, minimal, PDF-able data reports with python and markdown."
authors = [{ name = "Oliver Lambson", email = "[email protected]" }]
dependencies = [
"fastapi>=0.112.0",
"jinja2>=3.1.4",
"plotly>=5.23.0",
"pandas>=2.2.2",
"markdown>=3.6",
"markupsafe>=2.1.5",
"matplotlib>=3.9.2",
"mpld3>=0.5.10",
]
readme = "README.md"
license = "MIT"
requires-python = ">= 3.12"

[project.urls]
Repository = "https://github.com/oliverlambson/bored-charts.git"
Issues = "https://github.com/oliverlambson/bored-charts/issues"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.version]
path = "src/boredcharts/__init__.py"

[tool.hatch.build.targets.wheel]
packages = ["src/boredcharts"]
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
8 changes: 8 additions & 0 deletions bored-charts/src/boredcharts/static/plotlyjs.min.js

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion example/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# boredcharts example app
# bored-charts example app
10 changes: 10 additions & 0 deletions example/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[project]
name = "bored-charts-example"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = ["bored-charts", "uvicorn>=0.30.5"]

[project.scripts]
bc-example = "bcexample.app:entrypoint"
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions example/figures.py → example/src/bcexample/figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import matplotlib.pyplot as plt
import numpy as np
import plotly.express as px
from boredcharts.jinja import to_html
from fastapi import APIRouter
from fastapi.responses import HTMLResponse
from plotly.graph_objects import Figure

from boredcharts.jinja import to_html

router = APIRouter()


Expand Down
File renamed without changes.
44 changes: 5 additions & 39 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,5 @@
[project]
name = "bored-charts"
dynamic = ["version"]
description = "Easy, minimal, PDF-able data reports with python and markdown."
authors = [{ name = "Oliver Lambson", email = "[email protected]" }]
dependencies = [
"fastapi>=0.112.0",
"jinja2>=3.1.4",
"uvicorn>=0.30.5",
"plotly>=5.23.0",
"pandas>=2.2.2",
"markdown>=3.6",
"markupsafe>=2.1.5",
"matplotlib>=3.9.2",
"mpld3>=0.5.10",
]
readme = "README.md"
license = "MIT"
requires-python = ">= 3.12"

[project.urls]
Repository = "https://github.com/oliverlambson/bored-charts.git"
Issues = "https://github.com/oliverlambson/bored-charts/issues"

[project.scripts]
bc-example = "example.app:entrypoint"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.version]
path = "boredcharts/__init__.py"

[tool.hatch.build.targets.wheel]
packages = ["boredcharts"]
[tool.uv.workspace]
members = ["bored-charts", "example"]

[tool.uv]
dev-dependencies = [
Expand All @@ -52,6 +15,9 @@ dev-dependencies = [
"djlint>=1.34.1",
]

[tool.uv.sources]
bored-charts = { workspace = true }

[tool.pytest.ini_options]
addopts = "--doctest-modules"

Expand Down
3 changes: 1 addition & 2 deletions tests/test_routes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from pathlib import Path

from boredcharts.webapp import boredcharts
from fastapi import APIRouter
from fastapi.testclient import TestClient

from boredcharts.webapp import boredcharts


def test_healthz() -> None:
client = TestClient(
Expand Down
49 changes: 20 additions & 29 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b49929f

Please sign in to comment.