Metadata-Version: 2.4
Name: ssh-profile
Version: 0.1.0
Summary: Network-aware SSH config profile selector
Author-email: Scott Karlin <pypi@karlin-online.com>
Maintainer-email: Scott Karlin <pypi@karlin-online.com>
License: MIT
Project-URL: homepage, https://gitlab.com/sck/ssh-profile
Project-URL: bugs, https://gitlab.com/sck/ssh-profile/-/issues
Project-URL: changelog, https://gitlab.com/sck/ssh-profile/-/blob/main/HISTORY.md
Project-URL: documentation, https://sck.gitlab.io/ssh-profile/
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Networking
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: attrs>=26.1.0
Requires-Dist: argparse-utilities>=0.0.2
Dynamic: license-file

# SSH Profile

![PyPI version](https://img.shields.io/pypi/v/ssh-profile.svg)

Network-aware SSH config profile selector

* Created by **[Scott Karlin](https://gitlab.com/sck)**
  * GitLab: https://gitlab.com/sck
  * PyPI: https://pypi.org/user/sckarlin/
* PyPI package: https://pypi.org/project/ssh-profile/
* Free software: MIT License

## Features

* **Network-aware profile selection** -- detect which profile applies on the
  current network and use it as an `ssh_config` `Match exec` predicate.
* **Four detection tiers**, evaluated as a first-match-wins cascade:
  `hostname`, `cidr` (wired IPv4), `gateway_mac`, and `ssid`.
* **Safe by design** -- predicate mode is silent on stdout; lenient runtime
  loading fails toward the conservative `unknown` profile; a broken `ssh-profile`
  fails the connection loudly rather than misconnecting.
* **Validation built in** -- `--check-config` checks the profile data file and
  your `~/.ssh/config` references; `--check-tools` checks `ip`/`ping`/`iw`.
* **Fast** -- a short-TTL cache speeds up the burst of `ssh-profile`
  invocations generated by an ssh connection; the initial network
  detection is shared across the burst.
* **One shared config** across machines: a `~/.ssh/config` + `ssh-profile.toml`
  pair, with no per-machine drift.

## Documentation

* **Live site:** https://sck.gitlab.io/ssh-profile/
* **Preview locally:** `make docs-serve` (serves at http://localhost:8000)

API documentation is auto-generated from docstrings.

## Development

To set up for local development:

```bash
# Clone the repository
git clone git@gitlab.com:sck/ssh-profile.git SSH-Profile
cd SSH-Profile

# Create a virtual environment and install all development dependencies
make venv
source venv/bin/activate
make init
make uv.lock
make sync-devci
```

Run quality checks (format, lint, type check, test):

```bash
make qa
```

### Release cycle

1. Edit code and add change notes to the `Next Release (TBD)` entry in
   `HISTORY.md` as you go.

2. When ready to release, upgrade all dependencies and refresh the environment:

    ```bash
    make update
    make sync-devci
    ```

3. Run the full quality check suite:

    ```bash
    make qa
    ```

4. In `HISTORY.md`, replace the `Next Release (TBD)` heading with the release
   version and today's date, and verify the change notes are complete.

5. Sync the version to `pyproject.toml` and `uv.lock`:

    ```bash
    make set-version
    ```

6. Commit the release:

    ```bash
    git commit -am "Release X.Y.Z"
    ```

7. Tag and push.  `make tag` validates version consistency across `HISTORY.md`,
   `pyproject.toml`, and `uv.lock`; creates an annotated tag; pushes it to
   `origin`; and adds a new `Next Release (TBD)` entry to `HISTORY.md`:

    ```bash
    make tag
    ```

    Pushing the tag triggers the GitLab CI/CD publish job, which uploads
    the package to your selected registry.

8. Commit to open the next development cycle:

    ```bash
    git commit -am "Start next development cycle"
    ```

9. Go back to step 1.

See [Release Checklist](docs/release_checklist.md) for the full recurring workflow.

## Author

SSH Profile was created in 2026 by Scott Karlin.

Built with [Cookiecutter](https://github.com/cookiecutter/cookiecutter) and
the [sck/cookiecutter-pypackage-gitlab](https://gitlab.com/sck/cookiecutter-pypackage-gitlab)
project template.
