Skip to content

Commit 143be0f

Browse files
committed
Add license to each file
1 parent c636945 commit 143be0f

File tree

12 files changed

+137
-8
lines changed

12 files changed

+137
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/*
2+
ltk.egg-info/*
3+
pyscript_ltk.egg-info/*

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,30 @@ LTK is covered under the Apache License:
112112
- The license does not require derived works to adopt the Apache license. Though this is encouraged for consistency.
113113

114114

115+
116+
## Upload new version to PyPi
117+
118+
First build the package into a source distribution and a Python wheel:
119+
```console
120+
python3 -m pip install --user --upgrade setuptools wheel twine build
121+
python3 -m build
122+
```
123+
124+
Then verify whether the build works for pypi:
125+
```console
126+
twine check dist/*
127+
```
128+
129+
Then upload to the pypi test environment:
130+
```console
131+
twine upload --repository pypitest dist/*
132+
```
133+
134+
Finally, if the pypi test upload appears to work fine, run:
135+
```console
136+
twine upload dist/*
137+
```
138+
139+
# License
140+
141+
_Microlog_ is released under version 1 of the [Server Side Public License (SSPL)](LICENSE).

examples/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13
from examples import custom
24
from examples import table
35
from examples import tictactoe

examples/custom.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13
import ltk
24

35
# Create a new widget, based on VBox

examples/table.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13
import ltk
24

35
# Create an HTML table to display country temperature data

examples/tictactoe.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13
import ltk
24

35
# Tic Tac Toe Game
@@ -55,4 +57,6 @@ def create():
5557
for row in range(3)
5658
),
5759
ltk.H4("Tip: Click inside the squares."),
58-
).attr("name", "Tic Tac Toe")
60+
).attr("name", "Tic Tac Toe")
61+
62+
ltk.inject(__file__, "tictactoe.css")

index.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1+
<!-- LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE -->
2+
13
<!DOCTYPE html>
24
<html lang="en">
35
<head>
46
<title>LTK</title>
57
<meta charset="UTF-8">
68
<meta name="viewport" content="width=device-width,initial-scale=1">
79

8-
<!-- Import PyScript CSS and JS -->
10+
<!-- Import PyScript -->
911
<link rel="stylesheet" href="https://pyscript.net/releases/2023.11.1/core.css" />
1012
<script defer type="module" src="https://pyscript.net/releases/2023.11.1/core.js"></script>
1113

12-
<!-- Import LTK and jQuery -->
13-
<link rel="stylesheet" href="ltk/ltk.css" />
14+
<!-- Import jQuery -->
1415
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
1516
<script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"></script>
1617
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
17-
18-
<!-- Import custom CSS for our examples -->
19-
<link rel="stylesheet" href="examples/tictactoe.css" />
2018
</head>
2119
<body>
2220
<h1>The PyScript LTK Kitchen Sink</h1>
@@ -28,8 +26,11 @@ <h1>The PyScript LTK Kitchen Sink</h1>
2826
"ltk/__init__.py",
2927
"ltk/jquery.py",
3028
"ltk/widgets.py",
29+
"ltk/ltk.js",
30+
"ltk/ltk.css",
3131
"examples/__init__.py",
3232
"examples/tictactoe.py",
33+
"examples/tictactoe.css",
3334
"examples/custom.py",
3435
"examples/table.py",
3536
]

ltk/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13
from ltk.jquery import find
24
from ltk.jquery import create
35
from ltk.jquery import find_list
@@ -14,13 +16,15 @@
1416
from ltk.jquery import set_url_parameter
1517
from ltk.jquery import push_state
1618
from ltk.jquery import to_js
19+
from ltk.jquery import inject
1720

1821

1922
from ltk.jquery import jQuery
2023
from ltk.jquery import console
2124
from ltk.jquery import window
2225
from ltk.jquery import document
2326
from ltk.jquery import body
27+
from ltk.jquery import head
2428
from ltk.jquery import parse_int
2529
from ltk.jquery import parse_float
2630
from ltk.jquery import local_storage
@@ -52,3 +56,5 @@
5256
from ltk.widgets import H2
5357
from ltk.widgets import H3
5458
from ltk.widgets import H4
59+
60+
inject(__file__, "ltk.js", "ltk.css")

ltk/jquery.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
# LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE
2+
13
import js # type: ignore
24
import json
5+
import os
36
import pyodide # type: ignore
47
import traceback
58

9+
610
timers = {}
711

812
jQuery = js.jQuery
913
console = js.console
1014
window = jQuery(js.window)
1115
document = jQuery(js.document)
16+
head = jQuery("head")
1217
body = jQuery("body")
1318
parse_int = js.parseInt
1419
parse_float = js.parseFloat
@@ -81,3 +86,15 @@ def set_url_parameter(key, value):
8186

8287
def push_state(url):
8388
js.history.pushState(None, "", url)
89+
90+
def inject(modulepath, *files):
91+
types = {
92+
".js": "<script>",
93+
".css": "<style>",
94+
}
95+
for file in files:
96+
_, extension = os.path.splitext(file)
97+
tag = types[extension]
98+
path = os.path.join(os.path.dirname(modulepath), file)
99+
create(tag).text(open(path).read()).appendTo(head)
100+
print("injected", tag, path)

ltk/ltk.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/* LTK - Copyrights Reserved 2023 - chrislaffra.com - See LICENSE */
2+
13
.ltk-vbox {
24
display: flex;
35
flex-direction: column;

0 commit comments

Comments
 (0)