uvn


Nameuvn JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
Summaryuvn is conda for uv; a centralized Python virtual environment manager.
upload_time2024-11-02 19:03:42
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License Copyright (c) 2024 Modar M. Alfadly Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords conda uv uvenv uvn venv virtualenv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # uvn

[![PyPI version](https://img.shields.io/pypi/v/uvn)](https://pypi.org/project/uvn/)
[![License](https://img.shields.io/pypi/l/uvn)](https://opensource.org/licenses/MIT)
[![Python version](https://img.shields.io/pypi/pyversions/uvn)](https://pypi.org/project/uvn/)
[![Downloads](https://img.shields.io/pypi/dd/uvn)](https://pypi.org/project/uvn/)
[![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](https://github.com/yourusername/uvn)

[`uvn`](https://github.com/xmodar/uvn) is a centralized Python virtual environment manager designed to work alongside [`uv`](https://astral.sh/uv), similar to [`conda`](https://conda.io) for general environment management.

## Highlights

- 🎯 **Centralized Environments**: Manage all environments from a single location.
- 🛠️ **`uv` Integration**: Complements `uv` to streamline virtual environment management.
- ⚡️ **Simple CLI Interface**: Easily list, create, activate, and remove environments with straightforward commands.
- 🗂️ **Export Options**: Quickly export configurations as `requirements.txt` or inline script metadata.
- 💾 **Cloning**: Easily clone environments to create new ones.
- 🚀 **Minimal Dependencies**: Designed for simplicity and speed.

## Installation

Install `uv` first.

```bash
# On macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# On Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```

> [!CAUTION]
> Do not install `uv` via `pip`; use the shell commands above.

Then, install `uvn` with the `cli` extra.

```bash
# From PyPI
uv tool install uvn[cli]

# From GitHub
uv tool install uvn[cli] @ git+https://github.com/xmodar/uvn
```

> [!IMPORTANT]
> Although `uvn` can be installed via `pip`, using `uv` is recommended for best integration.

Finally, install `uvna` for easy shell activation (e.g., in `~/.bashrc` for `bash`).

```bash
target="~/.bashrc"
uvna=$(cat <<'EOF'
uvna() {
    activate=$(uvn activate --quiet "$1")
    if [[ -n "$activate" ]]; then
        eval "$activate"
    else
        uvn list
        echo "Could not activate '"$1"'!" >&2
    fi
}
EOF
)
target="${target/#\~/$HOME}"
if [[ -f "$target" ]] && grep -q "uvna() {" "$target"; then
  sed -i "/^uvna() {/,/^}$/d" "$target"
fi
echo "$uvna" >> "$target"
source "$target"
```

> [!TIP]
> Install shell completion (optional):
> ```bash
> uvn --install-completion
> ```

## Usage

After installing `uvn`, manage virtual environments that are centralized and accessible from any directory, similar to `conda`.

### Quick Start

To begin, create and activate an environment.

```bash
uvn create test --python 3.12
uvna test
```

> [!WARNING]
> Currently, `uvn activate <ENV_NAME>` only outputs the command for activation. Use `uvna` or manually run the output command to activate.

The `list` and `remove` commands are simple.

```bash
# List environments with their sizes
uvn list --size

# Remove the 'test' environment
uvn remove test
```

To install packages, you can simply use `uv pip` in an activated environment.

```bash
uvna test
uv pip install # ...
```

The `export` command offers various options for exporting environment configurations.

```bash
# Print dependencies as in requirements.txt
uvn export test

# Export inline script metadata
uvn export test py --short --lower

# Generate a requirements.txt file
uvn export test requirements.txt

# Prepend inline script metadata (automatically detects ".py")
uvn export test script.py

# Clone the environment
uvn fork test test2
```

> [!TIP]
> Use `--help` with any command to see available options.

### Commands

Available commands in `uvn`:

```plaintext
Usage: uvn [OPTIONS] COMMAND [ARGS]...

╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────╮
  list       List all virtual environments.
  create     Create a virtual environment.
  remove     Remove a virtual environment.
  export     Export a virtual environment.
  fork       Copy a virtual environment.
  activate   Show environment command.
  version    Show uvn version.
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────╮
 --install-completion Install completion for the current shell.
 --show-completion    Show completion for the current shell, to copy it or customize the installation.
 --help               Show this message and exit.
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

> [!TIP]
> Commands support prefixes (e.g., `uvn c` and `uvn cr` are short for `uvn create`).

> [!NOTE]
> The location of virtual environments can be set by changing the `UVN_DIR` environment variable. The default path is `~/.virtualenvs`.

## Contributing

Contributions are welcome! For suggestions or issues, please submit a pull request or open an issue on [GitHub](https://github.com/xmodar/uvn).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "uvn",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "conda, uv, uvenv, uvn, venv, virtualenv",
    "author": null,
    "author_email": "\"Modar M. Alfadly\" <modar.alfadly@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/da/cf/e7a5444b3a1a6f2be2055cbceef42a991f3529815ee76f2f7159f333a997/uvn-0.1.0.tar.gz",
    "platform": null,
    "description": "# uvn\n\n[![PyPI version](https://img.shields.io/pypi/v/uvn)](https://pypi.org/project/uvn/)\n[![License](https://img.shields.io/pypi/l/uvn)](https://opensource.org/licenses/MIT)\n[![Python version](https://img.shields.io/pypi/pyversions/uvn)](https://pypi.org/project/uvn/)\n[![Downloads](https://img.shields.io/pypi/dd/uvn)](https://pypi.org/project/uvn/)\n[![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg)](https://github.com/yourusername/uvn)\n\n[`uvn`](https://github.com/xmodar/uvn) is a centralized Python virtual environment manager designed to work alongside [`uv`](https://astral.sh/uv), similar to [`conda`](https://conda.io) for general environment management.\n\n## Highlights\n\n- \ud83c\udfaf **Centralized Environments**: Manage all environments from a single location.\n- \ud83d\udee0\ufe0f **`uv` Integration**: Complements `uv` to streamline virtual environment management.\n- \u26a1\ufe0f **Simple CLI Interface**: Easily list, create, activate, and remove environments with straightforward commands.\n- \ud83d\uddc2\ufe0f **Export Options**: Quickly export configurations as `requirements.txt` or inline script metadata.\n- \ud83d\udcbe **Cloning**: Easily clone environments to create new ones.\n- \ud83d\ude80 **Minimal Dependencies**: Designed for simplicity and speed.\n\n## Installation\n\nInstall `uv` first.\n\n```bash\n# On macOS and Linux\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n\n# On Windows\npowershell -ExecutionPolicy ByPass -c \"irm https://astral.sh/uv/install.ps1 | iex\"\n```\n\n> [!CAUTION]\n> Do not install `uv` via `pip`; use the shell commands above.\n\nThen, install `uvn` with the `cli` extra.\n\n```bash\n# From PyPI\nuv tool install uvn[cli]\n\n# From GitHub\nuv tool install uvn[cli] @ git+https://github.com/xmodar/uvn\n```\n\n> [!IMPORTANT]\n> Although `uvn` can be installed via `pip`, using `uv` is recommended for best integration.\n\nFinally, install `uvna` for easy shell activation (e.g., in `~/.bashrc` for `bash`).\n\n```bash\ntarget=\"~/.bashrc\"\nuvna=$(cat <<'EOF'\nuvna() {\n    activate=$(uvn activate --quiet \"$1\")\n    if [[ -n \"$activate\" ]]; then\n        eval \"$activate\"\n    else\n        uvn list\n        echo \"Could not activate '\"$1\"'!\" >&2\n    fi\n}\nEOF\n)\ntarget=\"${target/#\\~/$HOME}\"\nif [[ -f \"$target\" ]] && grep -q \"uvna() {\" \"$target\"; then\n  sed -i \"/^uvna() {/,/^}$/d\" \"$target\"\nfi\necho \"$uvna\" >> \"$target\"\nsource \"$target\"\n```\n\n> [!TIP]\n> Install shell completion (optional):\n> ```bash\n> uvn --install-completion\n> ```\n\n## Usage\n\nAfter installing `uvn`, manage virtual environments that are centralized and accessible from any directory, similar to `conda`.\n\n### Quick Start\n\nTo begin, create and activate an environment.\n\n```bash\nuvn create test --python 3.12\nuvna test\n```\n\n> [!WARNING]\n> Currently, `uvn activate <ENV_NAME>` only outputs the command for activation. Use `uvna` or manually run the output command to activate.\n\nThe `list` and `remove` commands are simple.\n\n```bash\n# List environments with their sizes\nuvn list --size\n\n# Remove the 'test' environment\nuvn remove test\n```\n\nTo install packages, you can simply use `uv pip` in an activated environment.\n\n```bash\nuvna test\nuv pip install # ...\n```\n\nThe `export` command offers various options for exporting environment configurations.\n\n```bash\n# Print dependencies as in requirements.txt\nuvn export test\n\n# Export inline script metadata\nuvn export test py --short --lower\n\n# Generate a requirements.txt file\nuvn export test requirements.txt\n\n# Prepend inline script metadata (automatically detects \".py\")\nuvn export test script.py\n\n# Clone the environment\nuvn fork test test2\n```\n\n> [!TIP]\n> Use `--help` with any command to see available options.\n\n### Commands\n\nAvailable commands in `uvn`:\n\n```plaintext\nUsage: uvn [OPTIONS] COMMAND [ARGS]...\n\n\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n  list       List all virtual environments.\n  create     Create a virtual environment.\n  remove     Remove a virtual environment.\n  export     Export a virtual environment.\n  fork       Copy a virtual environment.\n  activate   Show environment command.\n  version    Show uvn version.\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n --install-completion Install completion for the current shell.\n --show-completion    Show completion for the current shell, to copy it or customize the installation.\n --help               Show this message and exit.\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\n> [!TIP]\n> Commands support prefixes (e.g., `uvn c` and `uvn cr` are short for `uvn create`).\n\n> [!NOTE]\n> The location of virtual environments can be set by changing the `UVN_DIR` environment variable. The default path is `~/.virtualenvs`.\n\n## Contributing\n\nContributions are welcome! For suggestions or issues, please submit a pull request or open an issue on [GitHub](https://github.com/xmodar/uvn).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Modar M. Alfadly  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "uvn is conda for uv; a centralized Python virtual environment manager.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/xmodar/uvn"
    },
    "split_keywords": [
        "conda",
        " uv",
        " uvenv",
        " uvn",
        " venv",
        " virtualenv"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "98c40b1ecf45b3849ea94d3efdb3a7d57432e0ee27f528cc9e437bb535ea2f27",
                "md5": "a3a65337660923995a81de74520e03ce",
                "sha256": "e874f73826a410959342c1dc9a6e636c123a613defa460a3c0a5c48c7a4d3f14"
            },
            "downloads": -1,
            "filename": "uvn-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a3a65337660923995a81de74520e03ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11159,
            "upload_time": "2024-11-02T19:03:40",
            "upload_time_iso_8601": "2024-11-02T19:03:40.664097Z",
            "url": "https://files.pythonhosted.org/packages/98/c4/0b1ecf45b3849ea94d3efdb3a7d57432e0ee27f528cc9e437bb535ea2f27/uvn-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dacfe7a5444b3a1a6f2be2055cbceef42a991f3529815ee76f2f7159f333a997",
                "md5": "f424b9095d64a6bcabf7e24515c749ba",
                "sha256": "80e2e2a4e39e8186ff89d2413699bc7717984258ce09eb237d6153092b6f8aaa"
            },
            "downloads": -1,
            "filename": "uvn-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f424b9095d64a6bcabf7e24515c749ba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 24435,
            "upload_time": "2024-11-02T19:03:42",
            "upload_time_iso_8601": "2024-11-02T19:03:42.916461Z",
            "url": "https://files.pythonhosted.org/packages/da/cf/e7a5444b3a1a6f2be2055cbceef42a991f3529815ee76f2f7159f333a997/uvn-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-02 19:03:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xmodar",
    "github_project": "uvn",
    "github_not_found": true,
    "lcname": "uvn"
}
        
Elapsed time: 3.94786s