Skip to content

Commit 3c7c68a

Browse files
committed
Merge branch 'deprecate-authors-field'
2 parents 6bfedd1 + b023be3 commit 3c7c68a

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed

text/0000-optional-authors-field.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# RFC: Make the authors field optional
2+
3+
- Feature Name: `optional_authors_field`
4+
- Start Date: 2021-01-07
5+
- RFC PR: [rust-lang/rfcs#0000](https://github.com/rust-lang/rfcs/pull/0000)
6+
- Rust Issue: [rust-lang/rust#0000](https://github.com/rust-lang/rust/issues/0000)
7+
8+
# Summary
9+
[summary]: #summary
10+
11+
This RFC proposes to make the `package.authors` field of `Cargo.toml` optional.
12+
This RFC also proposes preventing Cargo from auto-filling it, allowing crates
13+
to be published to crates.io without the field being present, and avoiding
14+
displaying its contents on the crates.io and docs.rs UI.
15+
16+
# Motivation
17+
[motivation]: #motivation
18+
19+
The crates.io registry does not allow users to change the contents of already
20+
published versions: this is highly desirable to ensure working builds don't
21+
break in the future, but it also has the unfortunate side-effect of preventing
22+
people from updating the list of crate authors defined in `Cargo.toml`'s
23+
`package.authors` field.
24+
25+
This is especially problematic when people change their name or want to remove
26+
their name from the Internet, and the crates.io team doesn't have any way to
27+
address that at the moment except for deleting the affected crates or versions
28+
altogether. We don't do that lightly, but there were a few cases where we were
29+
forced to do so.
30+
31+
The contents of the field also tend to scale poorly as the size of a project
32+
grows, with projects either making the field useless by just stating "The
33+
$PROJECT developers" or only naming the original authors without mentioning
34+
other major contributors.
35+
36+
# Guide-level explanation
37+
[guide-level-explanation]: #guide-level-explanation
38+
39+
crates.io will allow publishing crates without the `package.authors` field, and
40+
it will stop showing the contents of the field in its UI (the current owners
41+
will still be shown). docs.rs will also replace that data with the crate
42+
owners.
43+
44+
`cargo init` will stop pre-populating the field when running the command, and
45+
it will not include the field at all in the default `Cargo.toml`. Crate authors
46+
will still be able to manually include the field before publishing if they so
47+
choose.
48+
49+
Crates that currently rely on the field being present (for example by reading
50+
the `CARGO_PKG_AUTHORS` environment variable) will have to handle the field
51+
being missing (for example by switching from the `env!` macro to
52+
`option_env!`).
53+
54+
# Reference-level explanation
55+
[reference-level-explanation]: #reference-level-explanation
56+
57+
The implementation of this RFC spans multiple parts of the Rust project:
58+
59+
## Cargo
60+
61+
Cargo will stop fetching the current user's name and email address when running
62+
`cargo init`, and it will not include the field in the default template for
63+
`Cargo.toml`.
64+
65+
## crates.io
66+
67+
crates.io will allow publishing versions without the field and with the field
68+
empty. The Web UI will remove the authors section, while retaining the current
69+
owners section.
70+
71+
The API will continue returning the `authors` field in every endpoint which
72+
currently includes it, but the field will always be empty (even if the crate
73+
author manually adds data to it). The database dumps will also stop including
74+
the field.
75+
76+
## docs.rs
77+
78+
docs.rs will replace the authors with the current owners in its UI.
79+
80+
# Drawbacks
81+
[drawbacks]: #drawbacks
82+
83+
Cargo currently provides author information to the crate via
84+
`CARGO_PKG_AUTHORS`, and some crates (such as `clap`) use this information.
85+
Making the authors field optional will require crates to account for a missing
86+
field if they want to work out of the box in projects without the field.
87+
88+
This RFC will make it harder for third-party tools to query the author
89+
information of crates published to crates.io.
90+
91+
By design, this RFC discourages adding the metadata allowing to know historical
92+
crate authors and makes it harder to retrieve it. In some cases, crate authors
93+
may have wanted that information preserved. After this RFC, crate authors who
94+
want to display historical authors who are not current crate owners will have
95+
to present that information in some other way.
96+
97+
# Rationale and alternatives
98+
[rationale-and-alternatives]: #rationale-and-alternatives
99+
100+
This RFC reduces the problems related to changing the names in the authors
101+
field significantly, as people will now have to explicitly want to add that
102+
data instead of it being there by default.
103+
104+
We could do nothing, but that would increase the support load of the crates.io
105+
team and would result in more crates being removed from the registry due to
106+
this issue.
107+
108+
# Prior art
109+
[prior-art]: #prior-art
110+
111+
* **JavaScript:** `package.json` has an optional `authors` field, but it's not
112+
required and the interactive `npm init` command does not prepopulate the
113+
field, leaving it empty by default. The npm Web UI does not show the contents
114+
of the field.
115+
* **Python:** `setup.py` does not require the `authors` field. The PyPI Web UI
116+
shows its contents when present.
117+
* **Ruby:** `*.gemspec` requires the `authors` field, and the RubyGems Web UI
118+
shows its contents.
119+
* **PHP:** `composer.json` has an optional `authors` field. While it's not
120+
required, the interactive `composer init` command allows you to choose
121+
whether to pre-populate it based on the current environment or skip it. The
122+
Packagist Web UI does not show the contents of the field.
123+
124+
# Unresolved questions
125+
[unresolved-questions]: #unresolved-questions
126+
127+
* What should we do about the metadata in already published crates?
128+
129+
# Future possibilities
130+
[future-possibilities]: #future-possibilities
131+
132+
The `package.authors` field could be deprecated and removed in a future
133+
edition.
134+
135+
A future RFC could propose separating metadata fields that could benefit from
136+
being mutable out of `Cargo.toml` and the crate tarball, allowing them to be
137+
changed without having to publish a new version. Such RFC should also propose a
138+
standardized way to update and distribute the extracted metadata.

0 commit comments

Comments
 (0)