-
Notifications
You must be signed in to change notification settings - Fork 214
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
install only aiida package (+ subpackages) #4205
Comments
While we're at it, I think this line in the MANIFEST file is outdated.. at least, I can't find these files in the source tree. |
Yes, please update this as well! Ah, by the way, the |
This also highlights the fact that a regular pip install from the tarball is currently not tested (or your PR should have failed the tests). This is the same issue with aiida-diff - would be very nice to fix this (if not testing everything from the tarball-installed AiiDA, then at least installing it and importing it once?). Edit: Perhaps I'm wrong - since the utils/ are still installed via the manifest, they will be in the tarball. Perhaps this is enough? |
What's the correct update here? Have they moved somewhere else, or can this line be removed?
I think so, yes.
That may still be missing, though. In the python setup.py sdist
ls -1 dist/ | xargs -I % pip install dist/%[testing] That's still on Travis CI, so may have to be adapted for GHA. |
Yes, these are AiiDA export files used for testing. |
Well, if we do not want to distribute the tests with the package, then we can just remove this. Part of these have been moved to |
I think adding such a test would be very useful as well. |
Ok, two more points:
Since I'm not super familiar with the GHA infrastructure, does one of you want to add that? |
Yes,
I certainly agree; and I don't think including e.g. a PDF in the PyPI package would be very useful either (+ it could be quite large).
Sure, we can do it separately. |
What do we need the |
in order to be able to import it, no? See Line 16 in 9a32cec
|
That works without |
Anyhow, shipping this in Although the top level of the package is already relatively crowded, it would be better to put it there - or we can specify it as a build-level dependency in the pyproject.toml https://github.com/ninjaaron/fast-entry_points#usage |
I doubt it would break, because our
..but nevertheless, this is probably the better option. |
The disadvantage of "un-vendoring" the @sphuber @ltalirz I'll let you decide this one, for me both approaches are fine. |
I prefer the try/except to vendoring (which also then creates this |
Not unless we include it in the |
I have been reading up a bit, especially on this issue of setuptools. Writing this here to collect my thoughts and record if it for future reference. If I understand correctly, the original problem was that the wrapper script that #!/home/sph/.virtualenvs/aiida_testing/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'aiida-testing','console_scripts','aiida-testing'
__requires__ = 'aiida-testing'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('aiida-testing', 'console_scripts', 'aiida-testing')()
) which uses the slow #!/home/sph/.virtualenvs/aiida_testing/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from aiida_testing.cli import cmd_root
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(cmd_root()) The former takes roughly 280 ms on average on my machine, versus 130 ms for the latter. Except! if you don't have
With this, wheel will be properly installed and #!/home/sph/.virtualenvs/aiida_testing/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'aiida-testing','console_scripts','aiida-testing'
import re
import sys
# for compatibility with easy_install; see #2198
__requires__ = 'aiida-testing'
try:
from importlib.metadata import distribution
except ImportError:
try:
from importlib_metadata import distribution
except ImportError:
from pkg_resources import load_entry_point
def importlib_load_entry_point(spec, group, name):
dist_name, _, _ = spec.partition('==')
matches = (
entry_point
for entry_point in distribution(dist_name).entry_points
if entry_point.group == group and entry_point.name == name
)
return next(matches).load()
globals().setdefault('load_entry_point', importlib_load_entry_point)
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(load_entry_point('aiida-testing', 'console_scripts', 'aiida-testing')()) which goes towards the old loading times of around 280 ms, because So long story short, we could get rid of @greschd what is the purpose of |
Nice writeup - I think I agree on the conclusion. For completeness' sake, do you happen to know which version of The |
Unfortunately not, found out about this fix buried in the comments of the
I have to admit that when it comes to this part of doing the releases I am merely studiously copy-pasting those commands. I have never really delved into the specifics of package building and distribution. That's also the reason for the write up, because I have no experience with this whatsoever. But, does that mean then, that if we were to remove |
In my limited understanding, wheels are pre-built packages with all the metadata etc. baked in (in a standardized format). That means From the fastentrypoints README:
So we need [1] This is also the source of our |
So we need it for non-wheel installs, but do we need it for wheel building? I am a bit confused, the quote you included seems to suggest that when dealing with wheels (building and installing?) we don't need all this hackery. But then you mentioned in the beginning of this thread that "un-vendoring" |
We don't need it for wheel building, but the way try:
import fastentrypoints
except ImportError:
pass should do the trick. |
I've added a commit to #4204 doing exactly this now. As mentioned before, both the "vendored" and "un-vendored" version are fine IMO, so you can let me know which one you'd prefer. |
As long as both work for all routes of installing/building where it is necessary and for both we get the fast entry points (don't care about overhead once when installing) then I largely favor not vendoring it. Since these conditions seem to have been met, I think we can move ahead with your PR. I am just looking into the final question of the logo. Would be good if we remove it from the MANIFEST and use a permalink. I will see if I can get one for you and comment to the PR. |
The current generic line
aiida-core/setup.py
Line 48 in 9a32cec
will install all top-level python packages in the user's python environment.
As mentioned by @greschd here, this should be replaced by
find_packages(include=['aiida', 'aiida.*'])
.Note: This concerns both the install from the git repo and from source on PyPI (the tarball currently includes all tests as well, see https://pypi.org/project/aiida-core/#files)
The text was updated successfully, but these errors were encountered: