diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e51aa94..6d1638a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/.pytest.ini b/.pytest.ini index fec7d7e..25385dd 100644 --- a/.pytest.ini +++ b/.pytest.ini @@ -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 diff --git a/README.md b/README.md index f5bd483..a09bbce 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 @@ -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 @@ -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. @@ -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/ ``` diff --git a/WHAT-WE-LEARNED.md b/WHAT-WE-LEARNED.md index 8d92f73..dff73d5 100644 --- a/WHAT-WE-LEARNED.md +++ b/WHAT-WE-LEARNED.md @@ -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 diff --git a/dp_creator_ii/__init__.py b/dp_wizard/__init__.py similarity index 61% rename from dp_creator_ii/__init__.py rename to dp_wizard/__init__.py index 8fbd9b5..d0f0da8 100644 --- a/dp_creator_ii/__init__.py +++ b/dp_wizard/__init__.py @@ -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" @@ -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, ) diff --git a/dp_creator_ii/app/__init__.py b/dp_wizard/app/__init__.py similarity index 92% rename from dp_creator_ii/app/__init__.py rename to dp_wizard/app/__init__.py index 8031cf4..c5b3a0e 100644 --- a/dp_creator_ii/app/__init__.py +++ b/dp_wizard/app/__init__.py @@ -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) @@ -17,7 +17,7 @@ results_panel.results_ui(), id="top_level_nav", ), - title="DP Creator II", + title="DP Wizard", ) diff --git a/dp_creator_ii/app/analysis_panel.py b/dp_wizard/app/analysis_panel.py similarity index 93% rename from dp_creator_ii/app/analysis_panel.py rename to dp_wizard/app/analysis_panel.py index 6142454..a9171a6 100644 --- a/dp_creator_ii/app/analysis_panel.py +++ b/dp_wizard/app/analysis_panel.py @@ -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(): diff --git a/dp_creator_ii/app/components/column_module.py b/dp_wizard/app/components/column_module.py similarity index 94% rename from dp_creator_ii/app/components/column_module.py rename to dp_wizard/app/components/column_module.py index c7c9ddf..a84a13d 100644 --- a/dp_creator_ii/app/components/column_module.py +++ b/dp_wizard/app/components/column_module.py @@ -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 diff --git a/dp_creator_ii/app/components/inputs.py b/dp_wizard/app/components/inputs.py similarity index 100% rename from dp_creator_ii/app/components/inputs.py rename to dp_wizard/app/components/inputs.py diff --git a/dp_creator_ii/app/components/outputs.py b/dp_wizard/app/components/outputs.py similarity index 100% rename from dp_creator_ii/app/components/outputs.py rename to dp_wizard/app/components/outputs.py diff --git a/dp_creator_ii/app/components/plots.py b/dp_wizard/app/components/plots.py similarity index 100% rename from dp_creator_ii/app/components/plots.py rename to dp_wizard/app/components/plots.py diff --git a/dp_creator_ii/app/css/styles.css b/dp_wizard/app/css/styles.css similarity index 100% rename from dp_creator_ii/app/css/styles.css rename to dp_wizard/app/css/styles.css diff --git a/dp_creator_ii/app/dataset_panel.py b/dp_wizard/app/dataset_panel.py similarity index 94% rename from dp_creator_ii/app/dataset_panel.py rename to dp_wizard/app/dataset_panel.py index 2be9b67..52ed4f4 100644 --- a/dp_creator_ii/app/dataset_panel.py +++ b/dp_wizard/app/dataset_panel.py @@ -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(): diff --git a/dp_creator_ii/app/results_panel.py b/dp_wizard/app/results_panel.py similarity index 91% rename from dp_creator_ii/app/results_panel.py rename to dp_wizard/app/results_panel.py index c760717..b50aca1 100644 --- a/dp_creator_ii/app/results_panel.py +++ b/dp_wizard/app/results_panel.py @@ -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(): @@ -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(): @@ -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(): @@ -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(): diff --git a/dp_creator_ii/utils/argparse_helpers.py b/dp_wizard/utils/argparse_helpers.py similarity index 100% rename from dp_creator_ii/utils/argparse_helpers.py rename to dp_wizard/utils/argparse_helpers.py diff --git a/dp_creator_ii/utils/converters.py b/dp_wizard/utils/converters.py similarity index 100% rename from dp_creator_ii/utils/converters.py rename to dp_wizard/utils/converters.py diff --git a/dp_creator_ii/utils/csv_helper.py b/dp_wizard/utils/csv_helper.py similarity index 100% rename from dp_creator_ii/utils/csv_helper.py rename to dp_wizard/utils/csv_helper.py diff --git a/dp_creator_ii/utils/dp_helper.py b/dp_wizard/utils/dp_helper.py similarity index 97% rename from dp_creator_ii/utils/dp_helper.py rename to dp_wizard/utils/dp_helper.py index c32a3dd..b7949bd 100644 --- a/dp_creator_ii/utils/dp_helper.py +++ b/dp_wizard/utils/dp_helper.py @@ -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") diff --git a/dp_creator_ii/utils/mock_data.py b/dp_wizard/utils/mock_data.py similarity index 100% rename from dp_creator_ii/utils/mock_data.py rename to dp_wizard/utils/mock_data.py diff --git a/dp_creator_ii/utils/templates/__init__.py b/dp_wizard/utils/templates/__init__.py similarity index 100% rename from dp_creator_ii/utils/templates/__init__.py rename to dp_wizard/utils/templates/__init__.py diff --git a/dp_creator_ii/utils/templates/no-tests/_column_config.py b/dp_wizard/utils/templates/no-tests/_column_config.py similarity index 100% rename from dp_creator_ii/utils/templates/no-tests/_column_config.py rename to dp_wizard/utils/templates/no-tests/_column_config.py diff --git a/dp_creator_ii/utils/templates/no-tests/_context.py b/dp_wizard/utils/templates/no-tests/_context.py similarity index 100% rename from dp_creator_ii/utils/templates/no-tests/_context.py rename to dp_wizard/utils/templates/no-tests/_context.py diff --git a/dp_creator_ii/utils/templates/no-tests/_imports.py b/dp_wizard/utils/templates/no-tests/_imports.py similarity index 100% rename from dp_creator_ii/utils/templates/no-tests/_imports.py rename to dp_wizard/utils/templates/no-tests/_imports.py diff --git a/dp_creator_ii/utils/templates/no-tests/_notebook.py b/dp_wizard/utils/templates/no-tests/_notebook.py similarity index 100% rename from dp_creator_ii/utils/templates/no-tests/_notebook.py rename to dp_wizard/utils/templates/no-tests/_notebook.py diff --git a/dp_creator_ii/utils/templates/no-tests/_privacy_loss.py b/dp_wizard/utils/templates/no-tests/_privacy_loss.py similarity index 100% rename from dp_creator_ii/utils/templates/no-tests/_privacy_loss.py rename to dp_wizard/utils/templates/no-tests/_privacy_loss.py diff --git a/dp_creator_ii/utils/templates/no-tests/_privacy_unit.py b/dp_wizard/utils/templates/no-tests/_privacy_unit.py similarity index 100% rename from dp_creator_ii/utils/templates/no-tests/_privacy_unit.py rename to dp_wizard/utils/templates/no-tests/_privacy_unit.py diff --git a/dp_creator_ii/utils/templates/no-tests/_script.py b/dp_wizard/utils/templates/no-tests/_script.py similarity index 100% rename from dp_creator_ii/utils/templates/no-tests/_script.py rename to dp_wizard/utils/templates/no-tests/_script.py diff --git a/pyproject.toml b/pyproject.toml index 4e90dca..bfcef5b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 = "mccallucc@gmail.com"}] readme = "README.md" license = {file = "LICENSE"} @@ -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" diff --git a/tests/fixtures/default_app.py b/tests/fixtures/default_app.py index d90f261..4ed8b49 100644 --- a/tests/fixtures/default_app.py +++ b/tests/fixtures/default_app.py @@ -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, diff --git a/tests/fixtures/demo_app.py b/tests/fixtures/demo_app.py index 169f7af..e1ef64a 100644 --- a/tests/fixtures/demo_app.py +++ b/tests/fixtures/demo_app.py @@ -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( diff --git a/tests/test_app.py b/tests/test_app.py index ae20b98..9bc82ff 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -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() @@ -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) @@ -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 -- diff --git a/tests/utils/test_argparse_helpers.py b/tests/utils/test_argparse_helpers.py index e56b2b8..95e93e0 100644 --- a/tests/utils/test_argparse_helpers.py +++ b/tests/utils/test_argparse_helpers.py @@ -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" @@ -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:") ) diff --git a/tests/utils/test_converters.py b/tests/utils/test_converters.py index 9e4c34e..9bf3f40 100644 --- a/tests/utils/test_converters.py +++ b/tests/utils/test_converters.py @@ -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" diff --git a/tests/utils/test_csv_helper.py b/tests/utils/test_csv_helper.py index de6f219..76ac569 100644 --- a/tests/utils/test_csv_helper.py +++ b/tests/utils/test_csv_helper.py @@ -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: diff --git a/tests/utils/test_templates.py b/tests/utils/test_templates.py index b65c898..a5970a2 100644 --- a/tests/utils/test_templates.py +++ b/tests/utils/test_templates.py @@ -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"