docker-volume-toolkit 1.2.2__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.
@@ -0,0 +1,11 @@
1
+ # Python build artifacts
2
+ dist/
3
+ build/
4
+ *.egg-info/
5
+
6
+ # Bytecode / caches
7
+ __pycache__/
8
+ *.pyc
9
+
10
+ # Virtual environments
11
+ .venv/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 stellarshenson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,139 @@
1
+ Metadata-Version: 2.4
2
+ Name: docker-volume-toolkit
3
+ Version: 1.2.2
4
+ Summary: Docker volume toolkit - copy/migrate volumes across a name-prefix change (CLI + interactive TUI)
5
+ Project-URL: Homepage, https://github.com/stellarshenson/docker-volume-toolkit
6
+ Project-URL: Repository, https://github.com/stellarshenson/docker-volume-toolkit
7
+ Project-URL: Issues, https://github.com/stellarshenson/docker-volume-toolkit/issues
8
+ Author-email: stellarshenson <konrad.jelen@gmail.com>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: cli,devops,docker,migration,rsync,toolkit,tui,volume
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: rich>=13
26
+ Requires-Dist: textual>=0.80
27
+ Description-Content-Type: text/markdown
28
+
29
+ # docker-volume-toolkit
30
+
31
+ [![PyPI version](https://img.shields.io/pypi/v/docker-volume-toolkit.svg)](https://pypi.org/project/docker-volume-toolkit/)
32
+ [![Total PyPI downloads](https://static.pepy.tech/badge/docker-volume-toolkit)](https://pepy.tech/project/docker-volume-toolkit)
33
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
34
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
35
+
36
+ A small toolkit for Docker volumes. Its first command copies volumes from one name prefix
37
+ to another - it matches every volume named `{from_prefix}{tail}` and copies it to
38
+ `{to_prefix}{tail}`, preserving the tail (`_home`, `_workspace`, `_certs`, a
39
+ per-user suffix, anything that follows the prefix). Run it from the host that
40
+ owns the Docker volumes; it copies rather than renames, so the originals stay in
41
+ place until you have verified the result.
42
+
43
+ Run with no arguments for the interactive TUI - designer, plan, execution:
44
+
45
+ ![Designer](.resources/1-designer.png)
46
+
47
+ *Set the FROM and TO prefixes, an optional whole-name filter, the worker count, and the overwrite / remove-source toggles; a live counter shows how many discovered volumes match (`5 of 20`) and the BEFORE / AFTER panes preview the exact source and destination names.*
48
+
49
+ ![Migration plan](.resources/2-plan.png)
50
+
51
+ *Review each matched volume and its `source → destination` mapping; toggle rows with Space (a = all, n = none) and press Enter to run only the selected copies.*
52
+
53
+ ![Execution](.resources/3-execution.png)
54
+
55
+ *Live progress during the copy - an overall bar plus a per-volume bar for each parallel worker, moving through discovery and transfer.*
56
+
57
+ ## When you need it
58
+
59
+ Docker namespaces volumes by `COMPOSE_PROJECT_NAME` (for example `myproject_data`,
60
+ `myproject_shared`), and many stacks add a per-entity prefix of their own
61
+ (`jupyterlab-<user>`). Whenever that prefix changes you would otherwise lose
62
+ access to the existing data:
63
+
64
+ - renaming a deployment (`COMPOSE_PROJECT_NAME` change) renames every
65
+ `<old-project>_*` volume
66
+ - an upstream platform reworking its volume names across an upgrade
67
+
68
+ The migrator moves the data onto the new names so nothing is lost across the
69
+ rename.
70
+
71
+ ## Usage
72
+
73
+ Run with no arguments for the interactive TUI (designer → plan → execution):
74
+
75
+ ```bash
76
+ ./migrate_volumes.py
77
+ ```
78
+
79
+ Or drive it entirely from the command line:
80
+
81
+ ```bash
82
+ # preview the mapping without copying
83
+ ./migrate_volumes.py --from myproject_ --to mynewproject_ --dry-run
84
+
85
+ # copy, skipping the prompt
86
+ ./migrate_volumes.py --from myproject_ --to mynewproject_ --yes
87
+
88
+ # only the cert volumes, four parallel workers
89
+ ./migrate_volumes.py --from myproject_ --to mynewproject_ --filter '_certs$' --workers 4
90
+ ```
91
+
92
+ ## Options
93
+
94
+ - `--from PREFIX` source volume name prefix (e.g. `jupyterlab-`)
95
+ - `--to PREFIX` replacement destination prefix
96
+ - `--filter REGEX` regex applied to the full source volume name (empty = all matches)
97
+ - `--workers N` parallel copy containers (default 3)
98
+ - `--dry-run` mount both volumes and verify access, copy nothing
99
+ - `--overwrite` clean and replace a destination volume that already exists (default: error out and abort)
100
+ - `--remove-source` delete each source volume after its successful copy (default: keep sources)
101
+ - `--yes` skip the interactive plan and run from the CLI arguments
102
+
103
+ ## How it works
104
+
105
+ - each copy runs `rsync -aAX --delete` inside a disposable `alpine` container - source mounted read-only, destination read-write; all metadata preserved
106
+ - destinations are never recreated - with `--overwrite` the existing volume is kept and its contents mirrored from the source (`--delete` clears stale files)
107
+ - sources are left intact by default; after the run the tool prints the `docker volume rm` commands for every volume it copied so you can clean up once verified
108
+ - the `--filter` regex matches the whole source name; note Docker encodes `.` in volume names as `-2e` (e.g. `alice.smith` appears as `alice-2esmith`)
109
+
110
+ ## Install
111
+
112
+ Needs Docker (the tool shells out to `docker volume` and `docker run`) and Python 3.10+;
113
+ `rich>=13` and `textual>=0.80` come with it.
114
+
115
+ Install from PyPI and run the CLI:
116
+
117
+ ```bash
118
+ pip install docker-volume-toolkit
119
+ docker-volume-toolkit # interactive TUI
120
+ docker-volume-toolkit --help # CLI flags
121
+ ```
122
+
123
+ Or skip installation entirely - the script carries an inline dependency block and a
124
+ `uv run --script` shebang, so it auto-installs its own dependencies on first run:
125
+
126
+ ```bash
127
+ ./migrate_volumes.py
128
+ ```
129
+
130
+ Without `uv`, install the dependencies once and run with any Python:
131
+
132
+ ```bash
133
+ pip install rich textual
134
+ python migrate_volumes.py --help
135
+ ```
136
+
137
+ ---
138
+
139
+ *It copies volumes from one prefix to another, and then it has no further reason to exist. You will run it twice and forget it. The volumes never say thank you.*
@@ -0,0 +1,111 @@
1
+ # docker-volume-toolkit
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/docker-volume-toolkit.svg)](https://pypi.org/project/docker-volume-toolkit/)
4
+ [![Total PyPI downloads](https://static.pepy.tech/badge/docker-volume-toolkit)](https://pepy.tech/project/docker-volume-toolkit)
5
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+
8
+ A small toolkit for Docker volumes. Its first command copies volumes from one name prefix
9
+ to another - it matches every volume named `{from_prefix}{tail}` and copies it to
10
+ `{to_prefix}{tail}`, preserving the tail (`_home`, `_workspace`, `_certs`, a
11
+ per-user suffix, anything that follows the prefix). Run it from the host that
12
+ owns the Docker volumes; it copies rather than renames, so the originals stay in
13
+ place until you have verified the result.
14
+
15
+ Run with no arguments for the interactive TUI - designer, plan, execution:
16
+
17
+ ![Designer](.resources/1-designer.png)
18
+
19
+ *Set the FROM and TO prefixes, an optional whole-name filter, the worker count, and the overwrite / remove-source toggles; a live counter shows how many discovered volumes match (`5 of 20`) and the BEFORE / AFTER panes preview the exact source and destination names.*
20
+
21
+ ![Migration plan](.resources/2-plan.png)
22
+
23
+ *Review each matched volume and its `source → destination` mapping; toggle rows with Space (a = all, n = none) and press Enter to run only the selected copies.*
24
+
25
+ ![Execution](.resources/3-execution.png)
26
+
27
+ *Live progress during the copy - an overall bar plus a per-volume bar for each parallel worker, moving through discovery and transfer.*
28
+
29
+ ## When you need it
30
+
31
+ Docker namespaces volumes by `COMPOSE_PROJECT_NAME` (for example `myproject_data`,
32
+ `myproject_shared`), and many stacks add a per-entity prefix of their own
33
+ (`jupyterlab-<user>`). Whenever that prefix changes you would otherwise lose
34
+ access to the existing data:
35
+
36
+ - renaming a deployment (`COMPOSE_PROJECT_NAME` change) renames every
37
+ `<old-project>_*` volume
38
+ - an upstream platform reworking its volume names across an upgrade
39
+
40
+ The migrator moves the data onto the new names so nothing is lost across the
41
+ rename.
42
+
43
+ ## Usage
44
+
45
+ Run with no arguments for the interactive TUI (designer → plan → execution):
46
+
47
+ ```bash
48
+ ./migrate_volumes.py
49
+ ```
50
+
51
+ Or drive it entirely from the command line:
52
+
53
+ ```bash
54
+ # preview the mapping without copying
55
+ ./migrate_volumes.py --from myproject_ --to mynewproject_ --dry-run
56
+
57
+ # copy, skipping the prompt
58
+ ./migrate_volumes.py --from myproject_ --to mynewproject_ --yes
59
+
60
+ # only the cert volumes, four parallel workers
61
+ ./migrate_volumes.py --from myproject_ --to mynewproject_ --filter '_certs$' --workers 4
62
+ ```
63
+
64
+ ## Options
65
+
66
+ - `--from PREFIX` source volume name prefix (e.g. `jupyterlab-`)
67
+ - `--to PREFIX` replacement destination prefix
68
+ - `--filter REGEX` regex applied to the full source volume name (empty = all matches)
69
+ - `--workers N` parallel copy containers (default 3)
70
+ - `--dry-run` mount both volumes and verify access, copy nothing
71
+ - `--overwrite` clean and replace a destination volume that already exists (default: error out and abort)
72
+ - `--remove-source` delete each source volume after its successful copy (default: keep sources)
73
+ - `--yes` skip the interactive plan and run from the CLI arguments
74
+
75
+ ## How it works
76
+
77
+ - each copy runs `rsync -aAX --delete` inside a disposable `alpine` container - source mounted read-only, destination read-write; all metadata preserved
78
+ - destinations are never recreated - with `--overwrite` the existing volume is kept and its contents mirrored from the source (`--delete` clears stale files)
79
+ - sources are left intact by default; after the run the tool prints the `docker volume rm` commands for every volume it copied so you can clean up once verified
80
+ - the `--filter` regex matches the whole source name; note Docker encodes `.` in volume names as `-2e` (e.g. `alice.smith` appears as `alice-2esmith`)
81
+
82
+ ## Install
83
+
84
+ Needs Docker (the tool shells out to `docker volume` and `docker run`) and Python 3.10+;
85
+ `rich>=13` and `textual>=0.80` come with it.
86
+
87
+ Install from PyPI and run the CLI:
88
+
89
+ ```bash
90
+ pip install docker-volume-toolkit
91
+ docker-volume-toolkit # interactive TUI
92
+ docker-volume-toolkit --help # CLI flags
93
+ ```
94
+
95
+ Or skip installation entirely - the script carries an inline dependency block and a
96
+ `uv run --script` shebang, so it auto-installs its own dependencies on first run:
97
+
98
+ ```bash
99
+ ./migrate_volumes.py
100
+ ```
101
+
102
+ Without `uv`, install the dependencies once and run with any Python:
103
+
104
+ ```bash
105
+ pip install rich textual
106
+ python migrate_volumes.py --help
107
+ ```
108
+
109
+ ---
110
+
111
+ *It copies volumes from one prefix to another, and then it has no further reason to exist. You will run it twice and forget it. The volumes never say thank you.*