Skip to content

Commit

Permalink
Fix PyPI package source for v1.1.0 (#1088)
Browse files Browse the repository at this point in the history
Signed-off-by: Author Name <[email protected]>

Signed-off-by: Kevin Su <[email protected]>

Co-authored-by: Kevin Su <[email protected]>
  • Loading branch information
sugatoray and pingsutw authored Jul 21, 2022
1 parent c6e7237 commit 9d50502
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 6 deletions.
52 changes: 52 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
## Include files and folders

# include folders
recursive-include flytekit *
recursive-include flytekit_scripts *
recursive-include plugins *

# include specific files
include README.md
include flytekit/py.typed # marker file for PEP 561
include flytekit/deck/html/template.html

include CHANGELOG.md
include LICENSE

include MANIFEST.in
include pyproject.toml
include setup.py
include setup.cfg


## Exclude files and folders

# exclude folders
recursive-exclude tests *
recursive-exclude docs *
recursive-exclude boilerplate *
recursive-exclude .github *

# exclude dist folder:
# - contains the generated *.tar.gz and .whl files.
recursive-exclude dist *

# exclude requirements files
exclude requirements.*
exclude requirements-*.*
exclude doc-requirements.*
exclude dev-requirements.*

# exclude config files
exclude .gitignore
exclude .readthedocs.yaml
exclude .pre-commit-config.yaml
exclude codecov.yml

# exclude other repository management files
exclude Dockerfile.py*
exclude Makefile
exclude NOTICE
exclude pull_request_template.md
exclude CODEOWNERS
exclude CODE_OF_CONDUCT.md
12 changes: 10 additions & 2 deletions flytekit/deck/deck.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from typing import Optional

from jinja2 import Environment, FileSystemLoader
from jinja2 import Environment, FileSystemLoader, select_autoescape

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

root = os.path.dirname(os.path.abspath(__file__))
templates_dir = os.path.join(root, "html")
env = Environment(loader=FileSystemLoader(templates_dir))
env = Environment(
loader=FileSystemLoader(templates_dir),
# 🔥 include autoescaping for security purposes
# sources:
# - https://jinja.palletsprojects.com/en/3.0.x/api/#autoescaping
# - https://stackoverflow.com/a/38642558/8474894 (see in comments)
# - https://stackoverflow.com/a/68826578/8474894
autoescape=select_autoescape(enabled_extensions=("html",)),
)
template = env.get_template("template.html")
6 changes: 4 additions & 2 deletions flytekit/deck/html/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,20 @@

</head>
<body>
<!---{#% autoescape true %#}--->
<nav id="flyte-frame-nav">
<ul id="flyte-frame-tabs">
{% for key, value in metadata.items() %}
<li onclick="handleLinkClick(this)">{{key}}</li>
<li onclick="handleLinkClick(this)">{{ key | safe }}</li>
{% endfor %}
</ul>
</nav>
<div id="flyte-frame-container">
{% for key, value in metadata.items() %}
<div>{{value}}</div>
<div>{{ value | safe }}</div>
{% endfor %}
</div>
<!---{#% autoescape %#}--->
</body>
<script>
const setTabs = index => {
Expand Down
Empty file added flytekit/py.typed
Empty file.
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
version=__version__,
maintainer="Flyte Contributors",
maintainer_email="[email protected]",
packages=find_packages(exclude=["tests*"]),
packages=find_packages(
include=["flytekit", "flytekit_scripts", "plugins"],
exclude=["boilerplate", "docs", "tests*"],
),
include_package_data=True,
package_data={"": ["template.html"]},
url="https://github.com/flyteorg/flytekit",
description="Flyte SDK for Python",
long_description=open("README.md", encoding="utf-8").read(),
Expand Down

0 comments on commit 9d50502

Please sign in to comment.