Skip to content

Commit 6a5f8af

Browse files
committed
cruft: update template
1 parent 8d7888e commit 6a5f8af

File tree

11 files changed

+127
-177
lines changed

11 files changed

+127
-177
lines changed

.cruft.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/iterative/cookiecutter-dvc-plugin",
3-
"commit": "91159828cdce86290b97bf4985732651805523c4",
3+
"commit": "55dea263c00d5e174aed89451c29f6b7ef0f9577",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fetch-depth: 0
2121
- uses: actions/setup-python@v3
2222
with:
23-
python-version: 3.8
23+
python-version: 3.9
2424
- name: Install
2525
run: |
2626
pip install --upgrade pip wheel

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
fail-fast: false
2424
matrix:
2525
os: [ubuntu-20.04, windows-latest, macos-latest]
26-
pyv: ["3.8", "3.9", "3.10", "3.11"]
26+
pyv: ["3.9", "3.10", "3.11", "3.12"]
2727

2828
steps:
2929
- uses: actions/checkout@v3

.pre-commit-config.yaml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ repos:
99
language: fail
1010
files: \.rej$
1111
repo: local
12-
- hooks:
13-
- id: black
14-
language_version: python3
15-
repo: https://github.com/ambv/black
16-
rev: 22.3.0
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: 'v0.2.0'
14+
hooks:
15+
- id: ruff
16+
args: [--fix, --exit-non-zero-on-fix]
17+
- id: ruff-format
1718
- repo: https://github.com/pre-commit/pre-commit-hooks
1819
rev: v4.0.1
1920
hooks:
@@ -26,21 +27,6 @@ repos:
2627
- ba,datas,fo,uptodate
2728
repo: https://github.com/codespell-project/codespell
2829
rev: v2.1.0
29-
- hooks:
30-
- id: isort
31-
language_version: python3
32-
repo: https://github.com/timothycrosley/isort
33-
rev: 5.12.0
34-
- hooks:
35-
- id: flake8
36-
language_version: python3
37-
additional_dependencies:
38-
- flake8-bugbear
39-
- flake8-comprehensions
40-
- flake8-debugger
41-
- flake8-string-format
42-
repo: https://github.com/pycqa/flake8
43-
rev: 3.9.2
4430
- repo: local
4531
hooks:
4632
- id: mypy
@@ -49,11 +35,6 @@ repos:
4935
files: ^dvc_ssh/
5036
language: system
5137
types: [python]
52-
- id: pylint
53-
name: pylint
54-
entry: pylint
55-
language: system
56-
types: [python]
5738
- hooks:
5839
- args:
5940
- -i

dvc_ssh/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import getpass
22
import os.path
33
import threading
4+
from typing import ClassVar
5+
6+
from funcy import memoize, silent, wrap_prop, wrap_with
47

58
from dvc.utils.objects import cached_property
69
from dvc_objects.fs.base import FileSystem
710
from dvc_objects.fs.callbacks import DEFAULT_CALLBACK
811
from dvc_objects.fs.utils import as_atomic
9-
from funcy import memoize, silent, wrap_prop, wrap_with
1012

1113
DEFAULT_PORT = 22
1214

@@ -16,8 +18,7 @@
1618
def ask_password(host, user, port, desc):
1719
try:
1820
return getpass.getpass(
19-
f"Enter a {desc} for "
20-
f"host '{host}' port '{port}' user '{user}':\n"
21+
f"Enter a {desc} for " f"host '{host}' port '{port}' user '{user}':\n"
2122
)
2223
except EOFError:
2324
return None
@@ -26,7 +27,7 @@ def ask_password(host, user, port, desc):
2627
# pylint:disable=abstract-method
2728
class SSHFileSystem(FileSystem):
2829
protocol = "ssh"
29-
REQUIRES = {"sshfs": "sshfs"}
30+
REQUIRES: ClassVar[dict[str, str]] = {"sshfs": "sshfs"}
3031
PARAM_CHECKSUM = "md5"
3132

3233
@classmethod
@@ -84,9 +85,7 @@ def _prepare_credentials(self, **config):
8485
raw_keys.extend(user_ssh_config.get("IdentityFile"))
8586

8687
if raw_keys:
87-
login_info["client_keys"] = [
88-
os.path.expanduser(key) for key in raw_keys
89-
]
88+
login_info["client_keys"] = [os.path.expanduser(key) for key in raw_keys]
9089

9190
login_info["timeout"] = config.get("timeout", 1800)
9291

dvc_ssh/tests/cloud.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
22
import uuid
33

4+
from funcy import cached_property
5+
46
from dvc.testing.cloud import Cloud
57
from dvc.testing.path_info import URLInfo
6-
from funcy import cached_property
78

89
TEST_SSH_USER = "user"
910
TEST_SSH_KEY_PATH = os.path.join(

dvc_ssh/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from dvc.testing.fixtures import * # noqa, pylint: disable=wildcard-import,unused-import
1+
from dvc.testing.fixtures import * # noqa: F403
22

3-
from .fixtures import * # noqa, pylint: disable=wildcard-import,unused-import
3+
from .fixtures import * # noqa: F403

dvc_ssh/tests/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _check():
4545
def ssh_connection(ssh_server):
4646
from sshfs import SSHFileSystem
4747

48-
yield SSHFileSystem(
48+
return SSHFileSystem(
4949
host=ssh_server["host"],
5050
port=ssh_server["port"],
5151
username=TEST_SSH_USER,

dvc_ssh/tests/test_dvc.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
11
import pytest
2-
from dvc.testing.api_tests import ( # noqa, pylint: disable=unused-import
2+
3+
from dvc.testing.api_tests import ( # noqa: F401
34
TestAPI,
45
)
5-
from dvc.testing.remote_tests import ( # noqa, pylint: disable=unused-import
6+
from dvc.testing.remote_tests import ( # noqa: F401
67
TestRemote,
78
)
8-
from dvc.testing.workspace_tests import ( # noqa, pylint: disable=unused-import
9+
from dvc.testing.workspace_tests import ( # noqa: F401 # noqa: F401
910
TestGetUrl,
10-
)
11-
from dvc.testing.workspace_tests import TestImport as _TestImport
12-
from dvc.testing.workspace_tests import ( # noqa, pylint: disable=unused-import
1311
TestLsUrl,
1412
)
13+
from dvc.testing.workspace_tests import TestImport as _TestImport
1514

1615

1716
@pytest.fixture
1817
def cloud(make_cloud):
19-
yield make_cloud(typ="ssh")
18+
return make_cloud(typ="ssh")
2019

2120

2221
@pytest.fixture
2322
def remote(make_remote):
24-
yield make_remote(name="upstream", typ="ssh")
23+
return make_remote(name="upstream", typ="ssh")
2524

2625

2726
@pytest.fixture
2827
def workspace(make_workspace):
29-
yield make_workspace(name="workspace", typ="ssh")
28+
return make_workspace(name="workspace", typ="ssh")
3029

3130

3231
class TestImport(_TestImport):

pyproject.toml

Lines changed: 99 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,65 @@ build-backend = "setuptools.build_meta"
55
[tool.setuptools_scm]
66
write_to = "dvc_ssh/_dvc_ssh_version.py"
77

8-
[tool.black]
9-
line-length = 79
10-
include = '\.pyi?$'
11-
exclude = '''
12-
/(
13-
\.eggs
14-
| \.git
15-
| \.hg
16-
| \.mypy_cache
17-
| \.tox
18-
| \.venv
19-
| _build
20-
| buck-out
21-
| build
22-
| dist
23-
)/
24-
'''
25-
26-
[tool.isort]
27-
profile = "black"
28-
known_first_party = ["dvc_ssh"]
29-
line_length = 79
8+
[project]
9+
name = "dvc-ssh"
10+
description = "ssh plugin for dvc"
11+
readme = "README.rst"
12+
keywords = [
13+
"dvc",
14+
"ssh",
15+
]
16+
license = { text = "Apache License 2.0" }
17+
maintainers = [{ name = "Iterative", email = "[email protected]" }]
18+
authors = [{ name = "Iterative", email = "[email protected]" }]
19+
requires-python = ">=3.9"
20+
classifiers = [
21+
"Development Status :: 4 - Beta",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.9",
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
]
28+
dynamic = ["version"]
29+
dependencies = [
30+
"dvc",
31+
"sshfs[bcrypt]>=2023.4.1",
32+
]
33+
34+
[project.optional-dependencies]
35+
gssapi = ["sshfs[gssapi]>=2021.11.2"]
36+
tests = [
37+
"wheel==0.37.0",
38+
"dvc[testing]",
39+
# Test requirements
40+
"pytest==6.2.5",
41+
"pytest-cov==3.0.0",
42+
"pytest-xdist==2.4.0",
43+
"pytest-mock==3.6.1",
44+
"pytest-lazy-fixture==0.6.3",
45+
"pytest-docker>=1,<2",
46+
"flaky==3.7.0",
47+
"mock==4.0.3",
48+
"wget==3.2",
49+
"filelock==3.3.2",
50+
"xmltodict==0.12.0",
51+
# required by collective.checkdocs
52+
"Pygments==2.10.0",
53+
"collective.checkdocs==0.2",
54+
"pydocstyle==6.1.1",
55+
# type-checking
56+
"mypy==0.981",
57+
"types-requests==2.25.11",
58+
"types-tabulate==0.8.3",
59+
"types-toml==0.10.1",
60+
# optional dependencies
61+
'pywin32>=225; sys_platform == "win32"',
62+
]
63+
64+
[project.urls]
65+
Documentation = "https://dvc.org/doc"
66+
Source = "https://github.com/iterative/dvc-ssh"
3067

3168
[tool.pytest.ini_options]
3269
log_level = "debug"
@@ -51,28 +88,46 @@ warn_redundant_casts = true
5188
warn_unreachable = true
5289
files = ["dvc_ssh"]
5390

54-
[tool.pylint.master]
55-
extension-pkg-whitelist = ["pygit2"]
56-
init-hook = "import sys; sys.path.append(str('tests'))"
57-
58-
[tool.pylint.message_control]
59-
disable = [
60-
"format", "refactoring", "spelling", "design",
61-
"invalid-name", "duplicate-code", "fixme",
62-
"unused-wildcard-import", "cyclic-import", "wrong-import-order",
63-
"wrong-import-position", "ungrouped-imports", "multiple-imports",
64-
"logging-format-interpolation", "logging-fstring-interpolation",
65-
"missing-function-docstring", "missing-module-docstring",
66-
"missing-class-docstring", "raise-missing-from", "import-outside-toplevel",
91+
[tool.ruff]
92+
output-format = "full"
93+
show-fixes = true
94+
95+
[tool.ruff.lint]
96+
ignore = [
97+
"N818", "S101", "ISC001", "PT004", "PT007", "RET502", "RET503", "SIM105", "SIM108", "SIM117",
98+
"TRY003", "TRY300", "PLR2004", "PLW2901", "LOG007",
6799
]
68-
enable = ["c-extension-no-member", "no-else-return"]
100+
select = [
101+
"F", "E", "W", "C90", "I", "N", "UP", "YTT", "ASYNC", "S", "BLE", "B", "A", "C4", "T10",
102+
"EXE", "ISC", "ICN", "G", "INP", "PIE", "T20", "PYI", "PT", "Q", "RSE", "RET",
103+
"SLOT", "SIM", "TID", "TCH", "ARG", "PGH", "PLC", "PLE", "PLR", "PLW", "TRY",
104+
"FLY", "PERF101", "LOG", "RUF", "RUF022", "RUF023", "RUF024", "RUF025", "RUF026",
105+
]
106+
preview = true
107+
explicit-preview-rules = true
108+
109+
[tool.ruff.lint.flake8-pytest-style]
110+
fixture-parentheses = false
111+
mark-parentheses = false
112+
parametrize-names-type = "csv"
113+
raises-extend-require-match-for = ["dvc.exceptions.DvcException"]
114+
115+
[tool.ruff.lint.flake8-tidy-imports]
116+
117+
[tool.ruff.lint.flake8-type-checking]
118+
strict = true
119+
120+
[tool.ruff.lint.flake8-unused-arguments]
121+
ignore-variadic-names = true
122+
123+
[tool.ruff.lint.isort]
124+
known-first-party = ["dvc", "dvc_data", "dvc_objects"]
125+
126+
[tool.ruff.lint.pep8-naming]
127+
extend-ignore-names = ["M", "SCM"]
69128

70-
[tool.pylint.typecheck]
71-
generated-members = ["pytest.lazy_fixture", "logging.TRACE", "logger.trace", "sys.getwindowsversion", "argparse.Namespace"]
72-
ignored-classes = ["Dvcfile"]
73-
ignored-modules = ["azure"]
74-
signature-mutators = ["funcy.decorators.decorator"]
129+
[tool.ruff.lint.pylint]
130+
max-args = 10
75131

76-
[tool.pylint.variables]
77-
dummy-variables-rgx = "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_"
78-
ignored-argument-names = "_.*|^ignored_|^unused_|args|kwargs"
132+
[tool.ruff.lint.per-file-ignores]
133+
"dvc_ssh/tests/**" = ["S", "ARG001", "ARG002", "TRY002", "TRY301"]

0 commit comments

Comments
 (0)