Skip to content

Commit b94f294

Browse files
Move error message UX guidance into pip docs (pypa#12642)
Co-authored-by: Richard Si <[email protected]>
1 parent 892f142 commit b94f294

File tree

2 files changed

+110
-0
lines changed

2 files changed

+110
-0
lines changed

docs/html/ux-research-design/guidance.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,24 @@ Designing for pip includes:
344344
- Writing pip's _output_ - establishing how pip responds to commands and what information it provides the user. This includes writing success and error messages.
345345
- Providing supplemental materials - e.g. documentation that helps users understand pip's operation
346346

347+
### Error Message Format
348+
349+
A good error message should mention:
350+
351+
* what the user has tried to do
352+
* possible next steps to try and solve the error
353+
* possible steps need to go from "easiest" to "most complicated"
354+
* why the error has happened - include a way to see more information
355+
about the situation
356+
357+
A [sample `ResolutionImpossible` error that follows this guidance
358+
is available](resolution-impossible-example).
359+
360+
**Further reading**
361+
362+
- <https://uxplanet.org/how-to-write-good-error-messages-858e4551cd4>
363+
- <https://www.nngroup.com/articles/error-message-guidelines/>
364+
347365
### Design Principles / Usability Heuristics
348366

349367
There are many interaction design principles that help designers design great experiences. Nielsen Norman's [10 Usability Heuristics for User Interface Design](https://www.nngroup.com/articles/ten-usability-heuristics) is a great place to start. Here are some of the ways these principles apply to pip:
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
orphan:
3+
---
4+
5+
# Example error: ResolutionImpossible
6+
7+
## What if there are user-provided pinned packages?
8+
9+
Where a user wants to install packages (with 1 or more pinned version)
10+
with default verbose level
11+
12+
```
13+
$ pip install peach=1.0 apple=2.0
14+
15+
Due to conflicting dependencies pip cannot install Peach1.0 and Apple2.0:
16+
17+
* Peach 1.0 depends on Banana 3.0
18+
* Apple2.0 depends on Banana2.0
19+
20+
There are a number of possible solutions. You can try:
21+
1. removing package versions from your requirements, and letting pip try to resolve the problem for you
22+
2. Trying a version of Peach that depends on Banana2.0. Try `pip-search peach —dep banana2.0`
23+
3. replacing Apple or Peach with a different package altogether
24+
4. patching Apple2.0 to use Banana3.0
25+
5. force installing (Be aware!)
26+
27+
For instructions on how to do these steps visit: https://pypa.io/SomeLink
28+
To debug this further you can run `pip-tree` to see all of your dependencies.
29+
```
30+
31+
**with verbose level -vv**
32+
33+
If a user ran the same pip command with more verbosity, what would they see?
34+
35+
**with verbose level -vvv**
36+
37+
If a user ran the same pip command with more verbosity, what would they see?
38+
39+
## What if there are no user-provided version restrictions?
40+
41+
NB: We are assuming this resolver behaviour gets implemented, based on [GH issues 8249](https://github.com/pypa/pip/issues/8249).
42+
43+
**with default verbose level**
44+
45+
```
46+
$ pip install apple peach
47+
48+
Due to conflicting dependencies pip cannot install apple or peach. Both depend on banana, but pip can't find a version of either where they depend on the same banana version.
49+
50+
There are a number of possible solutions. You can try:
51+
1. replacing apple or peach with a different package altogether
52+
2. patching apple or peach to use the same version of banana
53+
3. force installing (Be aware!)
54+
55+
To debug this further you can run pip-tree to see all of your dependencies.
56+
```
57+
58+
**with verbose level -vv**
59+
60+
If a user ran the same pip command with more verbosity, what would they see?
61+
62+
**with verbose level -vvv**
63+
64+
If a user ran the same pip command with more verbosity, what would they see?
65+
66+
**What should be in the "documentation" page?**
67+
68+
* ways to swap a package for another
69+
* how to patch a package to support a version (various ways)
70+
71+
## Recommendations
72+
73+
* Write official documentation / guide "How to resolve dependency conflicts" explaining:
74+
* Why conflicts can exist
75+
* How you can avoid them (pinning)
76+
* How you can resolve them
77+
* Use alternative package
78+
* Use older version
79+
* Patch package
80+
* Introduce new commands to pip, inspired by poetry:
81+
* Tree: Show full tree of dependencies
82+
* Show `<package>` Show details of a package, including it's dependencies
83+
* latest - shows latest vs installed versions
84+
* outdated - shows only outdated versions
85+
* Expose commands / help link in output??
86+
* when particular issue happens provide ways to move on (ala pipenv), e.g.
87+
* run this command to see X
88+
* is it your internet connection?
89+
* is it the pypi website?
90+
* Aspirational commands
91+
* `pip search PackageName —dep PackageNameVersion`
92+
* a command that will search for a version of a package that has a dependency on another packageversion

0 commit comments

Comments
 (0)