diff --git a/skore/src/skore/__init__.py b/skore/src/skore/__init__.py index 9e11fb796..cdf666230 100644 --- a/skore/src/skore/__init__.py +++ b/skore/src/skore/__init__.py @@ -5,7 +5,7 @@ from rich.console import Console from rich.theme import Theme -from skore.project import Project, open +from skore.project import Project from skore.sklearn import ( CrossValidationReport, CrossValidationReporter, @@ -19,7 +19,6 @@ "CrossValidationReporter", "CrossValidationReport", "EstimatorReport", - "open", "Project", "show_versions", "train_test_split", diff --git a/skore/src/skore/cli/cli.py b/skore/src/skore/cli/cli.py index cf58c2565..0aa308a14 100644 --- a/skore/src/skore/cli/cli.py +++ b/skore/src/skore/cli/cli.py @@ -19,7 +19,7 @@ def argumentparser(): parser.add_argument( "project_name", - help="the name or path of the project to open", + help="the name or path of the project to be created or opened", ) parser.add_argument( diff --git a/skore/src/skore/project/__init__.py b/skore/src/skore/project/__init__.py index bce2110cd..6f8fb08a5 100644 --- a/skore/src/skore/project/__init__.py +++ b/skore/src/skore/project/__init__.py @@ -1,8 +1,7 @@ """Alias top level function and class of the project submodule.""" -from .project import Project, open +from .project import Project __all__ = [ - "open", "Project", ] diff --git a/skore/src/skore/project/project.py b/skore/src/skore/project/project.py index 0ae6c8fb4..ae3d14079 100644 --- a/skore/src/skore/project/project.py +++ b/skore/src/skore/project/project.py @@ -18,17 +18,6 @@ logger.setLevel(INFO) -def open(path: Optional[Union[str, Path]] = "project.skore"): - path = Path(path) - path = path.with_suffix(".skore") - path = path.resolve() - - if not path.exists(): - raise FileNotFoundError - - return Project(path, exist_ok=True) - - class Project: """ A collection of items arranged in views and stored in a storage. diff --git a/skore/src/skore/ui/app.py b/skore/src/skore/ui/app.py index df7ef64c3..0ce750058 100644 --- a/skore/src/skore/ui/app.py +++ b/skore/src/skore/ui/app.py @@ -10,7 +10,7 @@ from fastapi.staticfiles import StaticFiles from starlette.types import Lifespan -from skore.project import Project, open +from skore.project import Project from skore.ui.dependencies import get_static_path from skore.ui.project_routes import router as project_router @@ -20,11 +20,6 @@ def create_app( ) -> FastAPI: """FastAPI factory used to create the API to interact with `stores`.""" app = FastAPI(lifespan=lifespan) - - # Give the app access to the project - if not project: - project = open("project.skore") - app.state.project = project # Enable CORS support on all routes, for all origins and methods. diff --git a/skore/tests/integration/cli/test_cli.py b/skore/tests/integration/cli/test_cli.py deleted file mode 100644 index 732a582ca..000000000 --- a/skore/tests/integration/cli/test_cli.py +++ /dev/null @@ -1,33 +0,0 @@ -import subprocess -from importlib.metadata import version - -import pytest - - -def test_no_subcommand(): - """If the CLI is given no subcommand, it should output the help menu.""" - completed_process = subprocess.run(["skore"]) - - completed_process.check_returncode() - - -def test_invalid_subcommand(): - """If the CLI is given an invalid subcommand, - it should exit and warn that the subcommand is invalid.""" - completed_process = subprocess.run( - ["skore", "probabl-wrong-command"], capture_output=True - ) - - with pytest.raises(subprocess.CalledProcessError): - completed_process.check_returncode() - - assert b"invalid" in completed_process.stderr - assert b"probabl-wrong-command" in completed_process.stderr - - -def test_version(): - """The --version command should not fail.""" - completed_process = subprocess.run(["skore", "--version"], capture_output=True) - - completed_process.check_returncode() - assert f'skore {version("skore")}'.encode() in completed_process.stdout diff --git a/skore/tests/integration/cli/test_create.py b/skore/tests/integration/cli/test_create.py deleted file mode 100644 index 6e249b389..000000000 --- a/skore/tests/integration/cli/test_create.py +++ /dev/null @@ -1,43 +0,0 @@ -import os - -import pytest -from skore.cli.cli import cli -from skore.exceptions import ProjectCreationError - - -def test_create_project_cli_default_argument(tmp_path): - os.chdir(tmp_path) - cli("create".split()) - assert (tmp_path / "project.skore").exists() - - -def test_create_project_cli_absolute_path(tmp_path): - os.chdir(tmp_path) - cli(f"create {tmp_path / 'hello.skore'}".split()) - assert (tmp_path / "hello.skore").exists() - - -def test_create_project_cli_ends_in_skore(tmp_path): - os.chdir(tmp_path) - cli("create hello.skore".split()) - assert (tmp_path / "hello.skore").exists() - - -def test_create_project_cli_invalid_name(): - with pytest.raises(ProjectCreationError): - cli("create hello.txt".split()) - - -def test_create_project_cli_overwrite(tmp_path): - """Check the behaviour of the `overwrite` flag/parameter.""" - os.chdir(tmp_path) - cli("create".split()) - assert (tmp_path / "project.skore").exists() - - # calling the same command without overwriting should fail - with pytest.raises(FileExistsError): - cli("create".split()) - - # calling the same command with overwriting should succeed - cli("create --overwrite".split()) - assert (tmp_path / "project.skore").exists() diff --git a/skore/tests/integration/cli/test_quickstart.py b/skore/tests/integration/cli/test_quickstart.py deleted file mode 100644 index ee2eb26a3..000000000 --- a/skore/tests/integration/cli/test_quickstart.py +++ /dev/null @@ -1,25 +0,0 @@ -import os - -import pytest -from skore.cli.cli import cli - - -@pytest.fixture -def fake_launch(monkeypatch): - def _fake_launch(project_name, port, open_browser, verbose): - pass - - monkeypatch.setattr("skore.cli.quickstart_command.__launch", _fake_launch) - - -def test_quickstart(tmp_path, fake_launch): - os.chdir(tmp_path) - cli("quickstart".split()) - assert (tmp_path / "project.skore").exists() - - # calling the same command without overwriting should succeed - # (as the creation step is skipped) - cli("quickstart".split()) - - # calling the same command with overwriting should succeed - cli("quickstart --overwrite".split())