Skip to content

Commit

Permalink
creator -> wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Nov 14, 2024
1 parent 40e0b9c commit 1130a4a
Show file tree
Hide file tree
Showing 35 changed files with 53 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Check CLI
# TODO: This won't catch most missing dependencies.
run: dp-creator-ii --help
run: dp-wizard --help

- name: Install dev dependencies
run: pip install -r requirements-dev.txt
Expand Down
2 changes: 1 addition & 1 deletion .pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
filterwarnings =
error

addopts = --doctest-glob '*.md' --doctest-modules --ignore dp_creator_ii/utils/templates/no-tests --ignore dp_creator_ii/tests/fixtures/ --tracing=retain-on-failure
addopts = --doctest-glob '*.md' --doctest-modules --ignore dp_wizard/utils/templates/no-tests --ignore dp_wizard/tests/fixtures/ --tracing=retain-on-failure

# If an xfail starts passing unexpectedly, that should count as a failure:
xfail_strict=true
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# DP Creator II
# DP Wizard

**Under Construction**

Building on what we've learned from [DP Creator](https://github.com/opendp/dpcreator), DP Creator II will offer:
Building on what we've learned from [DP Creator](https://github.com/opendp/dpcreator), DP Wizard will offer:

- Easy installation with `pip install`
- Simplified single-user application design
Expand All @@ -15,7 +15,7 @@ We plan to implement a [proof of concept](https://docs.google.com/document/d/1dt
## Usage

```
usage: dp-creator-ii [-h] [--csv CSV_PATH] [--contrib CONTRIB] [--demo]
usage: dp-wizard [-h] [--csv CSV_PATH] [--contrib CONTRIB] [--demo]
options:
-h, --help show this help message and exit
Expand All @@ -34,8 +34,8 @@ so let's remember [what we learned](WHAT-WE-LEARNED.md) along the way.

To get started, clone the repo and install dev dependencies in a virtual environment:
```shell
$ git clone https://github.com/opendp/dp-creator-ii.git
$ cd dp-creator-ii
$ git clone https://github.com/opendp/dp-wizard.git
$ cd dp-wizard
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements-dev.txt
Expand All @@ -46,7 +46,7 @@ $ playwright install
Now install the application itself and run it:
```shell
$ flit install --symlink
$ dp-creator-ii
$ dp-wizard
```
Your browser should open and connect you to the application.

Expand All @@ -59,7 +59,7 @@ $ ./ci.sh

We're using [Playwright](https://playwright.dev/python/) for end-to-end tests. You can use it to [generate test code](https://playwright.dev/python/docs/codegen-intro) just by interacting with the app in a browser:
```shell
$ dp-creator-ii # The server will continue to run, so open a new terminal to continue.
$ dp-wizard # The server will continue to run, so open a new terminal to continue.
$ playwright codegen http://127.0.0.1:8000/
```

Expand Down
4 changes: 2 additions & 2 deletions WHAT-WE-LEARNED.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ Was planning to just use the CSV column headers as IDs, but that's not going to
## Normal tooling doesn't work inside of app?

There are several bits of tooling that don't seem to work inside end-to-end app tests. My guess is that this isn't related to Shiny per se, but rather the ASGI framework: It's not running in the same process as pytest, so it's not surprising that the pytest process can't instrument this.
- [App code skipped by test coverage](https://github.com/opendp/dp-creator-ii/issues/18)
- [Mocks don't work inside app](https://github.com/opendp/dp-creator-ii/issues/119)
- [App code skipped by test coverage](https://github.com/opendp/dp-wizard/issues/18)
- [Mocks don't work inside app](https://github.com/opendp/dp-wizard/issues/119)
- `breakpoint()` doesn't work inside end-to-end tests. (A comparison might be made to debugging a React application: With React devtools in the browser, it's pretty easy!)

## You still need some webdev skills
Expand Down
6 changes: 3 additions & 3 deletions dp_creator_ii/__init__.py → dp_wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""DP Creator II makes it easier to get started with Differential Privacy."""
"""DP Wizard makes it easier to get started with Differential Privacy."""

import shiny
from dp_creator_ii.utils.argparse_helpers import get_cli_info
from dp_wizard.utils.argparse_helpers import get_cli_info


__version__ = "0.0.1"
Expand All @@ -13,7 +13,7 @@ def main(): # pragma: no cover
get_cli_info()

shiny.run_app(
app="dp_creator_ii.app",
app="dp_wizard.app",
launch_browser=True,
reload=True,
)
6 changes: 3 additions & 3 deletions dp_creator_ii/app/__init__.py → dp_wizard/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

from shiny import App, ui, reactive

from dp_creator_ii.utils.argparse_helpers import get_cli_info
from dp_creator_ii.app import analysis_panel, dataset_panel, results_panel
from dp_wizard.utils.argparse_helpers import get_cli_info
from dp_wizard.app import analysis_panel, dataset_panel, results_panel


logging.basicConfig(level=logging.INFO)
Expand All @@ -17,7 +17,7 @@
results_panel.results_ui(),
id="top_level_nav",
),
title="DP Creator II",
title="DP Wizard",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from shiny import ui, reactive, render, req

from dp_creator_ii.app.components.inputs import log_slider
from dp_creator_ii.app.components.column_module import column_ui, column_server
from dp_creator_ii.utils.csv_helper import read_csv_ids_labels, read_csv_ids_names
from dp_creator_ii.app.components.outputs import output_code_sample, demo_tooltip
from dp_creator_ii.utils.templates import make_privacy_loss_block
from dp_creator_ii.app.components.column_module import col_widths
from dp_wizard.app.components.inputs import log_slider
from dp_wizard.app.components.column_module import column_ui, column_server
from dp_wizard.utils.csv_helper import read_csv_ids_labels, read_csv_ids_names
from dp_wizard.app.components.outputs import output_code_sample, demo_tooltip
from dp_wizard.utils.templates import make_privacy_loss_block
from dp_wizard.app.components.column_module import col_widths


def analysis_ui():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from shiny import ui, render, module, reactive

from dp_creator_ii.utils.dp_helper import make_confidence_accuracy_histogram
from dp_creator_ii.app.components.plots import plot_histogram
from dp_creator_ii.utils.templates import make_column_config_block
from dp_creator_ii.app.components.outputs import output_code_sample, demo_tooltip
from dp_wizard.utils.dp_helper import make_confidence_accuracy_histogram
from dp_wizard.app.components.plots import plot_histogram
from dp_wizard.utils.templates import make_column_config_block
from dp_wizard.app.components.outputs import output_code_sample, demo_tooltip


default_weight = 2
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from shiny import ui, reactive, render

from dp_creator_ii.utils.argparse_helpers import get_cli_info
from dp_creator_ii.app.components.outputs import output_code_sample, demo_tooltip
from dp_creator_ii.utils.templates import make_privacy_unit_block
from dp_wizard.utils.argparse_helpers import get_cli_info
from dp_wizard.app.components.outputs import output_code_sample, demo_tooltip
from dp_wizard.utils.templates import make_privacy_unit_block


def dataset_ui():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from shiny import ui, render

from dp_creator_ii.utils.templates import make_notebook_py, make_script_py
from dp_creator_ii.utils.converters import convert_py_to_nb
from dp_wizard.utils.templates import make_notebook_py, make_script_py
from dp_wizard.utils.converters import convert_py_to_nb


def results_ui():
Expand Down Expand Up @@ -62,7 +62,7 @@ def data_dump():
)

@render.download(
filename="dp-creator-script.py",
filename="dp-wizard-script.py",
media_type="text/x-python",
)
async def download_script():
Expand All @@ -75,7 +75,7 @@ async def download_script():
yield script_py

@render.download(
filename="dp-creator-notebook.ipynb",
filename="dp-wizard-notebook.ipynb",
media_type="application/x-ipynb+json",
)
async def download_notebook_unexecuted():
Expand All @@ -90,7 +90,7 @@ async def download_notebook_unexecuted():
yield notebook_nb

@render.download(
filename="dp-creator-notebook-executed.ipynb",
filename="dp-wizard-notebook-executed.ipynb",
media_type="application/x-ipynb+json",
)
async def download_notebook_executed():
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import polars as pl
import opendp.prelude as dp

from dp_creator_ii.utils.mock_data import mock_data, ColumnDef
from dp_wizard.utils.mock_data import mock_data, ColumnDef

dp.enable_features("contrib")

Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "dp_creator_ii"
name = "dp_wizard"
authors = [{name = "Chuck McCallum", email = "[email protected]"}]
readme = "README.md"
license = {file = "LICENSE"}
Expand All @@ -21,7 +21,7 @@ dependencies = [
]

[project.scripts]
dp-creator-ii = "dp_creator_ii:main"
dp-wizard = "dp_wizard:main"

[project.urls]
Home = "https://github.com/opendp/dp-creator-ii"
Home = "https://github.com/opendp/dp-wizard"
4 changes: 2 additions & 2 deletions tests/fixtures/default_app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from shiny import App


from dp_creator_ii.app import app_ui, make_server_from_cli_info
from dp_creator_ii.utils.argparse_helpers import CLIInfo
from dp_wizard.app import app_ui, make_server_from_cli_info
from dp_wizard.utils.argparse_helpers import CLIInfo

app = App(
app_ui,
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/demo_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from shiny import App

from dp_creator_ii.app import app_ui, make_server_from_cli_info
from dp_creator_ii.utils.argparse_helpers import CLIInfo
from dp_wizard.app import app_ui, make_server_from_cli_info
from dp_wizard.utils.argparse_helpers import CLIInfo


app = App(
Expand Down
8 changes: 4 additions & 4 deletions tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@


# TODO: Why is incomplete coverage reported here?
# https://github.com/opendp/dp-creator-ii/issues/18
# https://github.com/opendp/dp-wizard/issues/18
def test_demo_app(page: Page, demo_app: ShinyAppProc): # pragma: no cover
page.goto(demo_app.url)
expect(page).to_have_title("DP Creator II")
expect(page).to_have_title("DP Wizard")
expect(page.get_by_text(for_the_demo)).not_to_be_visible()
page.locator(tooltip).hover()
expect(page.get_by_text(for_the_demo)).to_be_visible()
Expand All @@ -38,7 +38,7 @@ def expect_no_error():

# -- Select dataset --
page.goto(default_app.url)
expect(page).to_have_title("DP Creator II")
expect(page).to_have_title("DP Wizard")
expect(page.locator(tooltip)).to_have_count(0)
expect_visible(pick_dataset_text)
expect_not_visible(perform_analysis_text)
Expand Down Expand Up @@ -103,7 +103,7 @@ def expect_no_error():
# TODO: Setting more inputs without checking for updates
# cause recalculations to pile up, and these cause timeouts on CI:
# It is still rerendering the graph after hitting "Download results".
# https://github.com/opendp/dp-creator-ii/issues/116
# https://github.com/opendp/dp-wizard/issues/116
expect_no_error()

# -- Download results --
Expand Down
6 changes: 3 additions & 3 deletions tests/utils/test_argparse_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from dp_creator_ii.utils.argparse_helpers import _get_arg_parser, _existing_csv_type
from dp_wizard.utils.argparse_helpers import _get_arg_parser, _existing_csv_type


fixtures_path = Path(__file__).parent.parent / "fixtures"
Expand All @@ -15,8 +15,8 @@ def test_help():
.format_help()
# argparse doesn't actually know the name of the script
# and inserts the name of the running program instead.
.replace("__main__.py", "dp-creator-ii")
.replace("pytest", "dp-creator-ii")
.replace("__main__.py", "dp-wizard")
.replace("pytest", "dp-wizard")
# Text is different under Python 3.9:
.replace("optional arguments:", "options:")
)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
import subprocess
import pytest
from dp_creator_ii.utils.converters import convert_py_to_nb
from dp_wizard.utils.converters import convert_py_to_nb


fixtures_path = Path(__file__).parent.parent / "fixtures"
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_csv_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import tempfile
import pytest

from dp_creator_ii.utils.csv_helper import read_csv_ids_labels, read_csv_ids_names
from dp_wizard.utils.csv_helper import read_csv_ids_labels, read_csv_ids_names


# We will not reference the encoding when reading:
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import re
import pytest
import opendp.prelude as dp
from dp_creator_ii.utils.templates import _Template, make_notebook_py, make_script_py
from dp_wizard.utils.templates import _Template, make_notebook_py, make_script_py


fixtures_path = Path(__file__).parent.parent / "fixtures"
Expand Down

0 comments on commit 1130a4a

Please sign in to comment.