Le 19/09/2016 à 18:25, אלעזר a écrit :

> Many proposals to add something to stdlib are rejected here with the
> suggestion to add such library to pypi first. As noted by someone,
> pypi is not as reachable as stdlib, and one should install that
> package first, which many people don't know how. Additionally, there
> is no natural distinction between 3rd party dependencies and
> in-project imports (at least in tiny projects).
> This can be made easier if the first line of the program will declare
> the required library, and executing it will try to download and
> install that library if it is not installed yet. Additionally, the 3rd
> party dependencies will be more explicit, and editors can then allow
> you to search for them as you type.
> Of course it is *not* an alternative for real dependency management,
> but it will ease the burden on small scripts and tiny projects - which
> today simply break with errors that many users does not understand,
> instead of simply asking permission to install the dependency.
> Elazar
I find the idea of tracking the dependencies in the script might be a
good idea.
However, magically downloading without warning the user is in my point
of view for sure a bad idea.
I would far prefer that pip could scan a script to know the dependencies.
(A little bit like a requirements.txt but inside the script)
A special comment or docstring would do the job. for example

    - requests >0.0
    - asyncio

to run the script it would be at the first time a  two step process
for example:

python3 -m pip --script-dependencies [--user] my_script.py
python3 my_script.py

Python-ideas mailing list
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to