Metadata-Version: 2.1
Name: nowpy
Version: 0.1.6
Summary: Run any Python file instantly, with just one command
Home-page: https://github.com/WillDenby/nowpy
License: MIT
Author: WillDenby
Author-email: 119456795+WillDenby@users.noreply.github.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: toml (>=0.10.2,<0.11.0)
Requires-Dist: typeguard (>=4.3.0,<5.0.0)
Requires-Dist: typer (>=0.9.0,<0.10.0)
Requires-Dist: virtualenv (>=20.26.6,<21.0.0)
Project-URL: Repository, https://github.com/WillDenby/nowpy
Description-Content-Type: text/markdown

# nowpy - Run Any Python File Instantly

**nowpy** combines `python`, `venv`, and `pip` to launch a dedicated isolated environment, automatically figure out which packages are required, and then run your Python file - all with just **one** command. 

**nowpy** finds packages by performing a recursive lookup for a `requirements.txt` or a Poetry-flavoured `pyproject.toml`, and cross-checks with any `import` statements inside the Python file. 

**Note**: **nowpy** should find many common packages whose `import` names don't match their PyPI distribution names, such as `import sklearn` -> `pip install scikit-learn`, but the hardcoded list of substitutions is definitely not exhaustive. 

## Installation

Install **nowpy** with `pip` or `pipx`. If you only really run scripts, this might be the last time you ever have to `pip install` anything...

```sh
pip install nowpy
# Even better
pipx install nowpy
```

## Usage

Here's an example of what happens if you run **nowpy** on a Python file that imports `requests`. 

First run:

```sh
nowpy WorldTimeApi.py

Creating venv...
Collecting requests
...
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2023.11.17 charset-normalizer-3.3.2 idna-3.6 requests-2.31.0 urllib3-2.2.0
Running Script...

Current Time in Europe/London
Date: 2024-01-30T22:08:52.854140+00:00
Timezone: Europe/London
```

All future runs:

```sh
nowpy WorldTimeApi.py

Running Script...

Current Time in Europe/London
Date: 2024-01-30T22:08:52.854140+00:00
Timezone: Europe/London
```

**nowpy** creates a unique virtual environment for every directory you run `nowpy` from. It also removes unused ones automatically over time (only five ever exist). But if you ever want to reset the virtual environment in a directory that you're using, just use the `--reset` option:

```sh
nowpy --reset
```

That's all!
 
## Roadmap

- Enable **nowpy** to find packages required by generic `pyproject.toml` files, not just "Poetry-flavoured" ones. 

## License

Made and released under the [MIT](https://choosealicense.com/licenses/mit/) license.

