Skip to content

Commit

Permalink
makes app and cli, bumps prefect
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbhughes committed Jun 21, 2024
1 parent 2d613e3 commit 14b1a25
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.PRIVATE_SSH_KEY }}'
python -m pip install --upgrade pip
pip install ".[dev]"
pip install ".[test]"
- name: Lint with flake8
run: |
ruff check .
Expand Down
12 changes: 12 additions & 0 deletions punchpipe/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import click
from waitress import serve
import subprocess

from .monitor.app import server

@click.command
def run():
print("Launching punchpipe monitor on http://localhost:8050/.")
subprocess.Popen(["prefect", "server", "start"])
serve(server, host='0.0.0.0', port=8050)
print("\npunchpipe Prefect flows must be stopped manually in Prefect.")
52 changes: 29 additions & 23 deletions punchpipe/monitor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import pandas as pd
import plotly.express as px
from dash import Dash, Input, Output, dash_table, dcc, html
import dash_bootstrap_components as dbc
from dash.exceptions import PreventUpdate

app = Dash(__name__)
app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
server = app.server
app.config['suppress_callback_exceptions'] = True

df = pd.read_csv(
"/Users/jhughes/Desktop/repos/punchpipe/punchpipe/monitor/sample.csv",
Expand All @@ -20,28 +23,31 @@

fig = px.histogram(df, x="duration")

app.layout = html.Div(
[
dcc.DatePickerRange(
id="date_picker_range",
min_date_allowed=date(2022, 1, 1),
max_date_allowed=date.today(),
initial_visible_month=date(2022, 1, 1),
start_date=date.today() - timedelta(days=1),
end_date=date.today(),
),
dcc.Graph(id="duration", figure=fig),
dash_table.DataTable(
id="flow_table",
data=df.to_dict("records"),
columns=[{"name": i, "id": i} for i in df.columns],
page_action="none",
style_table={"height": "300px", "overflowY": "auto"},
sort_action="native",
),
html.Pre(id="relayout-data"),
]
)
app.layout = dbc.Tabs([
dbc.Tab(html.Div(
[
dcc.DatePickerRange(
id="date_picker_range",
min_date_allowed=date(2022, 1, 1),
max_date_allowed=date.today(),
initial_visible_month=date(2022, 1, 1),
start_date=date.today() - timedelta(days=1),
end_date=date.today(),
),
dcc.Graph(id="duration", figure=fig),
dash_table.DataTable(
id="flow_table",
data=df.to_dict("records"),
columns=[{"name": i, "id": i} for i in df.columns],
page_action="none",
style_table={"height": "300px", "overflowY": "auto"},
sort_action="native",
),
html.Pre(id="relayout-data"),
]
), label='Existing'),
dbc.Tab(html.Div(), label='Empty')
])


@app.callback(
Expand Down
75 changes: 75 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,78 @@
[build-system]

requires = ["setuptools",
"wheel"]

[project]
name = "punchpipe"
version = "0.0.1"
dependencies = [
"click",
"ccsdspy",
"punchbowl @ git+ssh://[email protected]/punch-mission/punchbowl@main",
"prefect",
"pymysql",
"pandas",
"xlrd",
"pydantic",
"sqlalchemy",
"dash",
"dash-bootstrap-components",
"coolname",
"numpy",
"plotly",
"pyyaml",
"click",
"waitress"
]
requires-python = ">=3.10"
authors = [
{name = "J. Marcus Hughes", email = "[email protected]"},
]
maintainers = [
{name = "J. Marcus Hughes", email = "[email protected]"}
]
description = "PUNCH mission's data reduction pipeline"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["TODO"]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python"
]

[project.optional-dependencies]
test = ["pre-commit",
"hypothesis",
"pytest",
"coverage",
"pytest-cov",
"pytest-mock-resources[mysql]",
"freezegun",
"ruff"]
docs = ["sphinx",
"pydata-sphinx-theme",
"sphinx-autoapi",
"sphinx-favicon",
"sphinxcontrib-mermaid",
"sphinx-automodapi"]

[project.scripts]
punchpipe = "punchpipe.cli:run"

[project.urls]
#Homepage = "https://example.com"
#Documentation = "https://readthedocs.org"
Repository = "https://github.com/punch-mission/punchpipe.git"
"Bug Tracker" = "https://github.com/punch-mission/punchpipe/issues"
#Changelog = "https://github.com/punch-mission/thuban/blob/main/CHANGELOG.md"

[tool.setuptools]
packages = ["punchpipe"]

[tool.codespell]
skip = "*.fts,*.fits,venv,*.pro,*.asdf,*.ipynb"

[tool.ruff]
target-version = 'py310'
exclude = ['tests', 'scripts', 'docs']
Expand Down
57 changes: 0 additions & 57 deletions setup.py

This file was deleted.

0 comments on commit 14b1a25

Please sign in to comment.