[v7r2] Fully support setuptools#4865
Conversation
f4b010e to
27ca8d8
Compare
chrisburr
left a comment
There was a problem hiding this comment.
This is ready for feedback before I convert all the scripts. I've added some comments in a review to try and explain what is going on.
| package_dir= | ||
| =src | ||
| packages = find: | ||
| install_requires = |
There was a problem hiding this comment.
It would be useful if someone can take a look at the dependencies and see if I've missed anything or got the client/server/testing split wrong.
Version constraints should also be added before the first non-pre release but that can wait for a little while.
There was a problem hiding this comment.
Just as a precision after discussion: only minimal version constraint is envisaged (e.g. M2Crypto>=0.36)
There was a problem hiding this comment.
The stability will come from the fact that a given DIRACOS(2) version maps to a single set of packages. Adding restrictive versions here will just add a maintaince burdon and make it harder for people to actually install DIRAC alongside other things.
There was a problem hiding this comment.
We have several of these lists now (environment.yml, environment-py3.yml, requirements.txt), would it be possible to reduce the number?
There was a problem hiding this comment.
environment-py3.yml, requirements.txt, docs/requirements.txt and docs/requirements_py3.txt will disappear relatively soon. We will then be left with only three places:
setup.cfg: Runtime dependencies of DIRAC that are Python packages themselves, validated whenever DIRAC is installedenvironment.yml: Any packages that need to be available to run the tests (excluding integration for now, though that's not actually a problem now as everything is available from conda-forge), i.e. not limited to just Python packages so this can included singularity/python itself/openssl/...constructor.ymlin DIRACOS2: Packages which will be included in the DIRACOS2 tarballmeta.yaml: Allows a conda package to be built for DIRAC, not a big deal as it can be automatically generated from the PyPI metadata, that is itself generated from thesetup.cfgfile.
While there will be some duplication between the above they each serve distinct roles any any effort to de-duplicate them further will be more work than it's worth.
There was a problem hiding this comment.
constructor.yml will be a subset of environment.yml, right? And setup.cfg will also be a (different) subset of environment.yml.
There was a problem hiding this comment.
Yes though package names in setup.cfg will be the names on PyPI which might differ slightly from the name of the conda-package. For example graphviz is the Python bindings on PyPI but the CLI application on conda-forge (python-graphviz is the conda-forge name for the Python bindings).
| from DIRAC import gLogger | ||
|
|
||
|
|
||
| class DIRACScript(object): |
There was a problem hiding this comment.
This is the class that does the magic for replacing console_scripts functions with the highest priority extension. It does nothing when installed with Python 2 (under the assumption that it's a legacy install using PYTHONPATH).
| All console-scripts entrypoints in DIRAC and downstream extensions should be | ||
| wrapped in this decorator to allow extensions to override any entry_point. | ||
| """ | ||
| def __init__(self): |
There was a problem hiding this comment.
This constructor could be useful for allowing something like below. It's not strictly needed though so it can be deferred to another release if we want (or never). I'll wait for opinions before implementing it.
@DiracScript(
switches=[
("f:", "file=", "File to use as user key"),
("i", "version", "Print version"),
("n", "novoms", "Disable VOMS"),
("v", "checkvalid", "Return error if the proxy is invalid"),
("x", "nocs", "Disable CS"),
("e", "steps", "Show steps info"),
("j", "noclockcheck", "Disable checking if time is ok"),
("m", "uploadedinfo", "Show uploaded proxies info"),
],
requriesProxy=False,
)
def proxy_info(*args, **kwargs):There was a problem hiding this comment.
There's hardly any CLI not needed a proxy. But I admit that checking it before hand would give much more meaningfull messages. But that's maybe not the place to do it.
For the switches, maybe we could maybe look at something like click ? Anyway, I would differ it to later
There was a problem hiding this comment.
I would imagine requriesProxy=True would be the default if we did this.
For the switches, maybe we could maybe look at something like click ? Anyway, I would differ it to later
I think the current parsing is too inconsistent to repliment using click so while it would be nice we need to be prepared to a single big backwards-incompatible break or, more likely, a transisition to a new CLI.
Anyway, I would differ it to later
In hindsight I agree that it's best left out of this PR to ensure the diff is reviewable.
| @@ -1,72 +0,0 @@ | |||
| #!/usr/bin/env python | |||
There was a problem hiding this comment.
I've only modified three scripts for now as an example so people can give feedback without needing to duplicate the work. While the diff looks scary the actual change is:
- Rename
dirac-info.pytodirac_info.pyso it's a valid Python module. This is safe as dirac-install already replaces_with-when generating the wrapper scripts. (I was going to suggest implementing this but it was already there.) - Indent almost all lines so they can exist in a
main()function - Add
if __name__ == "__main__": main()to the end so the script can still be ran directly
| return { | ||
| "priority": 0, | ||
| "setups": { | ||
| "DIRAC-Certification": { |
There was a problem hiding this comment.
This isn't used yet but it will be in my follow up PR to this one. I didn't mean to include it here but I see no harm in leaving it.
chaen
left a comment
There was a problem hiding this comment.
In general, I am extremely pleased by all that (although not very surprised since we did talked about it :D )
However, I would advocate for more explanations, not necessarily yet in the official wiki/ existing rst (this can come once everything is consolidated) but at least in a document that explains the different bits and pieces of the whole mechanism, with links to various documents (PEP or others). This is for the sake of keeping the global picture accessible to everybody
I would also keep somewhere (maybe this time in the official instructions) what needs to be done already (for example the double tagging), such that it is not overlooked
Thanks for the tedious work :-)
| sqlalchemy | ||
| stomp.py | ||
| suds-jurko | ||
| tornado |
There was a problem hiding this comment.
I guess we need to specify the repo here?
There was a problem hiding this comment.
I hope we can require the local version segment and use something like tornado =*+dirac.* but I'm not sure if that actually works properly. I need to do some tests here but in practice pip install DIRAC[server] is not going to work without some help from outside (i.e. DIRACOS2) as some of these packages don't even exist on PyPI and many don't provide wheels/robust enough build systems. Regardless I think including the git repo here is a bad idea.
| All console-scripts entrypoints in DIRAC and downstream extensions should be | ||
| wrapped in this decorator to allow extensions to override any entry_point. | ||
| """ | ||
| def __init__(self): |
There was a problem hiding this comment.
There's hardly any CLI not needed a proxy. But I admit that checking it before hand would give much more meaningfull messages. But that's maybe not the place to do it.
For the switches, maybe we could maybe look at something like click ? Anyway, I would differ it to later
e08ac80 to
7baa497
Compare
| package_dir= | ||
| =src | ||
| packages = find: | ||
| install_requires = |
There was a problem hiding this comment.
We have several of these lists now (environment.yml, environment-py3.yml, requirements.txt), would it be possible to reduce the number?
| parameterized | ||
| pytest | ||
|
|
||
| [options.entry_points] |
There was a problem hiding this comment.
Can you add some comments here?
e.g. "what to do if you have a script with the same name in the extension"
There was a problem hiding this comment.
I've added documentation in 905965f and a comment in the setup.cfg referencing it.
cf15fa3 to
aacc335
Compare
|
I think everything has been dealt with here and it's now ready for all of the scripts to be converted. |
99c232f to
20d9496
Compare
9edd08a to
9292153
Compare
ea189d5 to
3b627c7
Compare
fstagni
left a comment
There was a problem hiding this comment.
I think I can approve, now it's about testing.
|
I am wondering if there are going to be conflicts because of the changes in many scripts in #4853 |
It will be okay with the module docstring changes as those haven't moved. I suspect the code changes will basically need to be re-done from scratch in one of the PRs. |
|
|
||
| __RCSID__ = "$Id$" | ||
|
|
||
| # Must be define BEFORE any dirac import |
There was a problem hiding this comment.
This comment belongs to the os.environ below
|
|
||
| print("NOTE:", __file__, "is deprecated and will be removed in v7r3, for details see", | ||
| "https://github.com/DIRACGrid/DIRAC/wiki/DIRAC-v7r2#rename-of-scripts") | ||
|
|
There was a problem hiding this comment.
Why isn't the main() from dirac_agent.py called here?
There was a problem hiding this comment.
This (i.e. copying the entire thing) was what we talked about during the BiLD but yeah I see no reason not to import instead 👍
[v7r2] Remaining review comments from #4865
Closes #4774
BEGINRELEASENOTES
*Core
NEW: Fully support installation with setuptools
ENDRELEASENOTES