-
Notifications
You must be signed in to change notification settings - Fork 31
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
[Ansible 6] Improve setup.py to exclude some unnecessary files #342
[Ansible 6] Improve setup.py to exclude some unnecessary files #342
Conversation
(Docs on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to see us finally able to ship a wheel! the smaller bdist with full sdist is also a good thing.
'{{ name }}/{{ namespace }}/.github/*', | ||
'{{ name }}/{{ namespace }}/.azure-pipelines/*', | ||
'{{ name }}/{{ namespace }}/changelogs/*', | ||
'{{ name }}/{{ namespace }}/docs/*', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is docs/
really unused by ansible? This is the only one I think might be good to keep shipping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not used by ansible. It still might be useful though; I guess this is something we have to discuss. I do see both arguments for keeping them (having offline docs can be useful) and for removing them (often these contain only redundant docs that ansible-doc can also show, for example community.aws has 180 generated RST files of 6.1 MB which contain the same information that ansible-doc community.aws.<module-name>
will also show).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to agree that if there is anything of value to keep, it's probably the docs -- they are also not as problematic in terms of volume and size as the other bits.
This list is otherwise a good start, although not exhaustive and would miss quite a few hits from https://gist.github.com/dmsimard/4d53b6578f6a18f86013ffa94214af82
The pattern I had used was: find ansible_collections | grep -E "\.gitignore|\.github|\.azure-pipelines|\.swp|\.orig|\.DS_Store|\.keep|\.gitkeep|\.vscode|\.pytest_cache|\.yamllint|\.pre-commit-config\.yaml|\.plugin-cache\.yaml|\.pytest_cache|\.mypy_cache|\.zuul\.yaml|\.flake8|\.circleci|\.gitattributes|\.ansible-lint|\.travis\.yml|\.gitlab-ci\.yml|\.idea|\.settings" | sort
It would feel a bit "dirty" to include these patterns in the setup.py but I figure they must be defined somewhere...
@felixfontein what platforms are you targeting? Who do you expect to build from sdist? Who do you expect to install in editable mode? What are the restrictions for pip and setuptools that you have in mind? The reason I'm asking is because today it's possible to seamlessly move away from the dynamic |
@felixfontein by the way, do you realize that invoking Here's some motivation behind that: https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html. I noticed that the current code for some reason still calls |
(In case someone wonders how long setuptool has supported |
@webknjaz I think those are good questions that we should find an answer for in the not too distant future. Should we create an issue so we don't forget about it ? |
6e52cf6
to
7db6717
Compare
Rebased after #341 has been merged. |
7db6717
to
44d6e18
Compare
44d6e18
to
e11d876
Compare
f511923
to
d0a4ca7
Compare
df55c49
to
e2792e0
Compare
e2792e0
to
5e7869a
Compare
I split out the collision check removal to #394. |
5e7869a
to
58624d0
Compare
58624d0
to
c338560
Compare
c338560
to
b04bcb9
Compare
b04bcb9
to
923d542
Compare
This PR now implements the proposal from ansible-community/community-topics#76. This proposal is safe once ansible-community/community-topics#77 passes. |
@jamescassell @Andersson007 @webknjaz @dmsimard thanks for all your comments! |
This is currently depending on the Ansible major version, so it will only be used for Ansible 6 and its prereleases, but not for any Ansible 5 (or less) release.
This PR has two big changes:
The code in setup.py which checks whether Ansible 2.9 or ansible-base 2.10 is installed is no longer there. This allows us to build a wheel for faster installation!(moved to [Ansible 6] Disable collision checks with Ansible 2.9 / ansible-base 2.10 in setup.py #394; for wheels see [Ansible 6] Build wheels for Ansible 6+ #395)exclude_package_data
is passed tosetup()
to list some files and directories that are excluded from thebdist
s (wheels are such distributions), while they are still present in thesdist
. This should make the lawyers happy, since the source distribution (the tarball on PyPi) still contains everything, while when you install that source distribution, or install a binary distribution built from it, you will not have these extra files.Locally, after removing the
__pycache__
files that the installation process creates,ansible_collections/
shrinks from 373 MB to 205 MB, and the number of files goes down from 31942 to 13682.A side-effect is that setup.py is now larger, with 763 lines. The concrete instance I got looks like this: https://gist.github.com/felixfontein/cf70e8c52fae9dc98a5c9d058f54505f
(Note: this PR includes #341, I will rebase once that's through the review pipeline :) )