https://github.com/zmievsa/impexpr
A simple superset of Python with import expressions added in
https://github.com/zmievsa/impexpr
Last synced: about 1 year ago
JSON representation
A simple superset of Python with import expressions added in
- Host: GitHub
- URL: https://github.com/zmievsa/impexpr
- Owner: zmievsa
- License: mit
- Created: 2022-05-24T01:27:02.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-10-28T15:22:02.000Z (over 2 years ago)
- Last Synced: 2025-03-13T11:03:43.569Z (over 1 year ago)
- Language: Python
- Size: 16.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Impexpr
A simple superset of Python with import expressions added in. Beware: This project has only been made as a proof of concept and is not intended to ever be used in production.
## Installation
```bash
pip install impexpr
```
## Quickstart
`impexpr` alias can be used in the same way as `python` alias, a few examples:
* To run an interactive REPL with import expression support, run `impexpr`
* To run a script, run `impexpr script.py` (all imported modules will also support import expressions)
* To import itertools and use it in the same line:
```python
for x in (import itertools).chain([1, 2], [3, 4], [5, 6]):
print(x)
```
* To get help about collections.deque:
```python
help((import collections).deque)
```
* If your script must run with python alias but you want to enable import expression support in all imported modules (not in the main script!), you can use:
```python
import impexpr
impexpr.add_hook()
# this will now support import expressions
import my_other_script
```
* For everything else, run `impexpr --help`
## FAQ
* Relative imports not supported yet