Skip to content

Commit f7f67b6

Browse files
committed
refactor!: BaseProject to abstract base class
1 parent f1480d3 commit f7f67b6

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

libvcs/projects/base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Base class for VCS Project plugins."""
22
import logging
33
import pathlib
4-
from typing import NamedTuple, Optional, Tuple
4+
from typing import NamedTuple, Optional, Protocol, Tuple
55
from urllib import parse as urlparse
66

77
from libvcs._internal.run import CmdLoggingAdapter, run
@@ -32,18 +32,21 @@ def convert_pip_url(pip_url: str) -> VCSLocation:
3232
return VCSLocation(url=url, rev=rev)
3333

3434

35-
class BaseProject:
35+
class BaseProject(Protocol):
3636
"""Base class for repositories."""
3737

38-
log_in_real_time = None
38+
log_in_real_time: bool
3939
"""Log command output to buffer"""
4040

41-
bin_name = ""
41+
bin_name: str
4242
"""VCS app name, e.g. 'git'"""
4343

4444
schemes: Tuple[str, ...] = ()
4545
"""List of supported schemes to register in ``urlparse.uses_netloc``"""
4646

47+
dir: StrPath
48+
"""CWD of project"""
49+
4750
def __init__(self, *, url: str, dir: StrPath, progress_callback=None, **kwargs):
4851
r"""
4952
Parameters
@@ -85,7 +88,6 @@ def __init__(self, *, url: str, dir: StrPath, progress_callback=None, **kwargs):
8588
self.progress_callback = progress_callback
8689

8790
#: Directory to check out
88-
self.dir: pathlib.Path
8991
if isinstance(dir, pathlib.Path):
9092
self.dir = dir
9193
else:

0 commit comments

Comments
 (0)