From 4f79897d216c077ce483ec3858f8e81fc9a40476 Mon Sep 17 00:00:00 2001 From: AnnMarueW Date: Thu, 10 Oct 2024 18:55:26 -0700 Subject: [PATCH 1/2] minify metadata.py to reduce package size --- .github/releasing.md | 4 ++-- minify_metadata.py | 16 ++++++++++++++++ package.json | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 minify_metadata.py diff --git a/.github/releasing.md b/.github/releasing.md index fa5bd455..870ca88d 100644 --- a/.github/releasing.md +++ b/.github/releasing.md @@ -18,9 +18,9 @@ On the Master branch: $ rm -rf dist ``` -2. Build source distribution +2. Build source distribution. Note this will also minify the metadata.json file which reduces the package size ``` - $ python3 -m build --sdist --wheel +npm run dist ``` 3. Test your tarball by copying it into a new environment and installing it locally, for example: diff --git a/minify_metadata.py b/minify_metadata.py new file mode 100644 index 00000000..1db05c5b --- /dev/null +++ b/minify_metadata.py @@ -0,0 +1,16 @@ +""" +This script makes the metadata.json file smaller in order to reduce the package size +""" + +import json + +file_path = 'dash_mantine_components/metadata.json' + +with open(file_path, 'r') as file: + data = json.load(file) + +# Write the compact version (no spaces or line breaks) back to the file +with open(file_path, 'w') as file: + json.dump(data, file, separators=(',', ':')) + +print("JSON file has been compacted.") diff --git a/package.json b/package.json index 72fac8a1..cfbcae69 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "build:backends": "dash-generate-components ./src/ts/components dash_mantine_components -p package-info.json --r-prefix '' --jl-prefix '' --ignore \\.test\\.", "build": "npm run build:js && npm run build:backends", "watch": "npm run build:js::dev -- --watch", - "dist": "python setup.py sdist bdist_wheel" + "dist": "python minify_metadata.py && python setup.py sdist bdist_wheel" }, "devDependencies": { "@braintree/sanitize-url": "^7.0.0", From 3f1d00741c0da62fee7ec7e7dfd4d3d190c1a4c0 Mon Sep 17 00:00:00 2001 From: AnnMarueW Date: Thu, 10 Oct 2024 19:35:55 -0700 Subject: [PATCH 2/2] updated changelog --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d84a7621..22dc1574 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,9 @@ ### Added - - Added `autoplay` prop to the `Carousel` component #316 by @mmarfat - Added the `ChipGroup` component and updated `Chip` to work with it. #327 by @AnnMarieW and @BSd3v -Note: `Chip` was available before but not documented. If you used `Chip` in dmc>=0.14.0 to dmc<=0.14.5, you’ll now need to add `controlled=True` for it to work properly on its own. +Note: `Chip` was available before but not documented. If you used `Chip` in dmc<=0.14.5, you’ll now need to add `controlled=True` for it to work properly on its own. - Added GitHub actions workflow for automated tests on PRs by @BSd3v @@ -16,6 +15,9 @@ Note: `Chip` was available before but not documented. If you used `Chip` in dmc> - Excluded the `loading_state` prop from being passed to the DOM. Added `data-dash-is-loading` attribute to components during callback execution, allowing custom CSS styling for loading states. #325 by @AnnMarieW +### Changed + +- Reduced the package size by minifying the metadata.json file #345 by @AnnMarieW # 0.14.5