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

minify metadata.py to reduce package size #347

Merged
merged 2 commits into from
Oct 11, 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
4 changes: 2 additions & 2 deletions .github/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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

Expand Down
16 changes: 16 additions & 0 deletions minify_metadata.py
Original file line number Diff line number Diff line change
@@ -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.")
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading