setup-ssh-cli 0.1.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.
Files changed (38) hide show
  1. setup_ssh_cli-0.1.0/CONTRIBUTING.md +27 -0
  2. setup_ssh_cli-0.1.0/LICENSE +21 -0
  3. setup_ssh_cli-0.1.0/MANIFEST.in +4 -0
  4. setup_ssh_cli-0.1.0/PKG-INFO +115 -0
  5. setup_ssh_cli-0.1.0/README.md +91 -0
  6. setup_ssh_cli-0.1.0/SECURITY.md +47 -0
  7. setup_ssh_cli-0.1.0/dev.ps1 +61 -0
  8. setup_ssh_cli-0.1.0/dev.sh +32 -0
  9. setup_ssh_cli-0.1.0/docs/development.md +81 -0
  10. setup_ssh_cli-0.1.0/docs/publishing.md +77 -0
  11. setup_ssh_cli-0.1.0/docs/troubleshooting.md +153 -0
  12. setup_ssh_cli-0.1.0/docs/usage.md +261 -0
  13. setup_ssh_cli-0.1.0/pyproject.toml +52 -0
  14. setup_ssh_cli-0.1.0/scripts/dev.py +131 -0
  15. setup_ssh_cli-0.1.0/setup.cfg +4 -0
  16. setup_ssh_cli-0.1.0/src/setup_ssh/__init__.py +3 -0
  17. setup_ssh_cli-0.1.0/src/setup_ssh/__main__.py +3 -0
  18. setup_ssh_cli-0.1.0/src/setup_ssh/cli.py +216 -0
  19. setup_ssh_cli-0.1.0/src/setup_ssh/fleet.py +228 -0
  20. setup_ssh_cli-0.1.0/src/setup_ssh/render.py +106 -0
  21. setup_ssh_cli-0.1.0/src/setup_ssh/state.py +159 -0
  22. setup_ssh_cli-0.1.0/src/setup_ssh/templates/posix.sh +110 -0
  23. setup_ssh_cli-0.1.0/src/setup_ssh/templates/windows.ps1 +184 -0
  24. setup_ssh_cli-0.1.0/src/setup_ssh/transport.py +427 -0
  25. setup_ssh_cli-0.1.0/src/setup_ssh_cli.egg-info/PKG-INFO +115 -0
  26. setup_ssh_cli-0.1.0/src/setup_ssh_cli.egg-info/SOURCES.txt +36 -0
  27. setup_ssh_cli-0.1.0/src/setup_ssh_cli.egg-info/dependency_links.txt +1 -0
  28. setup_ssh_cli-0.1.0/src/setup_ssh_cli.egg-info/entry_points.txt +2 -0
  29. setup_ssh_cli-0.1.0/src/setup_ssh_cli.egg-info/requires.txt +1 -0
  30. setup_ssh_cli-0.1.0/src/setup_ssh_cli.egg-info/top_level.txt +1 -0
  31. setup_ssh_cli-0.1.0/tests/test_cli.py +67 -0
  32. setup_ssh_cli-0.1.0/tests/test_dev.py +131 -0
  33. setup_ssh_cli-0.1.0/tests/test_fleet_integration.py +371 -0
  34. setup_ssh_cli-0.1.0/tests/test_posix.py +122 -0
  35. setup_ssh_cli-0.1.0/tests/test_powershell.py +107 -0
  36. setup_ssh_cli-0.1.0/tests/test_state.py +54 -0
  37. setup_ssh_cli-0.1.0/tests/test_transport.py +63 -0
  38. setup_ssh_cli-0.1.0/uv.lock +417 -0
@@ -0,0 +1,27 @@
1
+ # Contributing
2
+
3
+ Found a bug, have an idea, or just want to change something? Open an issue or send
4
+ a PR. Fixes, docs, little improvements—whatever you think would help.
5
+
6
+ This is mostly a personal project, so I'll check issues and PRs when I have time.
7
+ It might take a while. Just leave a bit of context about what you changed or what
8
+ went wrong so I can follow along.
9
+
10
+ I use **AI-driven development** for this project, so AI-assisted PRs are welcome
11
+ too.
12
+
13
+ If you want to run it locally:
14
+
15
+ ```sh
16
+ ./dev.sh develop
17
+ ./dev.sh run --help
18
+ ./dev.sh test
19
+ ./dev.sh check
20
+ ```
21
+
22
+ Use `.\dev.ps1` on Windows with the same commands. `fmt` formats the code,
23
+ `reinstall` updates your installed copy, and `build` makes the release files.
24
+ The [dev command notes](docs/development.md) cover the rest.
25
+
26
+ For security issues, see [SECURITY.md](SECURITY.md).
27
+ Contributions use the same [MIT license](LICENSE) as the rest of the project.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 beepboopbit
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,4 @@
1
+ include LICENSE README.md CONTRIBUTING.md SECURITY.md
2
+ include dev.sh dev.ps1 uv.lock
3
+ include scripts/dev.py
4
+ recursive-include docs *.md
@@ -0,0 +1,115 @@
1
+ Metadata-Version: 2.4
2
+ Name: setup-ssh-cli
3
+ Version: 0.1.0
4
+ Summary: Set up passwordless SSH between your Linux, Windows, and macOS devices.
5
+ Author: beepboopbit
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/BeepBoopBit/setup-ssh
8
+ Project-URL: Issues, https://github.com/BeepBoopBit/setup-ssh/issues
9
+ Project-URL: Documentation, https://github.com/BeepBoopBit/setup-ssh#readme
10
+ Keywords: ssh,openssh,passwordless,netbird,cli
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Operating System :: Microsoft :: Windows
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: System :: Systems Administration
19
+ Requires-Python: >=3.11
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: paramiko<5,>=3.4
23
+ Dynamic: license-file
24
+
25
+ # setup-ssh
26
+
27
+ I made this because my lazy ass got tired of setting up SSH keys and remembering
28
+ IP addresses whenever I wanted to use another computer.
29
+
30
+ It's mostly for my own Linux, Mac, and Windows machines. Add them, sync, and then
31
+ use shortcuts like `ssh mac` or `ssh linux`. It sets up passwordless access in
32
+ both directions between the accounts you add.
33
+
34
+ This project uses **AI-driven development**. I use AI tools to help write the code
35
+ and docs and work through fixes.
36
+
37
+ ## Get it running
38
+
39
+ You'll need Python 3.11+ on the computer running setup. The other computers just
40
+ need OpenSSH enabled and a working network connection. LAN is fine; I use NetBird
41
+ too, but you need to set that up separately.
42
+
43
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then get the
44
+ published package from PyPI:
45
+
46
+ ```sh
47
+ uv tool install setup-ssh-cli
48
+ setup-ssh init
49
+ ```
50
+
51
+ This works on Linux, macOS, and Windows. Update later with
52
+ `uv tool upgrade setup-ssh-cli`.
53
+
54
+ Or use `python -m pip install setup-ssh-cli` inside a virtual environment.
55
+
56
+ Working from a clone of this repository? Use `./dev.sh install` instead, or
57
+ `.\dev.ps1 install` on Windows. `setup-ssh init` is the part that sets up your
58
+ devices.
59
+
60
+ Include your current computer in the wizard. It'll ask for each device's name,
61
+ address, username, OS, and SSH port. Keep the devices online for this first setup.
62
+ Verify the host fingerprints when asked; you may need each account's password
63
+ once so setup can install the keys.
64
+
65
+ After a successful sync:
66
+
67
+ ```sh
68
+ ssh mac # from Linux
69
+ ssh linux # from the Mac
70
+ scp notes.txt mac:~/
71
+ ```
72
+
73
+ Use whatever names you gave your devices. Each computer keeps its own private
74
+ key, and you don't need to run setup again just to SSH into something.
75
+
76
+ ## Add another computer
77
+
78
+ Enable SSH on it, then run these from your original setup computer:
79
+
80
+ ```sh
81
+ setup-ssh add --no-sync
82
+ setup-ssh sync --skip-offline
83
+ ```
84
+
85
+ That sets up whichever computers are available. Run sync again when the others
86
+ are online so they get the new keys too. If everyone's online, `setup-ssh add`
87
+ does both steps for you.
88
+
89
+ ## Commands I use
90
+
91
+ ```sh
92
+ setup-ssh list # saved devices
93
+ setup-ssh sync --skip-offline # update the ones that are online
94
+ setup-ssh --batch sync --skip-offline # same, with no password/trust prompts
95
+ setup-ssh check # test every direction; all devices online
96
+ setup-ssh remove desktop # remove a device's managed access
97
+ setup-ssh doctor --os windows # SSH setup instructions for an OS
98
+ setup-ssh --help
99
+ ```
100
+
101
+ Removing a device needs to reach the other computers to revoke its access there.
102
+ If some are offline, sync them later.
103
+
104
+ ## More details
105
+
106
+ The longer explanations live here:
107
+
108
+ - [Usage guide](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/usage.md) — all the options, files, backups, and how keys work.
109
+ - [Troubleshooting](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/troubleshooting.md) — when something inevitably refuses to connect.
110
+ - [Contributing](https://github.com/BeepBoopBit/setup-ssh/blob/main/CONTRIBUTING.md) — running it locally and working on the code.
111
+ - [Dev commands](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/development.md) — install, update, test, and build.
112
+ - [Publishing](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/publishing.md) — the PyPI setup and release steps.
113
+ - [Security](https://github.com/BeepBoopBit/setup-ssh/blob/main/SECURITY.md) — the access model and reporting issues.
114
+
115
+ [MIT](https://github.com/BeepBoopBit/setup-ssh/blob/main/LICENSE) · beepboopbit
@@ -0,0 +1,91 @@
1
+ # setup-ssh
2
+
3
+ I made this because my lazy ass got tired of setting up SSH keys and remembering
4
+ IP addresses whenever I wanted to use another computer.
5
+
6
+ It's mostly for my own Linux, Mac, and Windows machines. Add them, sync, and then
7
+ use shortcuts like `ssh mac` or `ssh linux`. It sets up passwordless access in
8
+ both directions between the accounts you add.
9
+
10
+ This project uses **AI-driven development**. I use AI tools to help write the code
11
+ and docs and work through fixes.
12
+
13
+ ## Get it running
14
+
15
+ You'll need Python 3.11+ on the computer running setup. The other computers just
16
+ need OpenSSH enabled and a working network connection. LAN is fine; I use NetBird
17
+ too, but you need to set that up separately.
18
+
19
+ Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then get the
20
+ published package from PyPI:
21
+
22
+ ```sh
23
+ uv tool install setup-ssh-cli
24
+ setup-ssh init
25
+ ```
26
+
27
+ This works on Linux, macOS, and Windows. Update later with
28
+ `uv tool upgrade setup-ssh-cli`.
29
+
30
+ Or use `python -m pip install setup-ssh-cli` inside a virtual environment.
31
+
32
+ Working from a clone of this repository? Use `./dev.sh install` instead, or
33
+ `.\dev.ps1 install` on Windows. `setup-ssh init` is the part that sets up your
34
+ devices.
35
+
36
+ Include your current computer in the wizard. It'll ask for each device's name,
37
+ address, username, OS, and SSH port. Keep the devices online for this first setup.
38
+ Verify the host fingerprints when asked; you may need each account's password
39
+ once so setup can install the keys.
40
+
41
+ After a successful sync:
42
+
43
+ ```sh
44
+ ssh mac # from Linux
45
+ ssh linux # from the Mac
46
+ scp notes.txt mac:~/
47
+ ```
48
+
49
+ Use whatever names you gave your devices. Each computer keeps its own private
50
+ key, and you don't need to run setup again just to SSH into something.
51
+
52
+ ## Add another computer
53
+
54
+ Enable SSH on it, then run these from your original setup computer:
55
+
56
+ ```sh
57
+ setup-ssh add --no-sync
58
+ setup-ssh sync --skip-offline
59
+ ```
60
+
61
+ That sets up whichever computers are available. Run sync again when the others
62
+ are online so they get the new keys too. If everyone's online, `setup-ssh add`
63
+ does both steps for you.
64
+
65
+ ## Commands I use
66
+
67
+ ```sh
68
+ setup-ssh list # saved devices
69
+ setup-ssh sync --skip-offline # update the ones that are online
70
+ setup-ssh --batch sync --skip-offline # same, with no password/trust prompts
71
+ setup-ssh check # test every direction; all devices online
72
+ setup-ssh remove desktop # remove a device's managed access
73
+ setup-ssh doctor --os windows # SSH setup instructions for an OS
74
+ setup-ssh --help
75
+ ```
76
+
77
+ Removing a device needs to reach the other computers to revoke its access there.
78
+ If some are offline, sync them later.
79
+
80
+ ## More details
81
+
82
+ The longer explanations live here:
83
+
84
+ - [Usage guide](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/usage.md) — all the options, files, backups, and how keys work.
85
+ - [Troubleshooting](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/troubleshooting.md) — when something inevitably refuses to connect.
86
+ - [Contributing](https://github.com/BeepBoopBit/setup-ssh/blob/main/CONTRIBUTING.md) — running it locally and working on the code.
87
+ - [Dev commands](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/development.md) — install, update, test, and build.
88
+ - [Publishing](https://github.com/BeepBoopBit/setup-ssh/blob/main/docs/publishing.md) — the PyPI setup and release steps.
89
+ - [Security](https://github.com/BeepBoopBit/setup-ssh/blob/main/SECURITY.md) — the access model and reporting issues.
90
+
91
+ [MIT](https://github.com/BeepBoopBit/setup-ssh/blob/main/LICENSE) · beepboopbit
@@ -0,0 +1,47 @@
1
+ # Security
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ For a potential vulnerability, use the repository's private vulnerability-reporting
6
+ feature when available. If no private reporting channel is listed, open an issue
7
+ titled **Private security contact requested** to arrange one with the maintainer,
8
+ `beepboopbit`. Keep vulnerability details and exploit instructions out of that
9
+ public request.
10
+
11
+ A private report should include the affected version, operating system, impact,
12
+ and a minimal reproduction using disposable accounts. Do not send real passwords,
13
+ private keys, access tokens, or personal inventories. Ordinary configuration
14
+ problems can be reported publicly with sensitive details removed; see the
15
+ [troubleshooting guide](docs/troubleshooting.md).
16
+
17
+ ## Access model
18
+
19
+ This tool grants mutual SSH access between all selected accounts. Each device has
20
+ a dedicated, unencrypted Ed25519 private key protected by local file permissions.
21
+ Someone able to read that private key can use its managed access until the key is
22
+ revoked on peers. Select accounts and protect devices accordingly.
23
+
24
+ Server host keys are verified and pinned. Account passwords are used only when
25
+ needed for initial authentication and are not saved. Private device keys are not
26
+ collected by the setup computer, and SSH-agent forwarding is disabled.
27
+
28
+ The public inventory contains network and account details, public keys, and host
29
+ pins. Although it contains no private keys or passwords, it should remain outside
30
+ public repositories and support attachments.
31
+
32
+ Windows administrators commonly share one authorized-key file. An authorization
33
+ there may permit other administrator accounts too; see the
34
+ [Windows troubleshooting guide](docs/troubleshooting.md#windows-authentication-or-permissions-fail)
35
+ for supported account layouts.
36
+
37
+ ## Revocation and partial updates
38
+
39
+ Removing a device records removal intent before attempting changes. Offline peers
40
+ retain the old key until they can be updated. The removed device also retains its
41
+ incoming authorizations if it cannot be reached for cleanup. Uninstalling the CLI
42
+ does not remove previously granted access.
43
+
44
+ Updates are not transactional across computers. Successful changes remain if a
45
+ later operation fails. See [removal](docs/usage.md#remove-a-device) and
46
+ [recovery](docs/usage.md#changing-addresses-and-recovering-keys) for the supported
47
+ procedures.
@@ -0,0 +1,61 @@
1
+ # Small launcher; the commands live in scripts/dev.py.
2
+ $ErrorActionPreference = 'Stop'
3
+ $forwardedArgs = @($args)
4
+ $projectDir = $PSScriptRoot
5
+ $versionCheck = 'import sys; sys.exit(0 if sys.version_info >= (3, 11) else 1)'
6
+
7
+ function Invoke-Python([string]$Executable, [string[]]$PythonArgs) {
8
+ $start = New-Object System.Diagnostics.ProcessStartInfo
9
+ $start.FileName = $Executable
10
+ $start.UseShellExecute = $false
11
+ # Windows PowerShell 5.1 has no ArgumentList. Quote each argument ourselves
12
+ # so empty strings, spaces, quotes, and trailing backslashes survive.
13
+ $quoted = foreach ($value in $PythonArgs) {
14
+ '"' + ($value -replace '(\\*)"', '$1$1\"' -replace '(\\+)$', '$1$1') + '"'
15
+ }
16
+ $start.Arguments = $quoted -join ' '
17
+ $process = [System.Diagnostics.Process]::Start($start)
18
+ try {
19
+ $process.WaitForExit()
20
+ return $process.ExitCode
21
+ } finally {
22
+ $process.Dispose()
23
+ }
24
+ }
25
+
26
+ $candidates = if ($env:SETUP_SSH_PYTHON) { @($env:SETUP_SSH_PYTHON) } else {
27
+ @('py', 'python3', 'python')
28
+ }
29
+ foreach ($candidate in $candidates) {
30
+ $command = Get-Command -Name $candidate -CommandType Application -ErrorAction SilentlyContinue |
31
+ Select-Object -First 1
32
+ if (-not $command) { continue }
33
+ $prefix = if ($command.Name -in @('py', 'py.exe')) { @('-3') } else { @() }
34
+ try {
35
+ $code = Invoke-Python $command.Source ($prefix + @('-c', $versionCheck))
36
+ } catch {
37
+ continue
38
+ }
39
+ if ($code -eq 0) {
40
+ try {
41
+ $code = Invoke-Python $command.Source (
42
+ $prefix + @((Join-Path $projectDir 'scripts/dev.py')) + $forwardedArgs
43
+ )
44
+ exit $code
45
+ } catch {
46
+ [Console]::Error.WriteLine("Couldn't start the development helper: $_")
47
+ exit 1
48
+ }
49
+ }
50
+ }
51
+
52
+ if ($forwardedArgs.Count -eq 0 -or $forwardedArgs[0] -in @('help', '-h', '--help')) {
53
+ Write-Output 'Usage: .\dev.ps1 <command> [args]'
54
+ Write-Output 'Commands: help doctor install reinstall uninstall develop run check fmt test build'
55
+ Write-Output 'Install Python 3.11+ and uv to use these commands. See docs/development.md.'
56
+ exit 0
57
+ }
58
+ [Console]::Error.WriteLine(
59
+ 'Python 3.11+ is required. Install it or set SETUP_SSH_PYTHON to its executable.'
60
+ )
61
+ exit 1
@@ -0,0 +1,32 @@
1
+ #!/bin/sh
2
+ # Small launcher; the commands live in scripts/dev.py.
3
+ set -eu
4
+
5
+ project_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
6
+ version_check='import sys; sys.exit(0 if sys.version_info >= (3, 11) else 1)'
7
+
8
+ if [ -n "${SETUP_SSH_PYTHON:-}" ]; then
9
+ if "$SETUP_SSH_PYTHON" -c "$version_check" 2>/dev/null; then
10
+ exec "$SETUP_SSH_PYTHON" "$project_dir/scripts/dev.py" "$@"
11
+ fi
12
+ else
13
+ for python_command in python3 python; do
14
+ if command -v "$python_command" >/dev/null 2>&1 &&
15
+ "$python_command" -c "$version_check" 2>/dev/null; then
16
+ exec "$python_command" "$project_dir/scripts/dev.py" "$@"
17
+ fi
18
+ done
19
+ fi
20
+
21
+ case "${1:-help}" in
22
+ help|-h|--help)
23
+ printf '%s\n' \
24
+ 'Usage: ./dev.sh <command> [args]' \
25
+ 'Commands: help doctor install reinstall uninstall develop run check fmt test build' \
26
+ 'Install Python 3.11+ and uv to use these commands. See docs/development.md.'
27
+ ;;
28
+ *)
29
+ printf '%s\n' 'Python 3.11+ is required. Install it or set SETUP_SSH_PYTHON to its executable.' >&2
30
+ exit 1
31
+ ;;
32
+ esac
@@ -0,0 +1,81 @@
1
+ # Dev commands
2
+
3
+ Just a few shortcuts so I don't have to remember the Python tooling commands.
4
+ You'll need Python 3.11+ and
5
+ [uv](https://docs.astral.sh/uv/getting-started/installation/) on PATH.
6
+
7
+ Use `./dev.sh` on Linux/macOS or `.\dev.ps1` in PowerShell on Windows. They share
8
+ the same commands. Running either one without arguments shows help.
9
+
10
+ | Command | What it does |
11
+ | --- | --- |
12
+ | `help` | Show the commands. |
13
+ | `doctor` | Check Python, uv, the SSH tools, and which `setup-ssh` is on PATH. |
14
+ | `install` | Install the current checkout as a standalone command for your user. |
15
+ | `reinstall` | Rebuild and install the current code, even if its version hasn't changed. |
16
+ | `uninstall` | Remove the CLI installed through uv. |
17
+ | `develop` | Prepare `.venv` with the dependencies from `uv.lock`, including dev tools. |
18
+ | `run ...` | Run this checkout's `setup-ssh` and pass along the arguments. |
19
+ | `check` | Check lint and formatting. Doesn't rewrite code. |
20
+ | `fmt` | Format the Python files. |
21
+ | `test ...` | Run pytest and pass along the arguments. |
22
+ | `build` | Put a wheel and source archive in `dist/`. |
23
+
24
+ For uploading a release to PyPI, see [Publishing](publishing.md). The GitHub
25
+ workflow handles that after you publish a release.
26
+
27
+ ## Install and update
28
+
29
+ ```sh
30
+ ./dev.sh doctor
31
+ ./dev.sh install
32
+ setup-ssh --help
33
+
34
+ # After pulling or making changes:
35
+ ./dev.sh reinstall
36
+ ```
37
+
38
+ The installed command has its own uv environment. You can use it outside the
39
+ checkout, and edits only reach it after reinstalling. `reinstall` also works if
40
+ you haven't installed it yet. This installation resolves dependencies from
41
+ `pyproject.toml`; the lockfile is for development.
42
+
43
+ If uv says its executable directory isn't on PATH, follow the path instructions
44
+ it prints and open a new terminal. No `sudo` is needed. The helpers don't install
45
+ Python or uv, or change your shell settings.
46
+
47
+ `uninstall` only removes the uv tool. Your saved devices, SSH keys, and SSH
48
+ configuration stay where they are. It doesn't revoke access between computers;
49
+ use `setup-ssh remove DEVICE` for that before uninstalling if you need to.
50
+ If you installed with pip instead, uninstall from that same Python environment.
51
+
52
+ ## Work on the code
53
+
54
+ ```sh
55
+ ./dev.sh develop
56
+ ./dev.sh run --help
57
+ ./dev.sh test -q
58
+ ./dev.sh test tests/test_state.py -k inventory
59
+ ./dev.sh fmt
60
+ ./dev.sh check
61
+ ./dev.sh build
62
+ ```
63
+
64
+ `run`, `test`, `fmt`, and `check` prepare `.venv` as needed, so `develop` is mostly
65
+ a convenient first step. These commands use `uv.lock` and fail if it's out of
66
+ date. After deliberately changing dependencies, run `uv lock`, then check in
67
+ both `pyproject.toml` and `uv.lock`.
68
+
69
+ You can call the helper by its path from another directory. Tests and code
70
+ checks run in the checkout. `run` keeps your current directory, so
71
+ `/path/to/setup-ssh/dev.sh run --config ./devices.json list` uses the file next
72
+ to you. `run` has the same effects as using `setup-ssh` directly, including
73
+ changing SSH settings when you ask it to sync.
74
+
75
+ `doctor` only reports what it finds. A missing installed CLI or NetBird is fine;
76
+ missing uv, SSH tools, or the lockfile returns a failure status.
77
+
78
+ If Python isn't found automatically, set `SETUP_SSH_PYTHON` to the path of a
79
+ Python 3.11+ executable. If Windows blocks the PowerShell script, you can use
80
+ `powershell -NoProfile -ExecutionPolicy Bypass -File .\dev.ps1 help` for a single
81
+ invocation without changing the saved execution policy.
@@ -0,0 +1,77 @@
1
+ # Publishing
2
+
3
+ This is the setup for `BeepBoopBit/setup-ssh`. Once it's connected, publishing a
4
+ GitHub release runs the checks and uploads the package to PyPI.
5
+
6
+ ## One-time setup
7
+
8
+ On PyPI, open [your account's Publishing page](https://pypi.org/manage/account/publishing/)
9
+ and add a pending GitHub publisher with:
10
+
11
+ | Field | Value |
12
+ | --- | --- |
13
+ | PyPI project name | `setup-ssh-cli` |
14
+ | Owner | `BeepBoopBit` |
15
+ | Repository name | `setup-ssh` |
16
+ | Workflow name | `publish.yml` |
17
+ | Environment name | `pypi` |
18
+
19
+ The owner is the GitHub account that owns the repository. The workflow field
20
+ means the filename, `publish.yml`, not the full `.github/workflows/publish.yml`
21
+ path or its display name, “Check and publish.” Keep the environment name exactly
22
+ `pypi` in both places.
23
+
24
+ In the GitHub repository's **Settings → Environments**, create an environment
25
+ named `pypi`. No API-token secret is needed: the workflow uses
26
+ [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishers/using-a-publisher/).
27
+
28
+ The first successful upload creates the PyPI project. Adding a pending publisher
29
+ doesn't reserve the package name. If you already own the project on PyPI, add
30
+ the publisher under that project's Publishing settings instead. PyPI explains
31
+ the first-upload flow in its
32
+ [pending publisher guide](https://docs.pypi.org/trusted-publishers/creating-a-project-through-oidc/).
33
+
34
+ ## Make a release
35
+
36
+ 1. Set the same version in `pyproject.toml` and
37
+ `src/setup_ssh/__init__.py`. The first release is `0.1.0`.
38
+ 2. Run `uv lock`, then `./dev.sh check`, `./dev.sh test`, and `./dev.sh build`.
39
+ Use `.\dev.ps1` for those helper commands on Windows.
40
+ 3. Commit and push the changes, including `uv.lock`.
41
+ 4. On GitHub, open **Releases → Draft a new release**. Use a tag matching the
42
+ version, such as `v0.1.0`, at the commit you want to release.
43
+ 5. Add whatever release notes are useful, then click **Publish release**.
44
+ 6. Watch **Actions → Check and publish**. Once the PyPI job succeeds, it's
45
+ available to install.
46
+
47
+ The workflow checks formatting, runs the tests, checks that the versions and
48
+ release tag agree, builds the wheel and source archive, validates the package
49
+ metadata, and tries the wheel in a fresh environment. A separate job uploads
50
+ those same files to PyPI using the `pypi` environment.
51
+
52
+ Pushes to `main`, pull requests, and the manual **Run workflow** button run the
53
+ checks and build without publishing. A draft release or a pushed tag alone
54
+ doesn't upload anything. Publishing a prerelease also uploads to PyPI, so use a
55
+ prerelease version such as `0.2.0rc1` and tag `v0.2.0rc1` for those.
56
+
57
+ For the next release, choose a new version, such as `0.1.1`. PyPI won't let you
58
+ replace a file you've already uploaded. If a run failed before uploading, fix
59
+ the cause and rerun it. If it uploaded some files already, check the PyPI release
60
+ before retrying; the workflow deliberately reports duplicate uploads as errors.
61
+
62
+ ## Install it elsewhere
63
+
64
+ ```sh
65
+ uv tool install setup-ssh-cli
66
+ setup-ssh --help
67
+ ```
68
+
69
+ To update an installation from PyPI:
70
+
71
+ ```sh
72
+ uv tool upgrade setup-ssh-cli
73
+ ```
74
+
75
+ With pip, use `python -m pip install --upgrade setup-ssh-cli` inside a virtual
76
+ environment. The package name is `setup-ssh-cli`; the command you run is
77
+ `setup-ssh`.