| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
(#11780)
The PEP 668 expects an override mechanism to ease the transition.
This provides an override.
---------
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
|
|
|
|
|
|
| |
Windows does not implement LC_MESSAGES, and since PEP 668 is mainly
designed for Linux distributions, we simply take the easier way out
until someone wants an equivalent on Windows.
|
| |
|
|
|
|
| |
This makes the parser easier to test.
|
|
|
|
|
| |
This moves most of the displaying logic into the exception class so it
can better leverage DiagnosticPipError and Rich functionalities.
|
|
|
|
|
| |
downloading (#11111)
Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
|
|
|
|
|
|
|
|
|
| |
This makes type checking PEP 484 compliant (as of 2018).
mypy will change its defaults soon.
See:
https://github.com/python/mypy/issues/9091
https://github.com/python/mypy/pull/13401
|
|
|
| |
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
|
| |
|
|
|
|
|
|
| |
This is a less disruptive mode of operation, and helps ensure that users
who are using documents that don't declare the doctype are presented
with a warning; instead of getting a hard-failure.
|
| |
|
|
|
|
|
|
| |
This more clearly states where the error came from, presents it in a
more approachable format with context provided for what this error is
related to.
|
|
|
|
|
| |
These errors now more clearly note where the error occurred and what
component is at fault.
|
|
|
|
|
| |
This file should be importable in all other modules, which means it
can't be importing any of those modules (to prevent an import loop).
|
| |
|
|
|
|
| |
This is a slightly cleaner presentation style.
|
|
|
|
|
|
| |
This is only necessary on messages which may contain `[`, which needs to
be escaped before printing with rich, since rich treats them as output
formats.
|
|
|
|
| |
The new name is a closer match with what is presented to the user.
|
|
|
|
|
|
|
|
|
|
| |
This makes it possible to present output with rich markup, within the
constraints of our logging infrastructure.
Further, diagnostic errors can now by presented using rich, using their
own special "[present-diagnostic]" marker string, since those need to be
handled differently from regular log messages and passed directly
through to rich's console object, after an indentation wrapper.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Borrow error presentation logic from sphinx-theme-builder, and
exhaustively test both the unicode and non-unicode presentation.
Utilise rich for colours and presentation logic handling, with tests to
ensure that colour degradation happens cleanly, and that the content is
stylized exactly as expected.
Catch diagnostic errors eagerly, and present them using rich. While this
won't include the pretty presentation in user logs, those files will
contain the entire traceback upto that line.
|
| |
|
|
|
|
| |
Relevant functionalities are moved into pip._internal.metadata.
|
|\ |
|
| | |
|
| |
| |
| |
| |
| | |
This demonstrates how the new diagnostic errors are to implement, and
how they get presented to users.
|
| |
| |
| | |
Co-authored-by: Ed Morley <501702+edmorley@users.noreply.github.com>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces an exception and presentation model, for providing
better errors messages. The motivating idea is that the better error
messages contain clear wording and provide additional context to users
to better understand what is happening.
The `DiagnosticPipError` class introduces a structured framework in our
exception model, for code authors to write their error messages. The
usage explicitly requires passing "context" and a "hint" (which accept
None values). This should nudge code authors to explicitly think about
what additional information can/should be presented to the user, and
to provide relevant hints to them whenever possible. It also makes it
straightforward to identify cases where we don't do this, which may
serve as clear areas for improvement in the future.
The initial implementation is intentionally basic and doesn't do much;
however we should be able to introduce better usage of terminal colors
and other features (eg: hyperlinks!) to further improve the presentation
of these errors. It does improve the presentation style by a bit, even
though there are significant presentation-related improvements to be
made.
Additionally, having a structured framework means that these would be
improvements in presentation of *all* the errors that are within this
framework -- increasing the benefits of investing in the presentation
of these errors.
|
| |
|
| |
|
|
|
|
| |
Signed-off-by: harupy <hkawamura0130@gmail.com>
|
|\ |
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The typing module has been available since Python 3.5. Guarding the
import has been unnecessary since dropping Python 2.
Some guards remain to either:
- Avoid circular imports
- Importing objects that are also guarded by typing.TYPE_CHECKING
- Avoid mypy_extensions dependency
|
|
|
|
|
|
|
|
| |
The stdlib module has been available since Python 3.5 and the
TYPE_CHECKING constant has been available since 3.5.2.
By using stdlib, this removes the need for pip to maintain its own
Python 2 typing compatibility shim.
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| | |
Skip candidate not providing valid metadata
This reverts commit 7165ab8cb9a0d6297b5a0dcd7d9a84350d0a0b3b.
|
| |
| |
| |
| |
| |
| |
| | |
Use pyupgrade to convert simple string formatting to use f-string
syntax. pyupgrade is intentionally timid and will not create an f-string
if it would make the expression longer or if the substitution parameters
are anything but simple names or dotted names.
|
| |\
| | |
| | | |
Use short Python3 super() syntax
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| | |
Using typing.Text is unnecessary since dropping Python 2 support.
In Python 3, typing.Text is a simple alias of str. It exists as a
backward compatibility shim for Python 2.
|
| |
| |
| |
| | |
Unnecessary since dropping Python 2.
|
| | |
|
|/
|
|
| |
This reverts commit 8adbc216a647b6b349f1b7f1eaa9e71cd3108955.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is done by catching InstallationError from the underlying
distribution preparation logic. There are three cases to catch:
1. Candidates from indexes. These are simply ignored since we can
potentially satisfy the requirement with other candidates.
2. Candidates from URLs with a dist name (PEP 508 or #egg=). A new
UnsatisfiableRequirement class is introduced to represent this; it is
like an ExplicitRequirement without an underlying candidate. As the
name suggests, an instance of this can never be satisfied, and will
cause eventual backtracking.
3. Candidates from URLs without a dist name. This is only possible for
top-level user requirements, and no recourse is possible for them. So
we error out eagerly.
The InstallationError raised during distribution preparation is cached
in the factory, like successfully prepared candidates, since we don't
want to repeatedly try to build a candidate if we already know it'd
fail. Plus pip's preparation logic also does not allow packages to be
built multiple times anyway.
|
|
|
|
|
|
|
| |
HashError.order is now annotated as an int to allow
HashErrors.errors.sort(key=lambda e: e.order). Alternatively we can
define a function which assert e is not None but I prefer the more
concise version, since we never raise HashError directly anyway.
|