Skip to content

Commit

Permalink
updating to allow for all files to be passed from the PRs directory…
Browse files Browse the repository at this point in the history
…, this should allow for pages, etc.
  • Loading branch information
BSd3v committed Oct 11, 2024
1 parent d6e1b32 commit bab81b1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
7 changes: 2 additions & 5 deletions PRs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@

_dash_renderer._set_react_version("18.2.0")

app = Dash(__name__)
app = Dash(__name__, use_pages=True)

app.layout = dmc.MantineProvider([
html.Div('Hi PyCafe'),
dmc.MultiSelect(data=['Test1', 'Test2'])
])
app.layout = dmc.MantineProvider(page_container)

app.run()
9 changes: 9 additions & 0 deletions PRs/pages/home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from dash import *
import dash_mantine_components as dmc

layout = [
html.Div('Hi PyCafe'),
dmc.MultiSelect(data=['Test1', 'Test2'])
]

register_page(__name__, path='/')
29 changes: 15 additions & 14 deletions tmp_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,27 @@
files = []
code = ''
reqs = {}
for f in os.listdir('PRs'):
file_path = os.path.join('PRs', f)
if f not in ['app.py','requirements.txt']:
with open(file_path, 'rb') as file:
for root, dirs, filenames in os.walk('PRs'):
for f in filenames:
file_path = os.path.join(root, f)
if f not in ['app.py', 'requirements.txt']:
with open(file_path, 'rb') as file:
files.append(
{
"name": f,
"name": os.path.relpath(file_path, 'PRs'),
"content": base64.b64encode(file.read()).decode("utf8"),
"encoding": "base64"
}
)
elif f == 'app.py':
with open(file_path, 'r') as file:
code = file.read()
else:
with open(file_path, 'r') as file:
reqs = {
'name': f,
'content': file.read()
}
elif f == 'app.py':
with open(file_path, 'r') as file:
code = file.read()
elif f == 'requirements.txt':
with open(file_path, 'r') as file:
reqs = {
'name': os.path.relpath(file_path, 'PRs'),
'content': file.read()
}

new_package = f'{os.getenv("PACKAGE_NAME")} @ https://py.cafe/gh/artifact/{os.getenv("GITHUB_REPOSITORY")}/{os.getenv("ARTIFACT_ID")}/{os.getenv("FILE_FULLNAME")}'
if os.getenv("PACKAGE_NAME") in reqs['content']:
Expand Down

0 comments on commit bab81b1

Please sign in to comment.