Metadata-Version: 2.1
Name: idom
Version: 0.10.2
Summary: Control the web with Python
Home-page: https://github.com/rmorshea/idom
Author: Ryan Morshead
Author-email: ryan.morshead@gmail.com
License: MIT
Keywords: interactive,widgets,DOM,React
Platform: Linux
Platform: Mac OS X
Platform: Windows
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: loguru (>=0.3.2)
Requires-Dist: typing-extensions (>=3.7.4)
Requires-Dist: mypy-extensions (>=0.4.3)
Requires-Dist: anyio (>=1.4.0)
Requires-Dist: jsonpatch (>=1.26)
Requires-Dist: async-generator (>=1.10) ; python_version < "3.7"
Requires-Dist: async-exit-stack (>=1.0.1) ; python_version < "3.7"
Provides-Extra: all
Requires-Dist: sanic (<19.12.0) ; extra == 'all'
Requires-Dist: sanic-cors (>=0.9.9) ; extra == 'all'
Requires-Dist: matplotlib ; extra == 'all'
Requires-Dist: htm ; extra == 'all'
Requires-Dist: pyalect ; extra == 'all'
Requires-Dist: tagged ; extra == 'all'
Provides-Extra: dialect
Requires-Dist: htm ; extra == 'dialect'
Requires-Dist: pyalect ; extra == 'dialect'
Requires-Dist: tagged ; extra == 'dialect'
Provides-Extra: matplotlib
Requires-Dist: matplotlib ; extra == 'matplotlib'
Provides-Extra: sanic
Requires-Dist: sanic (<19.12.0) ; extra == 'sanic'
Requires-Dist: sanic-cors (>=0.9.9) ; extra == 'sanic'
Provides-Extra: stable
Requires-Dist: sanic (<19.12.0) ; extra == 'stable'
Requires-Dist: sanic-cors (>=0.9.9) ; extra == 'stable'

# IDOM

<a href="https://github.com/idom-team/idom/actions?query=workflow%3ATest">
  <img alt="Tests" src="https://github.com/idom-team/idom/workflows/Test/badge.svg?event=push" />
</a>
<a href="https://codecov.io/gh/rmorshea/idom">
  <img alt="Code Coverage" src="https://codecov.io/gh/rmorshea/idom/branch/master/graph/badge.svg" />
</a>
<a href="https://pypi.python.org/pypi/idom">
  <img alt="Version Info" src="https://img.shields.io/pypi/v/idom.svg"/>
</a>
<a href="https://github.com/rmorshea/idom/blob/master/LICENSE"/>
  <img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-purple.svg">
</a>

Libraries for creating and controlling interactive web pages with Python 3.7 and above.

**Be sure to [read the Documentation](https://idom-docs.herokuapp.com)**

IDOM is still young. If you have ideas or find a bug, be sure to post an
[issue](https://github.com/rmorshea/idom/issues)
or create a
[pull request](https://github.com/rmorshea/idom/pulls). Thanks in advance!

<h3>
  <a href="https://mybinder.org/v2/gh/rmorshea/idom/master?filepath=notebooks%2Fintroduction.ipynb">
    Try it Now
    <img alt="Binder" valign="bottom" height="25px"
    src="https://mybinder.org/badge_logo.svg"
    />
  </a>
</h3>

Click the badge above to get started! It will take you to a [Jupyter Notebooks](https://jupyter.org/)
hosted by [Binder](https://mybinder.org/) with some great examples.

### Or Install it Now

```bash
pip install idom[stable]
```

# At a Glance

IDOM can be used to create a simple slideshow which changes whenever a user clicks an image.

```python
import idom

@idom.element
def Slideshow():
    index, set_index = idom.hooks.use_state(0)
    url = f"https://picsum.photos/800/300?image={index}"
    return idom.html.img({"src": url, "onClick": lambda event: set_index(index + 1)})

server = idom.server.sanic.PerClientState(Slideshow)
server.daemon("localhost", 8765).join()
```

Running this will serve our slideshow to `"https://localhost:8765/client/index.html"`

<img src='https://picsum.photos/800/300?random'/>

You could even display the same thing in a Jupyter notebook!

```python
from idom.widgets.jupyter import init_display
display = init_display("127.0.0.1")
display(Slideshow)
```

Every click will then cause the image to change (it won't here of course).


