Skip to content

Commit 7148058

Browse files
committed
improve stevedore_extensions field documentation
1 parent 61fb014 commit 7148058

1 file changed

Lines changed: 31 additions & 20 deletions

File tree

pants-plugins/stevedore_extensions/target_types.py

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
)
3333
from pants.backend.python.target_types import EntryPoint, PythonResolveField
3434
from pants.source.filespec import Filespec
35+
from pants.util.strutil import softwrap
3536

3637

3738
@dataclass(frozen=True)
@@ -46,11 +47,14 @@ class StevedoreEntryPoints(Collection[StevedoreEntryPoint]):
4647

4748
class StevedoreNamespaceField(StringField):
4849
alias = "namespace"
49-
help = (
50-
"The stevedore extension namespace.\n\nThis looks like a python module "
51-
"'my.stevedore.namespace', but a python module of that name does not "
52-
"need to exist. This is what a stevedore ExtensionManager uses to look up "
53-
"relevant entry_points from pkg_resources."
50+
help = softwrap(
51+
"""
52+
Set the stevedore extension namespace.
53+
54+
This looks like a python module 'my.stevedore.namespace', but a python module
55+
of that name does not need to exist. This is what a stevedore ExtensionManager
56+
uses to look up relevant entry_points from pkg_resources.
57+
"""
5458
)
5559
required = True
5660

@@ -60,15 +64,19 @@ class StevedoreEntryPointsField(
6064
):
6165
# based on pants.backend.python.target_types.PexEntryPointField
6266
alias = "entry_points"
63-
help = (
64-
"A dict that maps a stevedore extension name to the entry_point that implements it.\n\n"
65-
# the odd spacing here minimizes diff with help text copied from PexEntryPointField
66-
"You can specify each entry_point with "
67-
"a full module like 'path.to.module' and 'path.to.module:func', or use a "
68-
"shorthand to specify a file name, using the same syntax as the `sources` field:\n\n 1) "
69-
"'app.py', Pants will convert into the module `path.to.app`;\n 2) 'app.py:func', Pants "
70-
"will convert into `path.to.app:func`.\n\nYou must use the file name shorthand for file "
71-
"arguments to work with this target."
67+
help = softwrap(
68+
"""
69+
Map stevedore extension names to the entry_point that implements each name.
70+
71+
Specify each entry_point to a module stevedore should use for the given extension name.
72+
You can specify a full module like 'path.to.module' and 'path.to.module:func', or use a
73+
shorthand to specify a file name, using the same syntax as the `sources` field:
74+
75+
1) 'app.py', Pants will convert into the module `path.to.app`;
76+
2) 'app.py:func', Pants will convert into `path.to.app:func`.
77+
78+
You must use the file name shorthand for file arguments to work with this target.
79+
"""
7280
)
7381
required = True
7482
value: StevedoreEntryPoints
@@ -127,12 +135,15 @@ class StevedoreExtension(Target):
127135
# This is a lot like a SpecialCasedDependencies field, but it doesn't list targets directly.
128136
class StevedoreNamespacesField(StringSequenceField):
129137
alias = "stevedore_namespaces"
130-
help = (
131-
"A list of stevedore namespaces to include for tests.\n\n"
132-
"All stevedore_extension targets with these namespaces will be added as "
133-
"dependencies so that they are available on PYTHONPATH during tests. "
134-
"The stevedore namespace format (my.stevedore.extension) is similar "
135-
"to a python namespace."
138+
help = softwrap(
139+
"""
140+
List the stevedore namespaces required by this target.
141+
142+
All stevedore_extension targets with these namespaces will be added as
143+
dependencies so that they are available on PYTHONPATH during tests.
144+
The stevedore namespace format (my.stevedore.extension) is similar
145+
to a python namespace.
146+
"""
136147
)
137148

138149

0 commit comments

Comments
 (0)