issue_comments: 672372465
This data as json
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/issues/928#issuecomment-672372465 | https://api.github.com/repos/simonw/datasette/issues/928 | 672372465 | MDEyOklzc3VlQ29tbWVudDY3MjM3MjQ2NQ== | 9599 | 2020-08-11T23:54:28Z | 2020-08-11T23:54:28Z | OWNER | While debugging this I found a useful clue in https://github.com/pypa/pip/blob/e060970d51c5946beac8447eb95585d83019582d/src/pip/_internal/cli/main.py#L23-L47 ``` Do not import and use main() directly! Using it directly is activelydiscouraged by pip's maintainers. The name, location and behavior ofthis function is subject to change, so calling it directly is notportable across different pip versions.In addition, running pip in-process is unsupported and unsafe. This iselaborated in detail athttps://pip.pypa.io/en/stable/user_guide/#using-pip-from-your-program.That document also provides suggestions that should work for nearlyall users that are considering importing and using main() directly.However, we know that certain users will still want to invoke pipin-process. If you understand and accept the implications of using pipin an unsupported manner, the best approach is to use runpy to avoiddepending on the exact location of this entry point.The following example shows how to use runpy to invoke pip in thatcase:sys.argv = ["pip", your, args, here]runpy.run_module("pip", run_name="main")Note that this will exit the process after running, unlike a directcall to main. As it is not safe to do any processing after callingmain, this should not be an issue in practice.``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
677272618 |