Refactor into module

Add Dockerfile with kluges
Update portfolio
This commit is contained in:
Daniel McKnight 2025-01-30 21:15:57 -08:00
parent 53df537650
commit 7ebdeeaa3c
9 changed files with 37 additions and 8 deletions

9
Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM python:3.12-bookworm
EXPOSE 8080
COPY site_mcknight_tech /site
COPY requirements.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
ENTRYPOINT [ "python3", "/site/__main__.py" ]

1
requirements.txt Normal file
View file

@ -0,0 +1 @@
nicegui~=2.10

View file

17
__main__.py → site_mcknight_tech/__main__.py Normal file → Executable file
View file

@ -1,5 +1,6 @@
from os.path import abspath, isfile
# Copyright (C) 2025 Daniel McKnight - All Rights Reserved
from os.path import isfile, join, dirname
from nicegui import ui
_tab_to_content = {
@ -16,9 +17,10 @@ def _get_content_from_file(file_name: str) -> str:
Take a file name/path and return its contents
:param file_name: Relative or absolute path to a file
"""
if not isfile(abspath(file_name)):
file_name = join(dirname(__file__), file_name)
if not isfile(file_name):
file_name = _error_page
with open(abspath(file_name), 'r') as f:
with open(file_name, 'r') as f:
return f.read()
def render_tab(tab_name: str):
@ -32,11 +34,11 @@ def render_header() -> ui.tab_panels:
"""
tab_names = _tab_to_content.keys()
with ui.tabs().classes('w-full') as tabs:
tab_list = [ui.tab(name) for name in tab_names]
tab_list = {name: ui.tab(name) for name in tab_names}
with ui.tab_panels(tabs).classes('w-full') as header:
for t in tab_list:
for name, t in tab_list.items():
with ui.tab_panel(t):
render_tab(t._props['name'])
render_tab(name)
return header
def main():
@ -45,5 +47,4 @@ def main():
ui.run(dark=None)
if __name__ in ("__main__", "__mp_main__"):
main()
main()

View file

@ -2,6 +2,13 @@
I have developed and contributed to hundreds of open source repositories on GitHub (as well as some Private ones that
I cannot share here). This is just a selection of some of my favorite projects and what I like about them.
## Neon Core
This is the primary project I contributed to as part of my work at NeonGecko. It started as work with the (now defunct)
open source Mycroft AI project, turned into a proprietary fork, and then we ended up open sourcing that fork. Working on
this project, I learned a lot about contributing to open source and managing open source projects. At the start, I learned
how to be a helpful individual contributor, and later I was on the other side, learning how to interface with the community
to balance internal goals with community feedback.
## `neon-data-models`
This repository contains barely any functional code, but it was an exercise in careful planning.
It is structured into a logical hierarchy with documentation and unit tests.
@ -25,6 +32,17 @@ This isn't the prettiest project, but it is my first foray into writing Helm cha
developer-oriented CLI tools for generating Helm charts to deploy the same services NeonGecko uses in production
systems.
## `neon-debos`
This project was my first foray into Go templates. It started as a fork of another similar project which I adapted to
our needs. As part of this project, I used squashfs/overlayfs to enable safe OS updates with methods to roll-back or
reset an installation in case of any errors. To support this, I compiled custom kernels and implemented a customized
initramfs.
## `.github`
This repository contains a number of shared GitHub Actions, in addition to the standard issue templates and other special
files GitHub supports here. Creating this repository was part of an effort to consolidate code and make sprawling
repositories more manageable.
## `neon-docs`
Just what it says, this is all documentation.