@@ -184,12 +184,12 @@ example above.)
184
184
Referencing Extraction Methods
185
185
------------------------------
186
186
187
- To be able to use short extraction method names such as “genshi”, you need to
188
- have `pkg_resources `_ installed, and the package implementing that extraction
189
- method needs to have been installed with its meta data (the `egg-info `_).
187
+ Generally, packages publish Babel extractors as Python entry points,
188
+ and so you can use a short name such as “genshi” to refer to them.
190
189
191
- If this is not possible for some reason, you need to map the short names to
192
- fully qualified function names in an extract section in the mapping
190
+ If the package implementing an extraction method has not been installed in a
191
+ way that has kept its entry point mapping intact, you need to map the short
192
+ names to fully qualified function names in an extract section in the mapping
193
193
configuration. For example:
194
194
195
195
.. code-block :: ini
@@ -202,12 +202,9 @@ configuration. For example:
202
202
[custom: **.ctm]
203
203
some_option = foo
204
204
205
- Note that the builtin extraction methods ``python `` and ``ignore `` are available
206
- by default, even if `pkg_resources `_ is not installed. You should never need to
207
- explicitly define them in the ``[extractors] `` section.
208
-
209
- .. _`egg-info` : http://peak.telecommunity.com/DevCenter/PythonEggs
210
- .. _`pkg_resources` : http://peak.telecommunity.com/DevCenter/PkgResources
205
+ Note that the builtin extraction methods ``python `` and ``ignore `` are always
206
+ available, and you should never need to explicitly define them in the
207
+ ``[extractors] `` section.
211
208
212
209
213
210
--------------------------
@@ -240,10 +237,9 @@ need to implement a function that complies with the following interface:
240
237
is the job of the extractor implementation to do the decoding to
241
238
``unicode `` objects.
242
239
243
- Next, you should register that function as an entry point. This requires your
244
- ``setup.py `` script to use `setuptools `_, and your package to be installed with
245
- the necessary metadata. If that's taken care of, add something like the
246
- following to your ``setup.py `` script:
240
+ Next, you should register that function as an `entry point `_.
241
+ If using ``setup.py ``, add something like the following to your ``setup.py ``
242
+ script:
247
243
248
244
.. code-block :: python
249
245
@@ -254,6 +250,13 @@ following to your ``setup.py`` script:
254
250
xxx = your.package:extract_xxx
255
251
""" ,
256
252
253
+ If using a ``pyproject.toml`` file , add something like the following :
254
+
255
+ .. code- block:: toml
256
+
257
+ [project.entry- points." babel.extractors" ]
258
+ xxx = " your.package:extract_xxx"
259
+
257
260
That is , add your extraction method to the entry point group
258
261
``babel.extractors``, where the name of the entry point is the name that people
259
262
will use to reference the extraction method , and the value being the module and
0 commit comments