Skip to content

Commit 465f3f4

Browse files
sugatoraypingsutw
authored andcommitted
Fix PyPI package source for v1.1.0 (#1088)
Signed-off-by: Author Name <ray.sugato@gmail.com> Signed-off-by: Kevin Su <pingsutw@apache.org> Co-authored-by: Kevin Su <pingsutw@apache.org>
1 parent 3be4e6b commit 465f3f4

5 files changed

Lines changed: 70 additions & 6 deletions

File tree

MANIFEST.in

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
## Include files and folders
2+
3+
# include folders
4+
recursive-include flytekit *
5+
recursive-include flytekit_scripts *
6+
recursive-include plugins *
7+
8+
# include specific files
9+
include README.md
10+
include flytekit/py.typed # marker file for PEP 561
11+
include flytekit/deck/html/template.html
12+
13+
include CHANGELOG.md
14+
include LICENSE
15+
16+
include MANIFEST.in
17+
include pyproject.toml
18+
include setup.py
19+
include setup.cfg
20+
21+
22+
## Exclude files and folders
23+
24+
# exclude folders
25+
recursive-exclude tests *
26+
recursive-exclude docs *
27+
recursive-exclude boilerplate *
28+
recursive-exclude .github *
29+
30+
# exclude dist folder:
31+
# - contains the generated *.tar.gz and .whl files.
32+
recursive-exclude dist *
33+
34+
# exclude requirements files
35+
exclude requirements.*
36+
exclude requirements-*.*
37+
exclude doc-requirements.*
38+
exclude dev-requirements.*
39+
40+
# exclude config files
41+
exclude .gitignore
42+
exclude .readthedocs.yaml
43+
exclude .pre-commit-config.yaml
44+
exclude codecov.yml
45+
46+
# exclude other repository management files
47+
exclude Dockerfile.py*
48+
exclude Makefile
49+
exclude NOTICE
50+
exclude pull_request_template.md
51+
exclude CODEOWNERS
52+
exclude CODE_OF_CONDUCT.md

flytekit/deck/deck.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from typing import Optional
33

4-
from jinja2 import Environment, FileSystemLoader
4+
from jinja2 import Environment, FileSystemLoader, select_autoescape
55

66
from flytekit.core.context_manager import ExecutionParameters, ExecutionState, FlyteContext, FlyteContextManager
77
from flytekit.loggers import logger
@@ -111,5 +111,13 @@ def _output_deck(task_name: str, new_user_params: ExecutionParameters):
111111

112112
root = os.path.dirname(os.path.abspath(__file__))
113113
templates_dir = os.path.join(root, "html")
114-
env = Environment(loader=FileSystemLoader(templates_dir))
114+
env = Environment(
115+
loader=FileSystemLoader(templates_dir),
116+
# 🔥 include autoescaping for security purposes
117+
# sources:
118+
# - https://jinja.palletsprojects.com/en/3.0.x/api/#autoescaping
119+
# - https://stackoverflow.com/a/38642558/8474894 (see in comments)
120+
# - https://stackoverflow.com/a/68826578/8474894
121+
autoescape=select_autoescape(enabled_extensions=("html",)),
122+
)
115123
template = env.get_template("template.html")

flytekit/deck/html/template.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,20 @@
6868

6969
</head>
7070
<body>
71+
<!---{#% autoescape true %#}--->
7172
<nav id="flyte-frame-nav">
7273
<ul id="flyte-frame-tabs">
7374
{% for key, value in metadata.items() %}
74-
<li onclick="handleLinkClick(this)">{{key}}</li>
75+
<li onclick="handleLinkClick(this)">{{ key | safe }}</li>
7576
{% endfor %}
7677
</ul>
7778
</nav>
7879
<div id="flyte-frame-container">
7980
{% for key, value in metadata.items() %}
80-
<div>{{value}}</div>
81+
<div>{{ value | safe }}</div>
8182
{% endfor %}
8283
</div>
84+
<!---{#% autoescape %#}--->
8385
</body>
8486
<script>
8587
const setTabs = index => {

flytekit/py.typed

Whitespace-only changes.

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
version=__version__,
2121
maintainer="Flyte Contributors",
2222
maintainer_email="admin@flyte.org",
23-
packages=find_packages(exclude=["tests*"]),
23+
packages=find_packages(
24+
include=["flytekit", "flytekit_scripts", "plugins"],
25+
exclude=["boilerplate", "docs", "tests*"],
26+
),
2427
include_package_data=True,
25-
package_data={"": ["template.html"]},
2628
url="https://github.com/flyteorg/flytekit",
2729
description="Flyte SDK for Python",
2830
long_description=open("README.md", encoding="utf-8").read(),

0 commit comments

Comments
 (0)