# Idae
[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)
[![codecov](https://codecov.io/gh/ThatXliner/idae/branch/main/graph/badge.svg)](https://codecov.io/gh/ThatXliner/idae)
[![CI](https://github.com/ThatXliner/idae/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ThatXliner/idae/actions/workflows/ci.yml)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/idae)](https://pypi.org/project/idae)
[![PyPI](https://img.shields.io/pypi/v/idae)](https://pypi.org/project/idae)
[![PyPI - License](https://img.shields.io/pypi/l/idae)](#license)
> A [PEP 723][] implementation
[PEP 723]: https://peps.python.org/pep-0723/
## Usage
Run like normal Python except that the first argument must be a path to the script.
```
idae example.py
```
The dependency specification within the Python script must be like the following (example from [PEP 723][]):
```python
#!/usr/bin/env idae
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
import requests
from rich.pretty import pprint
resp = requests.get("https://peps.python.org/api/peps.json")
data = resp.json()
pprint([(k, v["title"]) for k, v in data.items()][:10])
```
If you need to pass arguments that look like options for `idae` to the script you want to run, use the standard UNIX convention of `--`. For example, let's say you have a script
```python
# script.py
import sys
print(" ".join(sys.argv[1:]))
```
and you want that script to output `I am --help`. To run it with Idae, use
```
idae script.py -- I am --help
```
## Caveats
- [No logging, or very minimal output reporting](https://github.com/ThatXliner/idae/issues/10)
## How it works
1. Detect script file
2. Detect appropriate Python executable
3. Use [venv][] to create a temporary virtual environment in the [user cache directory][] using the executable detected
4. Find [PEP 723][] `pip` requirements
5. Install them into the virtual environment
6. Run the script within the virtual environment
Run `idae clean` to remove all cached environments to free up space. Environments are cached per set of requirements.
[venv]: https://docs.python.org/3/library/venv.html
[user cache directory]: https://platformdirs.readthedocs.io/en/latest/api.html#cache-directory
## Installation
You can get this project via `pip`
```bash
$ pip install idae
```
But we **highly recommend** you install this project using [pipx](https://pypa.github.io/pipx/)
```bash
$ pipx install idae
```
## Why the name
The scientific name for Pythons is "Pythonidae". I just removed the "Python" and we get "idae".
## License
This project is licensed under the [GNU GPL v3+](https://github.com/ThatXliner/idae/blob/main/LICENSE.txt).
In short, this means you can do anything with it (distribute, modify, sell) but if you were to publish your changes, you must make the source code and build instructions readily available.
If you are a company using this project and want an exception, email me at [thatxliner@gmail.com](mailto:thatxliner@gmail.com) and we can discuss.
Raw data
{
"_id": null,
"home_page": "https://github.com/ThatXliner/idae",
"name": "idae",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "script,cli,python,typer",
"author": "Bryan Hu",
"author_email": "thatxliner@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/cf/cc/397d61ab94ad7fd081bde108dc212e706f8606c189781507725b17c77a8c/idae-1.1.0.tar.gz",
"platform": null,
"description": "# Idae\n\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)\n[![Checked with mypy](http://www.mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/)\n[![codecov](https://codecov.io/gh/ThatXliner/idae/branch/main/graph/badge.svg)](https://codecov.io/gh/ThatXliner/idae)\n\n[![CI](https://github.com/ThatXliner/idae/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ThatXliner/idae/actions/workflows/ci.yml)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/idae)](https://pypi.org/project/idae)\n[![PyPI](https://img.shields.io/pypi/v/idae)](https://pypi.org/project/idae)\n[![PyPI - License](https://img.shields.io/pypi/l/idae)](#license)\n\n> A [PEP 723][] implementation\n\n[PEP 723]: https://peps.python.org/pep-0723/\n\n## Usage\n\nRun like normal Python except that the first argument must be a path to the script.\n\n```\nidae example.py\n```\n\nThe dependency specification within the Python script must be like the following (example from [PEP 723][]):\n\n```python\n#!/usr/bin/env idae\n# /// script\n# requires-python = \">=3.11\"\n# dependencies = [\n# \"requests<3\",\n# \"rich\",\n# ]\n# ///\n\nimport requests\nfrom rich.pretty import pprint\n\nresp = requests.get(\"https://peps.python.org/api/peps.json\")\ndata = resp.json()\npprint([(k, v[\"title\"]) for k, v in data.items()][:10])\n```\n\nIf you need to pass arguments that look like options for `idae` to the script you want to run, use the standard UNIX convention of `--`. For example, let's say you have a script\n\n```python\n# script.py\nimport sys\nprint(\" \".join(sys.argv[1:]))\n```\n\nand you want that script to output `I am --help`. To run it with Idae, use\n\n```\nidae script.py -- I am --help\n```\n\n## Caveats\n\n- [No logging, or very minimal output reporting](https://github.com/ThatXliner/idae/issues/10)\n\n## How it works\n\n1. Detect script file\n2. Detect appropriate Python executable\n3. Use [venv][] to create a temporary virtual environment in the [user cache directory][] using the executable detected\n4. Find [PEP 723][] `pip` requirements\n5. Install them into the virtual environment\n6. Run the script within the virtual environment\n\nRun `idae clean` to remove all cached environments to free up space. Environments are cached per set of requirements.\n\n[venv]: https://docs.python.org/3/library/venv.html\n[user cache directory]: https://platformdirs.readthedocs.io/en/latest/api.html#cache-directory\n\n## Installation\n\nYou can get this project via `pip`\n\n```bash\n$ pip install idae\n```\n\nBut we **highly recommend** you install this project using [pipx](https://pypa.github.io/pipx/)\n\n```bash\n$ pipx install idae\n```\n\n## Why the name\n\nThe scientific name for Pythons is \"Pythonidae\". I just removed the \"Python\" and we get \"idae\".\n\n## License\n\nThis project is licensed under the [GNU GPL v3+](https://github.com/ThatXliner/idae/blob/main/LICENSE.txt).\n\nIn short, this means you can do anything with it (distribute, modify, sell) but if you were to publish your changes, you must make the source code and build instructions readily available.\n\nIf you are a company using this project and want an exception, email me at [thatxliner@gmail.com](mailto:thatxliner@gmail.com) and we can discuss.\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "A PEP 772 implementation",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/ThatXliner/idae"
},
"split_keywords": [
"script",
"cli",
"python",
"typer"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "362bdcff748dd498a073d7d8212e34d15c37c6d5d92b60e35bbcd66b77fce844",
"md5": "53fc6029855404fb2b502efbd53e45e9",
"sha256": "d4325b876dcae48277ccb978399d7716766ba1ad866a95b4b8b17a2df15a2838"
},
"downloads": -1,
"filename": "idae-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "53fc6029855404fb2b502efbd53e45e9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 20588,
"upload_time": "2024-01-09T21:36:15",
"upload_time_iso_8601": "2024-01-09T21:36:15.191760Z",
"url": "https://files.pythonhosted.org/packages/36/2b/dcff748dd498a073d7d8212e34d15c37c6d5d92b60e35bbcd66b77fce844/idae-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cfcc397d61ab94ad7fd081bde108dc212e706f8606c189781507725b17c77a8c",
"md5": "44aaf5740f67386c5d6b30007b15c5e6",
"sha256": "58ac9ae718aae5e1af95a3835e6be65730d72330bc7ff5899e28d750cf0803aa"
},
"downloads": -1,
"filename": "idae-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "44aaf5740f67386c5d6b30007b15c5e6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 20307,
"upload_time": "2024-01-09T21:36:16",
"upload_time_iso_8601": "2024-01-09T21:36:16.944247Z",
"url": "https://files.pythonhosted.org/packages/cf/cc/397d61ab94ad7fd081bde108dc212e706f8606c189781507725b17c77a8c/idae-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-09 21:36:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ThatXliner",
"github_project": "idae",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "idae"
}