Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compat: Hatchling 1.26 #7526

Merged
merged 6 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ jobs:
name: conda
path: dist/*tar.bz2
if-no-files-found: error
- name: Verify size
run: python scripts/verify_build_size.py conda

conda_publish:
name: Publish Conda
Expand Down Expand Up @@ -106,6 +108,10 @@ jobs:
name: pip
path: dist/
if-no-files-found: error
- name: Verify sizes
run: |
python scripts/verify_build_size.py sdist
python scripts/verify_build_size.py whl

pip_install:
name: Install PyPI
Expand Down Expand Up @@ -165,6 +171,8 @@ jobs:
name: npm
if-no-files-found: error
path: ./${{ env.PACKAGE }}/${{ env.TARBALL }}
- name: Verify size
run: python scripts/verify_build_size.py npm

npm_publish:
name: Publish NPM
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gallery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -e {0}
shell: bash -el {0}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ raw-options = { version_scheme = "no-guess-dev" }

[tool.hatch.build.targets.wheel]
include = ["panel"]
exclude = ["panel/node_modules"]

[tool.hatch.build.targets.wheel.force-include]
"panel/dist" = "panel/dist"
Expand All @@ -121,7 +122,7 @@ include = ["panel"]

[tool.hatch.build.targets.sdist]
include = ["panel", "scripts", "examples"]
exclude = ["scripts/jupyterlite"]
exclude = ["scripts/jupyterlite", "panel/node_modules"]

[tool.hatch.build.targets.sdist.force-include]
"panel/dist" = "panel/dist"
Expand Down
32 changes: 32 additions & 0 deletions scripts/verify_build_size.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import sys

from pathlib import Path

EXPECTED_SIZES_MB = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the current size of these artifacts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a print statement to make this somewhat easy to get. If needed, I can output it to the Github summary.

conda file size: 21.65 MB
npm file size: 18.32 MB
sdist file size: 28.31 MB
whl file size: 26.41 MB

"conda": 25,
"npm": 25,
"sdist": 30,
"whl": 30,
}

GLOB_PATH = {
"conda": "dist/*.tar.bz2",
"npm": "panel/*.tgz",
"sdist": "dist/*.tar.gz",
"whl": "dist/*.whl",
}

PATH = Path(__file__).parents[1]


def main(build):
files = list(PATH.rglob(GLOB_PATH[build]))
assert len(files) == 1, f"Expected one {build} file, got {len(files)}"

size = files[0].stat().st_size / 1024**2
assert size < EXPECTED_SIZES_MB[build], f"{build} file is too large: {size:.2f} MB"
print(f"{build} file size: {size:.2f} MB")


if __name__ == "__main__":
main(sys.argv[1])
Loading