git-profiles


Namegit-profiles JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryCLI tool to manage multiple Git configuration profiles
upload_time2025-10-17 13:57:45
maintainerNiklas Kaaf
docs_urlNone
authorNiklas Kaaf
requires_python>=3.10
licenseNone
keywords git cli profiles configuration developer tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # git-profiles

![PyPI - Status](https://img.shields.io/pypi/status/git-profiles?style=for-the-badge)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/git-profiles?style=for-the-badge)
![PyPI - License](https://img.shields.io/pypi/l/git-profiles?style=for-the-badge)
![Codecov](https://img.shields.io/codecov/c/github/nkaaf/git-profiles?style=for-the-badge)

![PyPI - Version](https://img.shields.io/pypi/v/git-profiles?style=for-the-badge)
![Homebrew Formula Version](https://img.shields.io/homebrew/v/git-profiles?style=for-the-badge)

A **CLI tool to manage multiple Git configuration profiles**, allowing developers to switch between
different identities and settings quickly. Profiles are stored persistently and can be applied to
local Git repositories with ease.

---

## Features

- Create, update, and delete Git config profiles.
- Set and unset key-value pairs in profiles (`user.name`, `user.email`, etc.).
- Apply a profile to the local Git repository.
- Duplicate existing profiles.
- List all available profiles and show profile contents.
- Cross-platform persistent storage using `platformdirs`.
- Input validation for safe keys and valid emails.
- Quiet mode for scripting or automation.

---

## Installation

### Install from PyPI

```bash
pip install git-profiles
```

### Install via Homebrew (macOS / Linux)

```bash
brew install nkaaf/tap/git-profiles
```

### Development Installation

Clone the repository and install in editable mode using `uv`:

```bash
git clone https://github.com/nkaaf/git-profiles.git
cd git-profiles

# Ensure dependencies are exactly in sync with the lockfile
uv sync
```

> This allows you to modify the source code while testing. Make sure uv is installed on your system;
> it is used to manage dependencies and run project commands.

---

## Usage

After installation (via PyPI, Homebrew, or the development workflow), you can use `git-profiles` in
**three ways**:

1. **Global CLI (recommended fallback):**

```bash
git-profiles <command>
```

2. **Git alias (preferred and automatically available if Git is installed):**

```bash
git profiles <command>
```

> 💡 **Tip:** The Git alias integrates seamlessly with your workflow and is the most convenient way
> to run commands.

3. **Python module (for development or scripting):**

```bash
python3 -m git_profiles <command>
```

> 💡 Examples below will show both the **global CLI** and **Git alias** variants.

---

### Set a key-value pair in a profile

```bash
git-profiles set work user.name "Alice Example"
git-profiles set work user.email "alice@example.com"

# Git alias equivalent:
git profiles set work user.name "Alice Example"
git profiles set work user.email "alice@example.com"
```

### Remove a key from a profile

```bash
git-profiles unset work user.email

# Git alias equivalent:
git profiles unset work user.email
```

### Apply a profile to the local Git repository

```bash
git-profiles apply work

# Git alias equivalent:
git profiles apply work
```

This sets all the keys in the `work` profile for the current repository.

### List all available profiles

```bash
git-profiles list

# Git alias equivalent:
git profiles list
```

### Show all key-values of a profile

```bash
git-profiles show work

# Git alias equivalent:
git profiles show work
```

### Remove an entire profile

```bash
git-profiles remove work

# Git alias equivalent:
git profiles remove work
```

### Duplicate a profile

```bash
git-profiles duplicate work personal

# Git alias equivalent:
git profiles duplicate work personal
```

Creates a copy of the `work` profile named `personal`.

---

### Options

* `-q`, `--quiet`: Suppress normal output. Errors are still shown.

```bash
git-profiles -q apply work

# Git alias equivalent:
git profiles -q apply work
```

---

## Development

> 💡 **Prerequisite:** Make sure you have **uv installed** on your system. It is the dependency
> manager used to install dev dependencies, manage Python interpreters, and run project commands.

Get your development environment ready in a few steps:

```bash
# 1. Install all development dependencies (pytest, tox, ruff, pre-commit, etc.)
uv sync

# 2. Install pre-commit git hooks
pre-commit install
```

> 💡 After this, your environment is ready to run tests, linting, and builds.

> ⚠️ **Important:** Always run commands via `uv run poe <script>` (e.g., `uv run poe lint`,
`uv run poe test`).
> This ensures the correct uv-managed environment is used. Running `poe` or `tox` directly may fail
> if the environment isn’t active, especially on CI runners.

---

### Linting

```bash
# Run all linting checks
uv run poe lint
```

> ℹ️ This internally runs `pre-commit` using the uv-managed environment.
> 💡 Commits automatically trigger pre-commit hooks after `pre-commit install`.
> If any hook fails (e.g., lint errors), the commit is blocked until fixed.

---

### Testing

```bash
# Run all test environments defined in pyproject.toml
uv run poe test
```

> ℹ️ This internally runs `tox` using the uv-managed environment.
> ⚠️ **Note:** Tox requires the Python interpreters listed in `[tool.tox].envlist`.
> With the `tox-uv` plugin, missing interpreters are installed automatically.
> You can also install specific Python versions manually with `uv python install <version>`.

---

### Building

You can build the `git-profiles` package locally for testing or distribution:

```bash
# Ensure your development environment is synced
uv sync

# Build both wheel and source distribution
uv build
```

> ⚡ Using `uv sync` ensures that all development dependencies are available during the build
> process.

---

### References / Helpful Links

For more information on the tools used in this project, you can visit their official documentation:

* **[uv](https://astral-sh.github.io/uv/)** – Dependency manager for Python projects, used here to
  manage dev dependencies and Python interpreters.
* **[tox](https://tox.readthedocs.io/)** – Automate testing across multiple Python versions.
* **[pre-commit](https://pre-commit.com/)** – Manage and run pre-commit hooks to ensure code
  quality.
* **[Poe the Poet](https://github.com/nat-n/poethepoet)** – Task runner that simplifies running
  scripts (like `lint` and `test`) defined in `pyproject.toml`.
* **[Python Packaging Guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/)
  ** – Official guide for building, packaging, and distributing Python projects, including creating
  source distributions and wheels.

> 💡 These links provide detailed documentation, installation guides, and examples for each tool.
> They’re especially useful if you’re new to Python project tooling.

---

## CI / GitHub Actions

The repository’s CI pipelines automatically run:

* Tests across all Python versions defined in `[tool.tox].envlist`
* Pre-commit hooks for linting and code quality

> ✅ This ensures that every commit and pull request is tested and checked consistently with your
> local development setup.

---

## License

Apache License 2.0 – see [LICENSE](LICENSE) for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "git-profiles",
    "maintainer": "Niklas Kaaf",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Niklas Kaaf <nkaaf@protonmail.com>",
    "keywords": "git, cli, profiles, configuration, developer, tools",
    "author": "Niklas Kaaf",
    "author_email": "Niklas Kaaf <nkaaf@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/9d/04/60c73f809488ffadda83388a4cf5e0c0d28ac7e24f760b5640a13b6a563b/git_profiles-0.1.0.tar.gz",
    "platform": null,
    "description": "# git-profiles\n\n![PyPI - Status](https://img.shields.io/pypi/status/git-profiles?style=for-the-badge)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/git-profiles?style=for-the-badge)\n![PyPI - License](https://img.shields.io/pypi/l/git-profiles?style=for-the-badge)\n![Codecov](https://img.shields.io/codecov/c/github/nkaaf/git-profiles?style=for-the-badge)\n\n![PyPI - Version](https://img.shields.io/pypi/v/git-profiles?style=for-the-badge)\n![Homebrew Formula Version](https://img.shields.io/homebrew/v/git-profiles?style=for-the-badge)\n\nA **CLI tool to manage multiple Git configuration profiles**, allowing developers to switch between\ndifferent identities and settings quickly. Profiles are stored persistently and can be applied to\nlocal Git repositories with ease.\n\n---\n\n## Features\n\n- Create, update, and delete Git config profiles.\n- Set and unset key-value pairs in profiles (`user.name`, `user.email`, etc.).\n- Apply a profile to the local Git repository.\n- Duplicate existing profiles.\n- List all available profiles and show profile contents.\n- Cross-platform persistent storage using `platformdirs`.\n- Input validation for safe keys and valid emails.\n- Quiet mode for scripting or automation.\n\n---\n\n## Installation\n\n### Install from PyPI\n\n```bash\npip install git-profiles\n```\n\n### Install via Homebrew (macOS / Linux)\n\n```bash\nbrew install nkaaf/tap/git-profiles\n```\n\n### Development Installation\n\nClone the repository and install in editable mode using `uv`:\n\n```bash\ngit clone https://github.com/nkaaf/git-profiles.git\ncd git-profiles\n\n# Ensure dependencies are exactly in sync with the lockfile\nuv sync\n```\n\n> This allows you to modify the source code while testing. Make sure uv is installed on your system;\n> it is used to manage dependencies and run project commands.\n\n---\n\n## Usage\n\nAfter installation (via PyPI, Homebrew, or the development workflow), you can use `git-profiles` in\n**three ways**:\n\n1. **Global CLI (recommended fallback):**\n\n```bash\ngit-profiles <command>\n```\n\n2. **Git alias (preferred and automatically available if Git is installed):**\n\n```bash\ngit profiles <command>\n```\n\n> \ud83d\udca1 **Tip:** The Git alias integrates seamlessly with your workflow and is the most convenient way\n> to run commands.\n\n3. **Python module (for development or scripting):**\n\n```bash\npython3 -m git_profiles <command>\n```\n\n> \ud83d\udca1 Examples below will show both the **global CLI** and **Git alias** variants.\n\n---\n\n### Set a key-value pair in a profile\n\n```bash\ngit-profiles set work user.name \"Alice Example\"\ngit-profiles set work user.email \"alice@example.com\"\n\n# Git alias equivalent:\ngit profiles set work user.name \"Alice Example\"\ngit profiles set work user.email \"alice@example.com\"\n```\n\n### Remove a key from a profile\n\n```bash\ngit-profiles unset work user.email\n\n# Git alias equivalent:\ngit profiles unset work user.email\n```\n\n### Apply a profile to the local Git repository\n\n```bash\ngit-profiles apply work\n\n# Git alias equivalent:\ngit profiles apply work\n```\n\nThis sets all the keys in the `work` profile for the current repository.\n\n### List all available profiles\n\n```bash\ngit-profiles list\n\n# Git alias equivalent:\ngit profiles list\n```\n\n### Show all key-values of a profile\n\n```bash\ngit-profiles show work\n\n# Git alias equivalent:\ngit profiles show work\n```\n\n### Remove an entire profile\n\n```bash\ngit-profiles remove work\n\n# Git alias equivalent:\ngit profiles remove work\n```\n\n### Duplicate a profile\n\n```bash\ngit-profiles duplicate work personal\n\n# Git alias equivalent:\ngit profiles duplicate work personal\n```\n\nCreates a copy of the `work` profile named `personal`.\n\n---\n\n### Options\n\n* `-q`, `--quiet`: Suppress normal output. Errors are still shown.\n\n```bash\ngit-profiles -q apply work\n\n# Git alias equivalent:\ngit profiles -q apply work\n```\n\n---\n\n## Development\n\n> \ud83d\udca1 **Prerequisite:** Make sure you have **uv installed** on your system. It is the dependency\n> manager used to install dev dependencies, manage Python interpreters, and run project commands.\n\nGet your development environment ready in a few steps:\n\n```bash\n# 1. Install all development dependencies (pytest, tox, ruff, pre-commit, etc.)\nuv sync\n\n# 2. Install pre-commit git hooks\npre-commit install\n```\n\n> \ud83d\udca1 After this, your environment is ready to run tests, linting, and builds.\n\n> \u26a0\ufe0f **Important:** Always run commands via `uv run poe <script>` (e.g., `uv run poe lint`,\n`uv run poe test`).\n> This ensures the correct uv-managed environment is used. Running `poe` or `tox` directly may fail\n> if the environment isn\u2019t active, especially on CI runners.\n\n---\n\n### Linting\n\n```bash\n# Run all linting checks\nuv run poe lint\n```\n\n> \u2139\ufe0f This internally runs `pre-commit` using the uv-managed environment.\n> \ud83d\udca1 Commits automatically trigger pre-commit hooks after `pre-commit install`.\n> If any hook fails (e.g., lint errors), the commit is blocked until fixed.\n\n---\n\n### Testing\n\n```bash\n# Run all test environments defined in pyproject.toml\nuv run poe test\n```\n\n> \u2139\ufe0f This internally runs `tox` using the uv-managed environment.\n> \u26a0\ufe0f **Note:** Tox requires the Python interpreters listed in `[tool.tox].envlist`.\n> With the `tox-uv` plugin, missing interpreters are installed automatically.\n> You can also install specific Python versions manually with `uv python install <version>`.\n\n---\n\n### Building\n\nYou can build the `git-profiles` package locally for testing or distribution:\n\n```bash\n# Ensure your development environment is synced\nuv sync\n\n# Build both wheel and source distribution\nuv build\n```\n\n> \u26a1 Using `uv sync` ensures that all development dependencies are available during the build\n> process.\n\n---\n\n### References / Helpful Links\n\nFor more information on the tools used in this project, you can visit their official documentation:\n\n* **[uv](https://astral-sh.github.io/uv/)** \u2013 Dependency manager for Python projects, used here to\n  manage dev dependencies and Python interpreters.\n* **[tox](https://tox.readthedocs.io/)** \u2013 Automate testing across multiple Python versions.\n* **[pre-commit](https://pre-commit.com/)** \u2013 Manage and run pre-commit hooks to ensure code\n  quality.\n* **[Poe the Poet](https://github.com/nat-n/poethepoet)** \u2013 Task runner that simplifies running\n  scripts (like `lint` and `test`) defined in `pyproject.toml`.\n* **[Python Packaging Guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/)\n  ** \u2013 Official guide for building, packaging, and distributing Python projects, including creating\n  source distributions and wheels.\n\n> \ud83d\udca1 These links provide detailed documentation, installation guides, and examples for each tool.\n> They\u2019re especially useful if you\u2019re new to Python project tooling.\n\n---\n\n## CI / GitHub Actions\n\nThe repository\u2019s CI pipelines automatically run:\n\n* Tests across all Python versions defined in `[tool.tox].envlist`\n* Pre-commit hooks for linting and code quality\n\n> \u2705 This ensures that every commit and pull request is tested and checked consistently with your\n> local development setup.\n\n---\n\n## License\n\nApache License 2.0 \u2013 see [LICENSE](LICENSE) for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "CLI tool to manage multiple Git configuration profiles",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/nkaaf/git-profiles/issues",
        "Releases": "https://github.com/nkaaf/git-profiles/releases",
        "Repository": "https://github.com/nkaaf/git-profiles"
    },
    "split_keywords": [
        "git",
        " cli",
        " profiles",
        " configuration",
        " developer",
        " tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "871d3d92842a4c36496e527521ded96dcbbff5c0493a15c0b2cabc2209d5a454",
                "md5": "80b3a2043990d2345acfb54ac1e10e44",
                "sha256": "d080c3de99ec15ddcd7ba30cac700f1af3164eefc40a4d5f0d2519810c6a584c"
            },
            "downloads": -1,
            "filename": "git_profiles-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "80b3a2043990d2345acfb54ac1e10e44",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 17985,
            "upload_time": "2025-10-17T13:57:43",
            "upload_time_iso_8601": "2025-10-17T13:57:43.706024Z",
            "url": "https://files.pythonhosted.org/packages/87/1d/3d92842a4c36496e527521ded96dcbbff5c0493a15c0b2cabc2209d5a454/git_profiles-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9d0460c73f809488ffadda83388a4cf5e0c0d28ac7e24f760b5640a13b6a563b",
                "md5": "a6a3f5a75adc6ee2a954d53483f06b5b",
                "sha256": "763a16c8034e93423411e6f87cb9296b1f3d2744b3bdba5fdd00c84e4d5b8e85"
            },
            "downloads": -1,
            "filename": "git_profiles-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a6a3f5a75adc6ee2a954d53483f06b5b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 13393,
            "upload_time": "2025-10-17T13:57:45",
            "upload_time_iso_8601": "2025-10-17T13:57:45.034300Z",
            "url": "https://files.pythonhosted.org/packages/9d/04/60c73f809488ffadda83388a4cf5e0c0d28ac7e24f760b5640a13b6a563b/git_profiles-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-17 13:57:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nkaaf",
    "github_project": "git-profiles",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "git-profiles"
}
        
Elapsed time: 2.34722s