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

Reduce PyPi azure-cli Package Bloat #30972

Open
JWCS opened this issue Mar 6, 2025 · 3 comments
Open

Reduce PyPi azure-cli Package Bloat #30972

JWCS opened this issue Mar 6, 2025 · 3 comments
Assignees
Labels
Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request
Milestone

Comments

@JWCS
Copy link

JWCS commented Mar 6, 2025

Is your feature request related to a problem? Please describe.
I'm trying to install azure cli in a non-bloaty way, for use in containerized environments. Most ways of installing it (ubuntu debs, azure linux dockers) balloon the installation near 1GB. This is difficult when azure cli is just supposed to be one of many tools needed to run things in this image, not the whole picture.

I had much more success with a python-alpine image, uv package manager, and uv pip install --system --prerelease=allow 'azure-cli>=2.66' (following the developers install/build instructions).

The real problem is this: even the pure python repo is fairly bloated.
Image
Of all the deps are almost nothing compared to it, and this is without pre-compiling the bytecode, which adds another 300MB (not shown).

I really only need a few parts of the cli ; I don't need the entire azure cli ecosystem (I can't afford it).
But even worse than 300MB of cli commands I don't need, is that, (correct me if I'm wrong, but this is half the basis of this issue), most of it is depreciated or out of date?

Ex, it seems like most-all the size comes from old versions of the api?
Image
Image

Describe the solution you'd like
My chief suggestion would be to cull old api versions; one can always install an older version of az cli.
But if that would be problematic (tho simple), couldn't releasing or packaging slimmer builds be an option? Ex, a slim wherein only the latest api's are included?

Or, going the aws cli route, allowing the various subcommands to be installed as extras, by default installing "all", unless the subset is specified?

Describe alternatives you've considered
Short of hacking at the install itself, there's literally nothing else bloatwise to remove from a mere pypi install, unlike the other methods. Even so, 1/2->1GB +- compiled pyc is a bit much.

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 6, 2025

Thank you for opening this issue, we will look into it.

@microsoft-github-policy-service microsoft-github-policy-service bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Mar 6, 2025
@yonzhan yonzhan added Azure CLI Team The command of the issue is owned by Azure CLI team feature-request labels Mar 7, 2025
@yonzhan yonzhan added this to the Backlog milestone Mar 7, 2025
@bebound
Copy link
Contributor

bebound commented Mar 7, 2025

We've trimmed the unused api version in official package: #26172.
There is a PR to only keep pyc in package, but it's not merged yet: #25801

For pypi package, there isn't much we could do.

You can find some discussion at #7387

@sodul
Copy link

sodul commented Mar 7, 2025

You can use https://github.com/clumio-code/azure-sdk-trim to help cull the useless SDK versions. It does not delete all the versions as newer versions import older versions making the culling more complicated. It still saves about half of the disk space which is useful for containers.

As long as Microsoft refuses to address the core issue of providing every single SDK versions since the beginning of the SDK, this problem will only grow, even with the help of trimming tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure CLI Team The command of the issue is owned by Azure CLI team customer-reported Issues that are reported by GitHub users external to the Azure organization. feature-request
Projects
None yet
Development

No branches or pull requests

4 participants