Skip to content

Commit

Permalink
Add experimental POETRY_REQUESTS_TIMEOUT option
Browse files Browse the repository at this point in the history
Co-authored-by: Bjorn Neergaard <[email protected]>
  • Loading branch information
Secrus and neersighted committed Nov 23, 2022
1 parent dcd48c8 commit 4715359
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,16 @@ This is done so to be compliant with the broader Python ecosystem.

For example, if Poetry builds a distribution for a project that uses a version that is not valid according to
[PEP 440](https://peps.python.org/pep-0440), third party tools will be unable to parse the version correctly.


### My requests are timing out!

Poetry's default HTTP request time out is 15 seconds, the same as `pip`.
Similar to `PIP_REQUESTS_TIMEOUT`, the experimental environment variable `POETRY_REQUESTS_TIMEOUT`
can be set to alter this value. As this environment variable is **unstable**, it may be removed in the future, but
not before being replaced with a permanent alternative.

Note that it is almost always better to debug network stability than to blindly increase
the request timeout -- the timeout controls how long it Poetry waits to establish a HTTP
request/connection, and not how long Poetry will wait for a response to finish
(Poetry will keep on waiting as long as the response is unfinished).
4 changes: 3 additions & 1 deletion src/poetry/utils/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import os


# Timeout for HTTP requests using the requests library.
REQUESTS_TIMEOUT = 15
REQUESTS_TIMEOUT = int(os.getenv("POETRY_REQUESTS_TIMEOUT", 15))

0 comments on commit 4715359

Please sign in to comment.