dvc-utils 0.2.0__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,22 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: dvc-utils
3
- Version: 0.2.0
4
- Summary: CLI for diffing DVC files at two commits (or one commit vs. current worktree), optionally passing both through another command first
5
- Home-page: https://github.com/runsascoded/dvc-utils
6
- Author: Ryan Williams
7
- Author-email: ryan@runsascoded.com
3
+ Version: 0.3.0
4
+ Summary: CLI for diffing DVC-tracked files at two commits (or one commit vs. current worktree), optionally passing both through another command first
5
+ Author-email: Ryan Williams <ryan@runsascoded.com>
8
6
  License: MIT
7
+ Project-URL: Homepage, https://github.com/runsascoded/dvc-utils
8
+ Project-URL: Author URL, https://github.com/ryan-williams
9
+ Requires-Python: >=3.9
9
10
  Description-Content-Type: text/markdown
10
11
  License-File: LICENSE
12
+ Requires-Dist: click
13
+ Requires-Dist: dffs>=0.0.5
14
+ Requires-Dist: pyyaml
15
+ Requires-Dist: utz>=0.20.0
16
+ Provides-Extra: ci
17
+ Requires-Dist: bmdf==0.5.2; extra == "ci"
18
+ Requires-Dist: dvc-s3; extra == "ci"
19
+ Dynamic: license-file
11
20
 
12
21
  # dvc-utils
13
22
  Diff [DVC] files, optionally piping through other commands first.
@@ -32,25 +41,11 @@ pip install dvc-utils
32
41
  ```
33
42
 
34
43
  ## Usage <a id="usage"></a>
35
- <!-- `bmdf -- dvc-utils --help` -->
36
- ```bash
37
- dvc-utils --help
38
- # Usage: dvc-utils [OPTIONS] COMMAND [ARGS]...
39
- #
40
- # Options:
41
- # --help Show this message and exit.
42
- #
43
- # Commands:
44
- # diff Diff a DVC-tracked file at two commits (or one commit vs. current
45
- # worktree), optionally passing both through another command first
46
- ```
47
-
48
- The single subcommand, `dvc-utils diff`, is also exposed directly as `dvc-dff`:
44
+ Currently one command is exposed, `dvc-diff`:
49
45
 
50
- ### `dvc-diff` <a id="dvc-diff"></a>
51
- <!-- `bmdf -- dvc-diff --help` -->
46
+ <!-- `bmdf -- dvc-diff` -->
52
47
  ```bash
53
- dvc-diff --help
48
+ dvc-diff
54
49
  # Usage: dvc-diff [OPTIONS] [exec_cmd...] <path>
55
50
  #
56
51
  # Diff a file at two commits (or one commit vs. current worktree), optionally
@@ -87,9 +82,8 @@ dvc-diff --help
87
82
  ```
88
83
 
89
84
  ## Examples <a id="examples"></a>
90
- These examples are verified with [`mdcmd`] and `$BMDF_WORKDIR=test/data`
91
-
92
- ([`test/data`] is a clone of [ryan-williams/dvc-helpers@test], which contains simple DVC-tracked files used for testing [`git-diff-dvc.sh`])
85
+ - Examples below are verified with [`mdcmd`] and `$BMDF_WORKDIR=test/data` (see [.github/workflows/ci.yml](.github/workflows/ci.yml)).
86
+ - [test/data] is a clone of [ryan-williams/dvc-helpers@test], which contains simple DVC-tracked files (used in that repo for testing [`git-diff-dvc.sh`]).
93
87
 
94
88
  [`8ec2060`] added a DVC-tracked text file, `test.txt`:
95
89
 
@@ -159,9 +153,9 @@ dvc-diff -R f92c1d2 pqa test.parquet
159
153
 
160
154
  [`f29e52a`] updated `test.parquet`:
161
155
 
162
- <!-- `bmdf -- dvc-diff -R f29e52a pqa test.parquet` -->
156
+ <!-- `bmdf -E PQT_TXT_OPTS=-n2 -- dvc-diff -R f29e52a pqa test.parquet` -->
163
157
  ```bash
164
- dvc-diff -R f29e52a pqa test.parquet
158
+ PQT_TXT_OPTS=-n2 dvc-diff -R f29e52a pqa test.parquet
165
159
  # 1,3c1,3
166
160
  # < MD5: 4379600b26647a50dfcd0daa824e8219
167
161
  # < 1635 bytes
@@ -174,17 +168,16 @@ dvc-diff -R f29e52a pqa test.parquet
174
168
  # < OPTIONAL INT64 num;
175
169
  # ---
176
170
  # > OPTIONAL INT32 num;
177
- # 26a27,38
178
- # > }
179
- # > {
180
- # > "num": 666,
181
- # > "str": "fff"
182
- # > }
183
- # > {
171
+ # 19,20c19,20
172
+ # < "num": 444,
173
+ # < "str": "ddd"
174
+ # ---
184
175
  # > "num": 777,
185
176
  # > "str": "ggg"
186
- # > }
187
- # > {
177
+ # 23,24c23,24
178
+ # < "num": 555,
179
+ # < "str": "eee"
180
+ # ---
188
181
  # > "num": 888,
189
182
  # > "str": "hhh"
190
183
  ```
@@ -458,6 +451,7 @@ This helped me see that the data update in question (`c0..c1`) dropped some fiel
458
451
 
459
452
  [`mdcmd`]: https://github.com/runsascoded/bash-markdown-fence?tab=readme-ov-file#bmdf
460
453
  [`test/data`]: test/data
454
+ [test/data]: test/data
461
455
  [ryan-williams/dvc-helpers@test]: https://github.com/ryan-williams/dvc-helpers/tree/test
462
456
  [`git-diff-dvc.sh`]: https://github.com/ryan-williams/dvc-helpers/blob/main/git-diff-dvc.sh
463
457
 
@@ -21,25 +21,11 @@ pip install dvc-utils
21
21
  ```
22
22
 
23
23
  ## Usage <a id="usage"></a>
24
- <!-- `bmdf -- dvc-utils --help` -->
25
- ```bash
26
- dvc-utils --help
27
- # Usage: dvc-utils [OPTIONS] COMMAND [ARGS]...
28
- #
29
- # Options:
30
- # --help Show this message and exit.
31
- #
32
- # Commands:
33
- # diff Diff a DVC-tracked file at two commits (or one commit vs. current
34
- # worktree), optionally passing both through another command first
35
- ```
36
-
37
- The single subcommand, `dvc-utils diff`, is also exposed directly as `dvc-dff`:
24
+ Currently one command is exposed, `dvc-diff`:
38
25
 
39
- ### `dvc-diff` <a id="dvc-diff"></a>
40
- <!-- `bmdf -- dvc-diff --help` -->
26
+ <!-- `bmdf -- dvc-diff` -->
41
27
  ```bash
42
- dvc-diff --help
28
+ dvc-diff
43
29
  # Usage: dvc-diff [OPTIONS] [exec_cmd...] <path>
44
30
  #
45
31
  # Diff a file at two commits (or one commit vs. current worktree), optionally
@@ -76,9 +62,8 @@ dvc-diff --help
76
62
  ```
77
63
 
78
64
  ## Examples <a id="examples"></a>
79
- These examples are verified with [`mdcmd`] and `$BMDF_WORKDIR=test/data`
80
-
81
- ([`test/data`] is a clone of [ryan-williams/dvc-helpers@test], which contains simple DVC-tracked files used for testing [`git-diff-dvc.sh`])
65
+ - Examples below are verified with [`mdcmd`] and `$BMDF_WORKDIR=test/data` (see [.github/workflows/ci.yml](.github/workflows/ci.yml)).
66
+ - [test/data] is a clone of [ryan-williams/dvc-helpers@test], which contains simple DVC-tracked files (used in that repo for testing [`git-diff-dvc.sh`]).
82
67
 
83
68
  [`8ec2060`] added a DVC-tracked text file, `test.txt`:
84
69
 
@@ -148,9 +133,9 @@ dvc-diff -R f92c1d2 pqa test.parquet
148
133
 
149
134
  [`f29e52a`] updated `test.parquet`:
150
135
 
151
- <!-- `bmdf -- dvc-diff -R f29e52a pqa test.parquet` -->
136
+ <!-- `bmdf -E PQT_TXT_OPTS=-n2 -- dvc-diff -R f29e52a pqa test.parquet` -->
152
137
  ```bash
153
- dvc-diff -R f29e52a pqa test.parquet
138
+ PQT_TXT_OPTS=-n2 dvc-diff -R f29e52a pqa test.parquet
154
139
  # 1,3c1,3
155
140
  # < MD5: 4379600b26647a50dfcd0daa824e8219
156
141
  # < 1635 bytes
@@ -163,17 +148,16 @@ dvc-diff -R f29e52a pqa test.parquet
163
148
  # < OPTIONAL INT64 num;
164
149
  # ---
165
150
  # > OPTIONAL INT32 num;
166
- # 26a27,38
167
- # > }
168
- # > {
169
- # > "num": 666,
170
- # > "str": "fff"
171
- # > }
172
- # > {
151
+ # 19,20c19,20
152
+ # < "num": 444,
153
+ # < "str": "ddd"
154
+ # ---
173
155
  # > "num": 777,
174
156
  # > "str": "ggg"
175
- # > }
176
- # > {
157
+ # 23,24c23,24
158
+ # < "num": 555,
159
+ # < "str": "eee"
160
+ # ---
177
161
  # > "num": 888,
178
162
  # > "str": "hhh"
179
163
  ```
@@ -447,6 +431,7 @@ This helped me see that the data update in question (`c0..c1`) dropped some fiel
447
431
 
448
432
  [`mdcmd`]: https://github.com/runsascoded/bash-markdown-fence?tab=readme-ov-file#bmdf
449
433
  [`test/data`]: test/data
434
+ [test/data]: test/data
450
435
  [ryan-williams/dvc-helpers@test]: https://github.com/ryan-williams/dvc-helpers/tree/test
451
436
  [`git-diff-dvc.sh`]: https://github.com/ryan-williams/dvc-helpers/blob/main/git-diff-dvc.sh
452
437
 
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["setuptools>=75"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dvc-utils"
7
+ version = "0.3.0"
8
+ description = "CLI for diffing DVC-tracked files at two commits (or one commit vs. current worktree), optionally passing both through another command first"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "Ryan Williams", email = "ryan@runsascoded.com"}
13
+ ]
14
+ requires-python = ">=3.9"
15
+ dependencies = [
16
+ "click",
17
+ "dffs>=0.0.5",
18
+ "pyyaml",
19
+ "utz>=0.20.0",
20
+ ]
21
+
22
+ [project.optional-dependencies]
23
+ ci = [
24
+ "bmdf==0.5.2",
25
+ "dvc-s3",
26
+ ]
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/runsascoded/dvc-utils"
30
+ "Author URL" = "https://github.com/ryan-williams"
31
+
32
+ [project.scripts]
33
+ dvc-utils = "dvc_utils.main:main"
34
+ dvc-diff = "dvc_utils.diff:dvc_diff"
35
+
36
+ [tool.setuptools]
37
+ package-dir = {"" = "src"}
38
+
39
+ [tool.setuptools.packages.find]
40
+ where = ["src"]
@@ -1,2 +1,2 @@
1
- from . import cli, path
1
+ from . import cli, diff, path
2
2
  from .path import dvc_cache_dir, dvc_md5, dvc_paths, dvc_path
@@ -0,0 +1,17 @@
1
+ import json
2
+ import shlex
3
+ from os import listdir
4
+ from os.path import isdir, join
5
+ from typing import Tuple
6
+
7
+ import click
8
+ from click import option, argument, group
9
+ from dffs import join_pipelines
10
+ from utz import process, err, hash_file
11
+
12
+ from dvc_utils.path import dvc_paths, dvc_cache_path
13
+
14
+
15
+ @group()
16
+ def cli():
17
+ pass
@@ -6,18 +6,18 @@ from typing import Tuple
6
6
 
7
7
  import click
8
8
  from click import option, argument, group
9
- from qmdx import join_pipelines
9
+ from dffs import join_pipelines
10
10
  from utz import process, err, hash_file
11
11
 
12
+ from dvc_utils.cli import cli
12
13
  from dvc_utils.path import dvc_paths, dvc_cache_path
13
14
 
14
15
 
15
- @group()
16
- def cli():
17
- pass
18
-
19
-
20
- @cli.command('diff', short_help='Diff a DVC-tracked file at two commits (or one commit vs. current worktree), optionally passing both through another command first')
16
+ @cli.command(
17
+ 'diff',
18
+ short_help='Diff a DVC-tracked file at two commits (or one commit vs. current worktree), optionally passing both through another command first',
19
+ no_args_is_help=True,
20
+ )
21
21
  @option('-c/-C', '--color/--no-color', default=None, help='Force or prevent colorized output')
22
22
  @option('-r', '--refspec', help='<commit 1>..<commit 2> (compare two commits) or <commit> (compare <commit> to the worktree)')
23
23
  @option('-R', '--ref', help='Shorthand for `-r <ref>^..<ref>`, i.e. inspect a specific commit (vs. its parent)')
@@ -28,7 +28,7 @@ def cli():
28
28
  @option('-w', '--ignore-whitespace', is_flag=True, help="Ignore whitespace differences (pass `-w` to `diff`)")
29
29
  @option('-x', '--exec-cmd', 'exec_cmds', multiple=True, help='Command(s) to execute before diffing; alternate syntax to passing commands as positional arguments')
30
30
  @argument('args', metavar='[exec_cmd...] <path>', nargs=-1)
31
- def dvc_utils_diff(
31
+ def dvc_diff(
32
32
  color: bool | None,
33
33
  refspec: str | None,
34
34
  ref: str | None,
@@ -122,7 +122,3 @@ def dvc_utils_diff(
122
122
  else:
123
123
  res = process.run('diff', *diff_args, path1 or '/dev/null', path2 or '/dev/null', log=log, check=False)
124
124
  exit(res.returncode)
125
-
126
-
127
- if __name__ == '__main__':
128
- cli()
@@ -0,0 +1,9 @@
1
+ from dvc_utils.cli import cli
2
+ from dvc_utils import diff
3
+
4
+ def main():
5
+ cli()
6
+
7
+
8
+ if __name__ == '__main__':
9
+ cli()
@@ -49,8 +49,13 @@ def dvc_md5(
49
49
  dir_path = get_dir_path()
50
50
  dir_path = '' if dir_path == '.' else f'{dir_path}{sep}'
51
51
  dvc_path = f"{dir_path}{dvc_path}"
52
- dvc_spec = process.output('git', 'show', f'{git_ref}:{dvc_path}', log=err if log else None, err_ok=True, stderr=DEVNULL)
53
- if dvc_spec is None:
52
+ dvc_spec = process.output(
53
+ 'git', 'show', f'{git_ref}:{dvc_path}',
54
+ err_ok=True,
55
+ log=err if log else None,
56
+ stderr=None if log else DEVNULL,
57
+ )
58
+ if not dvc_spec:
54
59
  cur_dir = dirname(dvc_path)
55
60
  relpath = basename(dvc_path)
56
61
  if relpath.endswith(".dvc"):
@@ -0,0 +1,13 @@
1
+ from click import option
2
+
3
+ from dvc_utils.cli import cli
4
+ from git import Repo
5
+
6
+
7
+ @cli.command('pull-x', short_help='Sync DVC cache files from an S3 remote')
8
+ @option('-n', '--dry-run', is_flag=True, help='Print files that would be synced, don\'t actually perform sync')
9
+ @option('-p', '--path', 'paths', multiple=True, help='Path globs to sync')
10
+ @option('-r', '--ref', 'refs', multiple=True, help='Git refs to sync DVC files from')
11
+ def pull_x(dry_run, paths, refs):
12
+ repo = Repo()
13
+
@@ -1,13 +1,22 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: dvc-utils
3
- Version: 0.2.0
4
- Summary: CLI for diffing DVC files at two commits (or one commit vs. current worktree), optionally passing both through another command first
5
- Home-page: https://github.com/runsascoded/dvc-utils
6
- Author: Ryan Williams
7
- Author-email: ryan@runsascoded.com
3
+ Version: 0.3.0
4
+ Summary: CLI for diffing DVC-tracked files at two commits (or one commit vs. current worktree), optionally passing both through another command first
5
+ Author-email: Ryan Williams <ryan@runsascoded.com>
8
6
  License: MIT
7
+ Project-URL: Homepage, https://github.com/runsascoded/dvc-utils
8
+ Project-URL: Author URL, https://github.com/ryan-williams
9
+ Requires-Python: >=3.9
9
10
  Description-Content-Type: text/markdown
10
11
  License-File: LICENSE
12
+ Requires-Dist: click
13
+ Requires-Dist: dffs>=0.0.5
14
+ Requires-Dist: pyyaml
15
+ Requires-Dist: utz>=0.20.0
16
+ Provides-Extra: ci
17
+ Requires-Dist: bmdf==0.5.2; extra == "ci"
18
+ Requires-Dist: dvc-s3; extra == "ci"
19
+ Dynamic: license-file
11
20
 
12
21
  # dvc-utils
13
22
  Diff [DVC] files, optionally piping through other commands first.
@@ -32,25 +41,11 @@ pip install dvc-utils
32
41
  ```
33
42
 
34
43
  ## Usage <a id="usage"></a>
35
- <!-- `bmdf -- dvc-utils --help` -->
36
- ```bash
37
- dvc-utils --help
38
- # Usage: dvc-utils [OPTIONS] COMMAND [ARGS]...
39
- #
40
- # Options:
41
- # --help Show this message and exit.
42
- #
43
- # Commands:
44
- # diff Diff a DVC-tracked file at two commits (or one commit vs. current
45
- # worktree), optionally passing both through another command first
46
- ```
47
-
48
- The single subcommand, `dvc-utils diff`, is also exposed directly as `dvc-dff`:
44
+ Currently one command is exposed, `dvc-diff`:
49
45
 
50
- ### `dvc-diff` <a id="dvc-diff"></a>
51
- <!-- `bmdf -- dvc-diff --help` -->
46
+ <!-- `bmdf -- dvc-diff` -->
52
47
  ```bash
53
- dvc-diff --help
48
+ dvc-diff
54
49
  # Usage: dvc-diff [OPTIONS] [exec_cmd...] <path>
55
50
  #
56
51
  # Diff a file at two commits (or one commit vs. current worktree), optionally
@@ -87,9 +82,8 @@ dvc-diff --help
87
82
  ```
88
83
 
89
84
  ## Examples <a id="examples"></a>
90
- These examples are verified with [`mdcmd`] and `$BMDF_WORKDIR=test/data`
91
-
92
- ([`test/data`] is a clone of [ryan-williams/dvc-helpers@test], which contains simple DVC-tracked files used for testing [`git-diff-dvc.sh`])
85
+ - Examples below are verified with [`mdcmd`] and `$BMDF_WORKDIR=test/data` (see [.github/workflows/ci.yml](.github/workflows/ci.yml)).
86
+ - [test/data] is a clone of [ryan-williams/dvc-helpers@test], which contains simple DVC-tracked files (used in that repo for testing [`git-diff-dvc.sh`]).
93
87
 
94
88
  [`8ec2060`] added a DVC-tracked text file, `test.txt`:
95
89
 
@@ -159,9 +153,9 @@ dvc-diff -R f92c1d2 pqa test.parquet
159
153
 
160
154
  [`f29e52a`] updated `test.parquet`:
161
155
 
162
- <!-- `bmdf -- dvc-diff -R f29e52a pqa test.parquet` -->
156
+ <!-- `bmdf -E PQT_TXT_OPTS=-n2 -- dvc-diff -R f29e52a pqa test.parquet` -->
163
157
  ```bash
164
- dvc-diff -R f29e52a pqa test.parquet
158
+ PQT_TXT_OPTS=-n2 dvc-diff -R f29e52a pqa test.parquet
165
159
  # 1,3c1,3
166
160
  # < MD5: 4379600b26647a50dfcd0daa824e8219
167
161
  # < 1635 bytes
@@ -174,17 +168,16 @@ dvc-diff -R f29e52a pqa test.parquet
174
168
  # < OPTIONAL INT64 num;
175
169
  # ---
176
170
  # > OPTIONAL INT32 num;
177
- # 26a27,38
178
- # > }
179
- # > {
180
- # > "num": 666,
181
- # > "str": "fff"
182
- # > }
183
- # > {
171
+ # 19,20c19,20
172
+ # < "num": 444,
173
+ # < "str": "ddd"
174
+ # ---
184
175
  # > "num": 777,
185
176
  # > "str": "ggg"
186
- # > }
187
- # > {
177
+ # 23,24c23,24
178
+ # < "num": 555,
179
+ # < "str": "eee"
180
+ # ---
188
181
  # > "num": 888,
189
182
  # > "str": "hhh"
190
183
  ```
@@ -458,6 +451,7 @@ This helped me see that the data update in question (`c0..c1`) dropped some fiel
458
451
 
459
452
  [`mdcmd`]: https://github.com/runsascoded/bash-markdown-fence?tab=readme-ov-file#bmdf
460
453
  [`test/data`]: test/data
454
+ [test/data]: test/data
461
455
  [ryan-williams/dvc-helpers@test]: https://github.com/ryan-williams/dvc-helpers/tree/test
462
456
  [`git-diff-dvc.sh`]: https://github.com/ryan-williams/dvc-helpers/blob/main/git-diff-dvc.sh
463
457
 
@@ -1,9 +1,12 @@
1
1
  LICENSE
2
2
  README.md
3
- setup.py
3
+ pyproject.toml
4
4
  src/dvc_utils/__init__.py
5
5
  src/dvc_utils/cli.py
6
+ src/dvc_utils/diff.py
7
+ src/dvc_utils/main.py
6
8
  src/dvc_utils/path.py
9
+ src/dvc_utils/sync.py
7
10
  src/dvc_utils.egg-info/PKG-INFO
8
11
  src/dvc_utils.egg-info/SOURCES.txt
9
12
  src/dvc_utils.egg-info/dependency_links.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ dvc-diff = dvc_utils.diff:dvc_diff
3
+ dvc-utils = dvc_utils.main:main
@@ -0,0 +1,8 @@
1
+ click
2
+ dffs>=0.0.5
3
+ pyyaml
4
+ utz>=0.20.0
5
+
6
+ [ci]
7
+ bmdf==0.5.2
8
+ dvc-s3
dvc-utils-0.2.0/setup.py DELETED
@@ -1,23 +0,0 @@
1
- from setuptools import setup, find_packages
2
-
3
- setup(
4
- name='dvc-utils',
5
- version="0.2.0",
6
- description="CLI for diffing DVC files at two commits (or one commit vs. current worktree), optionally passing both through another command first",
7
- long_description=open("README.md").read(),
8
- long_description_content_type="text/markdown",
9
- package_dir={"": "src"},
10
- packages=find_packages(where="src"),
11
- install_requires=open("requirements.txt").read(),
12
- entry_points={
13
- 'console_scripts': [
14
- 'dvc-utils = dvc_utils.cli:cli',
15
- 'dvc-diff = dvc_utils.cli:dvc_utils_diff',
16
- ],
17
- },
18
- license="MIT",
19
- author="Ryan Williams",
20
- author_email="ryan@runsascoded.com",
21
- author_url="https://github.com/ryan-williams",
22
- url="https://github.com/runsascoded/dvc-utils",
23
- )
@@ -1,3 +0,0 @@
1
- [console_scripts]
2
- dvc-diff = dvc_utils.cli:dvc_utils_diff
3
- dvc-utils = dvc_utils.cli:cli
@@ -1,4 +0,0 @@
1
- click
2
- pyyaml
3
- qmdx>=0.0.5
4
- utz>=0.13.0
File without changes
File without changes