Skip to content

Commit 32e92f3

Browse files
refactor(core): remove various LocalClient mixins (#3109)
Co-authored-by: Ralf Grubenmann <[email protected]>
1 parent 10d8cb7 commit 32e92f3

File tree

198 files changed

+4739
-5563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+4739
-5563
lines changed

conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,4 @@ def pytest_configure(config):
7777
)
7878

7979
os.environ["RENKU_SKIP_MIN_VERSION_CHECK"] = "1"
80+
os.environ["RENKU_DISABLE_VERSION_CHECK"] = "1"

docs/cheatsheet/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@
191191
("py:class", "DynamicProxy"),
192192
("py:class", "IActivityGateway"),
193193
("py:class", "IClientDispatcher"),
194-
("py:class", "IDatabaseDispatcher"),
195194
("py:class", "IDatasetGateway"),
196195
("py:class", "IPlanGateway"),
197196
("py:class", "LocalClient"),

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@
356356
("py:class", "DynamicProxy"),
357357
("py:class", "IActivityGateway"),
358358
("py:class", "IClientDispatcher"),
359-
("py:class", "IDatabaseDispatcher"),
360359
("py:class", "IDatasetGateway"),
361360
("py:class", "IPlanGateway"),
362361
("py:class", "IStorageFactory"),

docs/reference/core.rst

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ Datasets
8989
:members:
9090
:show-inheritance:
9191

92-
.. automodule:: renku.core.dataset.constant
93-
:members:
94-
:show-inheritance:
95-
9692
.. automodule:: renku.core.dataset.context
9793
:members:
9894
:show-inheritance:
@@ -288,16 +284,10 @@ Utilities
288284
:members:
289285
:show-inheritance:
290286

291-
Repository
292-
----------
293-
294-
.. automodule:: renku.core.management.repository
295-
:members:
296-
297287
Git Internals
298288
-------------
299289

300-
.. automodule:: renku.core.management.git
290+
.. automodule:: renku.core.git
301291
:members:
302292

303293
.. automodule:: renku.domain_model.git

docs/reference/gateways.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ Interfaces that the Gateways implement.
3535
:members:
3636
:show-inheritance:
3737

38-
.. automodule:: renku.core.interface.database_dispatcher
39-
:members:
40-
:show-inheritance:
41-
4238
.. automodule:: renku.core.interface.database_gateway
4339
:members:
4440
:show-inheritance:

renku/command/checks/activities.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,19 @@
2424
from renku.command.command_builder import inject
2525
from renku.command.echo import WARNING
2626
from renku.core.interface.activity_gateway import IActivityGateway
27-
from renku.core.interface.database_dispatcher import IDatabaseDispatcher
2827
from renku.core.util import communication
28+
from renku.domain_model.project_context import project_context
2929

3030

31-
@inject.autoparams("activity_gateway", "database_dispatcher")
32-
def check_migrated_activity_ids(
33-
client, fix, activity_gateway: IActivityGateway, database_dispatcher: IDatabaseDispatcher, **kwargs
34-
):
31+
@inject.autoparams("activity_gateway")
32+
def check_migrated_activity_ids(client, fix, activity_gateway: IActivityGateway, **kwargs):
3533
"""Check that activity ids were correctly migrated in the past."""
3634
activities = activity_gateway.get_all_activities(include_deleted=True)
3735

3836
wrong_activities = [a for a in activities if not a.id.startswith("/activities/")]
3937

4038
if fix:
41-
current_database = database_dispatcher.current_database
39+
current_database = project_context.database
4240
for activity in wrong_activities:
4341
communication.info(f"Fixing activity '{activity.id}'")
4442

renku/command/checks/datasets.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
from renku.core.dataset.dataset_add import add_to_dataset
2929
from renku.core.interface.dataset_gateway import IDatasetGateway
3030
from renku.core.migration.utils import get_pre_0_3_4_datasets_metadata
31-
from renku.core.project.project_properties import project_properties
3231
from renku.core.util import communication
3332
from renku.core.util.os import get_safe_relative_path
33+
from renku.domain_model.project_context import project_context
3434

3535

3636
def check_dataset_old_metadata_location(client, **kwargs):
@@ -43,15 +43,15 @@ def check_dataset_old_metadata_location(client, **kwargs):
4343
Returns:
4444
Tuple of whether dataset metadata location is valid and string of found problems.
4545
"""
46-
old_metadata = get_pre_0_3_4_datasets_metadata(client)
46+
old_metadata = get_pre_0_3_4_datasets_metadata()
4747

4848
if not old_metadata:
4949
return True, None
5050

5151
problems = (
5252
WARNING + "There are metadata files in the old location."
5353
'\n (use "renku migrate" to move them)\n\n\t'
54-
+ "\n\t".join(click.style(str(path.relative_to(project_properties.path)), fg="yellow") for path in old_metadata)
54+
+ "\n\t".join(click.style(str(path.relative_to(project_context.path)), fg="yellow") for path in old_metadata)
5555
+ "\n"
5656
)
5757

@@ -74,7 +74,7 @@ def check_missing_files(client, dataset_gateway: IDatasetGateway, **kwargs):
7474

7575
for dataset in dataset_gateway.get_all_active_datasets():
7676
for file_ in dataset.files:
77-
path = project_properties.path / file_.entity.path
77+
path = project_context.path / file_.entity.path
7878
file_exists = path.exists() or (file_.is_external and os.path.lexists(path))
7979
if not file_exists:
8080
missing[dataset.name].append(file_.entity.path)
@@ -163,15 +163,15 @@ def check_dataset_files_outside_datadir(client, fix, dataset_gateway: IDatasetGa
163163
if dataset.date_removed:
164164
continue
165165

166-
data_dir = dataset.get_datadir(client=client)
166+
data_dir = dataset.get_datadir()
167167

168168
detected_files = []
169169

170170
for file in dataset.files:
171171
if file.is_external:
172172
continue
173173
try:
174-
get_safe_relative_path(project_properties.path / file.entity.path, project_properties.path / data_dir)
174+
get_safe_relative_path(project_context.path / file.entity.path, project_context.path / data_dir)
175175
except ValueError:
176176
detected_files.append(file)
177177

renku/command/checks/external.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from renku.command.command_builder import inject
2222
from renku.command.echo import WARNING
2323
from renku.core.interface.dataset_gateway import IDatasetGateway
24-
from renku.core.project.project_properties import project_properties
24+
from renku.domain_model.project_context import project_context
2525

2626

2727
@inject.autoparams("dataset_gateway")
@@ -41,7 +41,7 @@ def check_missing_external_files(client, dataset_gateway: IDatasetGateway, **kwa
4141
for dataset in dataset_gateway.get_all_active_datasets():
4242
for file_ in dataset.files:
4343
if file_.is_external:
44-
target = (project_properties.path / file_.entity.path).resolve()
44+
target = (project_context.path / file_.entity.path).resolve()
4545
if not target.exists():
4646
missing.append((file_.entity.path, str(target)))
4747

renku/command/checks/githooks.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
from io import StringIO
2121

2222
from renku.command.echo import WARNING
23-
from renku.core.management.githooks import HOOKS
23+
from renku.core.githooks import HOOKS
2424
from renku.core.util.git import get_hook_path
25+
from renku.domain_model.project_context import project_context
2526

2627
try:
2728
import importlib_resources
@@ -40,7 +41,7 @@ def check_git_hooks_installed(client, **kwargs):
4041
Tuple of whether git hooks are valid and string of found problems.
4142
"""
4243
for hook in HOOKS:
43-
hook_path = get_hook_path(name=hook, repository=client.repository)
44+
hook_path = get_hook_path(name=hook, path=project_context.path)
4445
if not hook_path.exists():
4546
message = WARNING + "Git hooks are not installed. " 'Use "renku githooks install" to install them. \n'
4647
return False, message

renku/command/checks/project.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def check_project_id_group(client, fix, project_gateway: IProjectGateway, **kwar
3737
Returns:
3838
Tuple of whether project id is valid.
3939
"""
40-
current_project = client.project
40+
current_project = project_gateway.get_project()
4141

42-
namespace, name = Project.get_namespace_and_name(client=client)
42+
namespace, name = Project.get_namespace_and_name(use_project_context=True)
4343

4444
if namespace is None or name is None:
4545
return True, None

0 commit comments

Comments
 (0)