yen


Nameyen JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/tusharsadhwani/yen
SummaryThe last Python environment manager you'll ever need.
upload_time2024-06-28 23:48:03
maintainerNone
docs_urlNone
authorTushar Sadhwani
requires_python>=3.7
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # yen

The last Python environment manager you'll ever need.

![Credits: xkcd.com/1987](https://imgs.xkcd.com/comics/python_environment.png)

We're finally putting an end to this XKCD.

## So what can `yen` do?

- **Get any Python version running instantly** with just 1 command:

  ```console
  $ python
  'python': command not found

  $ yen exec --python 3.12
  Downloading 3.12.3 ━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 17.4/17.4 MB • 29.1 MB/s
  Python 3.12.3 (main, Apr 15 2024, 17:43:11) [Clang 17.0.6 ] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> exit()

  $ yen exec --python 3.12  # Cached for subsequent uses:
  Python 3.12.3 (main, Apr 15 2024, 17:43:11) [Clang 17.0.6 ] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>>
  ```

  Works on Windows, MacOS and Linux (`libc` and `musl`), on Intel and ARM chips.

- **Instant `venv` creation**: Thanks to `microvenv`, `yen` can create virutal
  environments much faster than the builtin `venv` module:

  ```console
  $ yen create venv -p 3.9
  Created venv with Python 3.9.18 ✨

  $ source venv/bin/activate

  (venv) $ python --version
  Python 3.9.18
  ```

  > NOTE: It's not that fast right now as I found a bug. Working on it.

- **Zero dependencies**: No need to have Python installed, no need to look into `apt`,
  `homebrew` etc., just run one shell command to get `yen` set up locally.

- **Python script management**: Never run `pip install` to get a tool like `ruff`,
  `awscli` etc. in the global Python environment ever again.

**Essentially, `yen` lets you replace various Python environment management tools
such as `pyenv`, `pipx` and `virtualenv`, with a single static binary.**

Running Python code on any machine has never been this easy.

## Installation

Get `yen` by running the following command:

- MacOS / Linux:

  ```bash
  curl -L yen.tushar.lol/install.sh | sh
  ```

- Windows:

  Using cmd:

  ```cmd
  curl -L yen.tushar.lol/install.bat | cmd
  ```

  or using Powershell:

  ```pwsh
  curl -L yen.tushar.lol/install.ps1 | Invoke-Expression
  ```

or if you prefer, get it via `pip`:

```bash
pip install yen
```

or `pipx`:

```bash
pipx run yen
```

> Yeah, if you already have `yen`, you can do `yen run yen` and that works.
> But don't do that.

You can also grab the binary from [GitHub releases](https://github.com/tusharsadhwani/yen/releases).

## Usage

```console
$ yen list
Available Pythons:
3.12.3
3.11.9
3.10.14
3.9.19
3.8.19

$ yen create venv -p 3.12
Downloading 3.12.3 ━━━━━━━━━━━━━━━━━━━━━━━━━ 100.0% • 17.4/17.4 MB • 12.4 MB/s
Created venv with Python 3.12.3 ✨

$ yen install meowsay
Installed package meowsay with Python 3.12.3 ✨

$ meowsay hello!
 ________
< hello! >
 --------
        \      |\---/|
         \     | ,_, |
                \_`_/-..----.
             ___/ `   ' ,\"\"+ \  sk
            (__...'   __\    |`.___.';
              (_,...'(_,.`__)/'.....+

$ yen run --python 3.9 wttr
Weather report: Milano, Italy

     \  /       Partly cloudy
   _ /"".-.     20 °C
     \_(   ).   ↑ 4 km/h
     /(___(__)  10 km
                0.0 mm

$ wttr paris
Weather report: paris

      \   /     Sunny
       .-.      +22(25) °C
    ― (   ) ―   ↓ 7 km/h
       `-’      10 km
      /   \     0.0 mm
```

> By default the Pythons will be downloaded in `~/.yen_pythons`.
> You can change this location by setting the `YEN_PYTHONS_PATH` environment variable.

## Local Development / Testing

- Run `yen create venv` and `venv/bin/activate`
- Run `pip install -r requirements-dev.txt` to do an editable install
- Verify that you're now pointing at the correct `yen`:

  ```console
  $ which yen
  /home/your_name/code/yen/venv/bin/yen
  ```

- Run `pytest` to run tests

To run Rust tests:

- Compile the rust project: `cd yen-rs && cargo build`
- Run `export YEN_RUST_PATH=./yen-rs/target/debug/yen-rs`
- Run `pytest`, and ensure that number of tests ran has doubled.

### `microvenv.py` and `userpath.pyz`

These two files are used by `yen` and downloaded by the `yen` install script.

- `microvenv.py` is just [this file][1] renamed.
- `userpath.pyz` is created by running `./build-standalone.sh` in
  [this fork of userpath][2].

[1]: https://github.com/brettcannon/microvenv/blob/3460d1e/microvenv/_create.py
[2]: https://github.com/tusharsadhwani/userpath-standalone

## Type Checking

Run `mypy .`

## Create and upload a package to PyPI

Make sure to bump the version in `setup.cfg`.

Then run the following commands:

```bash
pip install setuptools wheel twine
rm -rf build dist
python setup.py sdist bdist_wheel
```

Then upload it to PyPI using [twine](https://twine.readthedocs.io/en/latest/#installation):

```bash
twine upload dist/*
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tusharsadhwani/yen",
    "name": "yen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Tushar Sadhwani",
    "author_email": "tushar.sadhwani000@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/28/78/8f8ad46f038fd9e6f6fa7b04b5d37c810d09a493b9089e012f6846a192a6/yen-0.6.0.tar.gz",
    "platform": null,
    "description": "# yen\n\nThe last Python environment manager you'll ever need.\n\n![Credits: xkcd.com/1987](https://imgs.xkcd.com/comics/python_environment.png)\n\nWe're finally putting an end to this XKCD.\n\n## So what can `yen` do?\n\n- **Get any Python version running instantly** with just 1 command:\n\n  ```console\n  $ python\n  'python': command not found\n\n  $ yen exec --python 3.12\n  Downloading 3.12.3 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100.0% \u2022 17.4/17.4 MB \u2022 29.1 MB/s\n  Python 3.12.3 (main, Apr 15 2024, 17:43:11) [Clang 17.0.6 ] on darwin\n  Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n  >>> exit()\n\n  $ yen exec --python 3.12  # Cached for subsequent uses:\n  Python 3.12.3 (main, Apr 15 2024, 17:43:11) [Clang 17.0.6 ] on darwin\n  Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n  >>>\n  ```\n\n  Works on Windows, MacOS and Linux (`libc` and `musl`), on Intel and ARM chips.\n\n- **Instant `venv` creation**: Thanks to `microvenv`, `yen` can create virutal\n  environments much faster than the builtin `venv` module:\n\n  ```console\n  $ yen create venv -p 3.9\n  Created venv with Python 3.9.18 \u2728\n\n  $ source venv/bin/activate\n\n  (venv) $ python --version\n  Python 3.9.18\n  ```\n\n  > NOTE: It's not that fast right now as I found a bug. Working on it.\n\n- **Zero dependencies**: No need to have Python installed, no need to look into `apt`,\n  `homebrew` etc., just run one shell command to get `yen` set up locally.\n\n- **Python script management**: Never run `pip install` to get a tool like `ruff`,\n  `awscli` etc. in the global Python environment ever again.\n\n**Essentially, `yen` lets you replace various Python environment management tools\nsuch as `pyenv`, `pipx` and `virtualenv`, with a single static binary.**\n\nRunning Python code on any machine has never been this easy.\n\n## Installation\n\nGet `yen` by running the following command:\n\n- MacOS / Linux:\n\n  ```bash\n  curl -L yen.tushar.lol/install.sh | sh\n  ```\n\n- Windows:\n\n  Using cmd:\n\n  ```cmd\n  curl -L yen.tushar.lol/install.bat | cmd\n  ```\n\n  or using Powershell:\n\n  ```pwsh\n  curl -L yen.tushar.lol/install.ps1 | Invoke-Expression\n  ```\n\nor if you prefer, get it via `pip`:\n\n```bash\npip install yen\n```\n\nor `pipx`:\n\n```bash\npipx run yen\n```\n\n> Yeah, if you already have `yen`, you can do `yen run yen` and that works.\n> But don't do that.\n\nYou can also grab the binary from [GitHub releases](https://github.com/tusharsadhwani/yen/releases).\n\n## Usage\n\n```console\n$ yen list\nAvailable Pythons:\n3.12.3\n3.11.9\n3.10.14\n3.9.19\n3.8.19\n\n$ yen create venv -p 3.12\nDownloading 3.12.3 \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 100.0% \u2022 17.4/17.4 MB \u2022 12.4 MB/s\nCreated venv with Python 3.12.3 \u2728\n\n$ yen install meowsay\nInstalled package meowsay with Python 3.12.3 \u2728\n\n$ meowsay hello!\n ________\n< hello! >\n --------\n        \\      |\\---/|\n         \\     | ,_, |\n                \\_`_/-..----.\n             ___/ `   ' ,\\\"\\\"+ \\  sk\n            (__...'   __\\    |`.___.';\n              (_,...'(_,.`__)/'.....+\n\n$ yen run --python 3.9 wttr\nWeather report: Milano, Italy\n\n     \\  /       Partly cloudy\n   _ /\"\".-.     20 \u00b0C\n     \\_(   ).   \u2191 4 km/h\n     /(___(__)  10 km\n                0.0 mm\n\n$ wttr paris\nWeather report: paris\n\n      \\   /     Sunny\n       .-.      +22(25) \u00b0C\n    \u2015 (   ) \u2015   \u2193 7 km/h\n       `-\u2019      10 km\n      /   \\     0.0 mm\n```\n\n> By default the Pythons will be downloaded in `~/.yen_pythons`.\n> You can change this location by setting the `YEN_PYTHONS_PATH` environment variable.\n\n## Local Development / Testing\n\n- Run `yen create venv` and `venv/bin/activate`\n- Run `pip install -r requirements-dev.txt` to do an editable install\n- Verify that you're now pointing at the correct `yen`:\n\n  ```console\n  $ which yen\n  /home/your_name/code/yen/venv/bin/yen\n  ```\n\n- Run `pytest` to run tests\n\nTo run Rust tests:\n\n- Compile the rust project: `cd yen-rs && cargo build`\n- Run `export YEN_RUST_PATH=./yen-rs/target/debug/yen-rs`\n- Run `pytest`, and ensure that number of tests ran has doubled.\n\n### `microvenv.py` and `userpath.pyz`\n\nThese two files are used by `yen` and downloaded by the `yen` install script.\n\n- `microvenv.py` is just [this file][1] renamed.\n- `userpath.pyz` is created by running `./build-standalone.sh` in\n  [this fork of userpath][2].\n\n[1]: https://github.com/brettcannon/microvenv/blob/3460d1e/microvenv/_create.py\n[2]: https://github.com/tusharsadhwani/userpath-standalone\n\n## Type Checking\n\nRun `mypy .`\n\n## Create and upload a package to PyPI\n\nMake sure to bump the version in `setup.cfg`.\n\nThen run the following commands:\n\n```bash\npip install setuptools wheel twine\nrm -rf build dist\npython setup.py sdist bdist_wheel\n```\n\nThen upload it to PyPI using [twine](https://twine.readthedocs.io/en/latest/#installation):\n\n```bash\ntwine upload dist/*\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "The last Python environment manager you'll ever need.",
    "version": "0.6.0",
    "project_urls": {
        "Homepage": "https://github.com/tusharsadhwani/yen"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1cfeafe77f922b0eddf187ea61fcd8c56463921ba4d7ae1d1fa431a280a2f06c",
                "md5": "421999d80f6dc0bd4da892845ed3cb7b",
                "sha256": "3f2c22130ec187f429588f3416c4f29f56f0f91a29506478b84426ce8fccce60"
            },
            "downloads": -1,
            "filename": "yen-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "421999d80f6dc0bd4da892845ed3cb7b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16829,
            "upload_time": "2024-06-28T23:48:02",
            "upload_time_iso_8601": "2024-06-28T23:48:02.160739Z",
            "url": "https://files.pythonhosted.org/packages/1c/fe/afe77f922b0eddf187ea61fcd8c56463921ba4d7ae1d1fa431a280a2f06c/yen-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "28788f8ad46f038fd9e6f6fa7b04b5d37c810d09a493b9089e012f6846a192a6",
                "md5": "4d8aae1101e523424f08d35d745f5d57",
                "sha256": "3bbc486f66e71f9cfbafac55c8810eb09989951e357f4db69c34f49642ad1c97"
            },
            "downloads": -1,
            "filename": "yen-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4d8aae1101e523424f08d35d745f5d57",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 18592,
            "upload_time": "2024-06-28T23:48:03",
            "upload_time_iso_8601": "2024-06-28T23:48:03.648978Z",
            "url": "https://files.pythonhosted.org/packages/28/78/8f8ad46f038fd9e6f6fa7b04b5d37c810d09a493b9089e012f6846a192a6/yen-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-28 23:48:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tusharsadhwani",
    "github_project": "yen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "yen"
}
        
Elapsed time: 1.18869s