Metadata-Version: 2.5
Name: ideas
Version: 0.3.14
Summary: Easy creation of import hooks to test ideas.
Project-URL: Documentation, https://aroberge.github.io/ideas/docs/html/
Project-URL: Issues, https://github.com/aroberge/ideas/issues
Project-URL: Source, https://github.com/aroberge/ideas
Author-email: André Roberge <andre.roberge@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.8
Requires-Dist: token-utils>=0.3.2
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: flake8; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Description-Content-Type: text/markdown

# ideas: *Making it easier to extend Python's syntax*

![ideas logo](https://raw.githubusercontent.com/aroberge/ideas/master/ideas.png)

The purpose of **ideas** is to allow you to easily implement changes in Python's syntax
and be able to see their result either when importing files using your new syntax or
in a specialized REPL, without having to change the Python interpreter itself.


## Installation

```
python -m pip install ideas
```

Depending on your OS, you might need to write `python3` or `py` instead of `python` in the above.

## Usage

```
ideas -a my_cool_new_syntax [my_program[.py]]
```

Admitedly this is a bit terse ... Let's go into a bit more details.

### Usage in more details

As a specific example of a new syntax, suppose that you want to use
`function` as a keyword in Python, to mean
the same thing as `lambda`, enabling you to write

```python
# my_program.py

square = function x: x**2
print(f"{square(4)} is the square of 4.")

if __name__ == "__main__":
    print("This is run as the main module.")
```

You can easily do this with **ideas**.
The simplest way would be as follows:

```python
# my_cool_new_syntax.py

from ideas import create_hook

def transform(source, **kwargs):  # This will also replace lambda in strings :(
    return source.replace("function", "lambda")

def add_hook():
    create_hook(transform_source=transform, name=__main__)
```
Then to use it in an REPL, or optionally to run the python script
mentioned above, all you would need to do is:


```
ideas -a my_cool_new_syntax [my_program]
```

That's it!

Much more can be found in the [documentation](https://aroberge.github.io/ideas/docs/html/).

## Dependencies

 - [token-utils](https://github.com/aroberge/token-utils)
 - Python 3.8+  (it might even work with older versions, but is no longer tested.)

## Tools

This project uses [black](https://black.readthedocs.io/en/stable/) for formatting,
[pytest](https://docs.pytest.org/en/latest/) for running tests,
and [flake8](https://flake8.pycqa.org/en/latest/) for linting with custom
settings compatible with black.

## License

MIT

