Skip to content

Commit

Permalink
cleanup project and draft deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
javierluraschi committed May 8, 2024
1 parent eb5ede6 commit 8a4a355
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 12,645 deletions.
6 changes: 2 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Changelog

<!--next-version-placeholder-->
## v2.0.0

## v0.0.1 (29/07/2022)

- First release!
- Create and deploy projects
4 changes: 4 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.

## Python

To contribute to the Python package, see [python/README.md](python/README.md).

## Types of Contributions

### Report Bugs
Expand Down
45 changes: 5 additions & 40 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,10 @@
# Hal9: Data apps powered by code and LLMs
# Python Component

[![Hal9 PyPi Downloads](https://img.shields.io/pypi/dm/hal9?label=PyPI)](https://pypi.org/project/hal9/) [![Hal9 NPM Downloads](https://img.shields.io/npm/dm/hal9.svg?label=NPM)](https://www.npmjs.com/package/hal9)
## Contributing

Hal9 is a framework for building *interactive data apps*. It allows you to utilize your DS/ML code with minimal overhead, and frees you from having to worry about frontend web frameworks. Hal9 consists of the following components:

- **LLM**: A text interface to design your app using large language models.
<!-- - **Multi-Lingual**: Packages in R, Python (and more on the way!). -->

## Getting started

The quickest place to test things out is this hosted demo: [hal9.com/new](https://hal9.com).
<!-- Refer to the Docs at [hal9.com/docs](https://hal9.com/docs/). -->

### Python
Start by installing the package:

```bash
pip install hal9
pip install poetry
poetry install
```

```python
import hal9 as h9
h9.get_app("asks for your name and prints hello")
```

### R

The development version of the package can be installed via

```r
remotes::install_github("hal9ai/hal9", subdir = "r")

library(hal9)
h9_start("asks for your name and prints hello")
```

<!-- ## Principles
- Easy to get started. You don't need to read a book or build a reactive execution graph in your head
before you can build a dashboard.
- First-class multi-lingual support. Power your apps with Python, or R, or combine them, *natively*, without having
to use interop tools such as reticulate or rpy2. Rust and TypeScript APIs are being developed next, with many more to come.
- Respect code and reproducibility. While we make it easy to build apps, all artifacts should be in standard formats
so that you can (if you'd like) work with actual web designers on your team to fulfill corporate styling needs.
- Seamless deployment from applications to production. -->
1 change: 0 additions & 1 deletion python/hal9/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from hal9.core import *
from hal9.login import login
53 changes: 29 additions & 24 deletions python/hal9/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,38 @@
import sys
import runpy

def get_app(prompt :str) -> str:
"""Generate an app using that does what the prompt says
def create(template :str) -> str:
"""Create an app for the given template
Parameters
----------
prompt : str
The prompt that you want the app to achieve.
template : str
The template to use to create the project.
"""

response = requests.post('https://api.hal9.com/api/generator', json = {
'prompt': prompt
})
while not response.ok:
response = requests.post('https://api.hal9.com/api/generator', json = {
'prompt': prompt
def deploy(project :str, destination :str) -> str:
"""Deploy project to given destination
Parameters
----------
project : str
The project name used to deploy the app.
destination : str
The deployment destination, defaults to Hal9.
"""

response = requests.post('https://api.hal9.com/api/v1/deploy', json = {
'name': 'name',
'title': 'title',
'description': 'description',
'access': 'access',
'code': 'code',
'prompt': 'prompt',
'thumbnail': 'thumbnail',
'token': 'token',
'user': 'user',
})
task_id = response.json()['taskid']
r = requests.get('https://api.hal9.com/api/generator/'+ str(task_id))
print('Loading your app..')
if r.ok:
while not r.json()['ready']:
time.sleep(3)
r = requests.get('https://api.hal9.com/api/generator/'+ str(task_id))
apps =r.json()['apps']
code = apps[0]['code']
with tempfile.NamedTemporaryFile(mode = "w+", prefix = 'st_app', suffix='.py') as tmp:
tmp.write(code)
tmp.seek(0)
sys.argv = ["streamlit", "run", tmp.name ]
runpy.run_module("streamlit", run_name="__main__")

if not response.ok:
print('Failed to deploy')
exit()
38 changes: 0 additions & 38 deletions python/hal9/login/__init__.py

This file was deleted.

6 changes: 0 additions & 6 deletions python/hal9/login/frontend/.env

This file was deleted.

2 changes: 0 additions & 2 deletions python/hal9/login/frontend/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion python/hal9/login/frontend/.prettierrc

This file was deleted.

48 changes: 0 additions & 48 deletions python/hal9/login/frontend/package.json

This file was deleted.

33 changes: 0 additions & 33 deletions python/hal9/login/frontend/public/index.html

This file was deleted.

68 changes: 0 additions & 68 deletions python/hal9/login/frontend/src/Hal9Login.tsx

This file was deleted.

Loading

0 comments on commit 8a4a355

Please sign in to comment.