@@ -242,6 +242,42 @@ distribution.
242242The format of all ` METADATA.toml ` files can be checked by running
243243` python3 ./tests/check_typeshed_structure.py ` .
244244
245+ ### Dependencies
246+
247+ When a third-party stub package depends on another package, there are several
248+ strategies available, depending on whether the other package is typed.
249+
250+ 1 . If the other package is typed and includes a ` py.typed ` marker, add that
251+ package to the ` dependencies ` key in ` METADATA.toml ` . This might fail the
252+ stub uploader checks, in which case you can ask the maintainers for help.
253+ 2 . Otherwise, if a type package is available, add that package to the
254+ ` dependencies ` key. If the type package originates from typeshed, the
255+ stub uploader checks should succeed.
256+ 3 . In case the dependency in untyped and no stubs are available, you may stub
257+ the dependency in your type stubs. For example:
258+
259+ ``` python
260+ from typing import Any
261+ # from fruzzle import Frobnicator # won't work
262+
263+ _Frobnicator: TypeAlias = Any # actually fruzzle.Frobnicator
264+ ```
265+
266+ In more complex or advanced cases you may instead opt to add a stubs
267+ is a separate helper package:
268+
269+ ```python
270+ # stubs/my-stubs/my_stubs/_fruzzle.pyi
271+
272+ # Utility stubs for the untyped "fruzzle" package.
273+
274+ from typing import Any, Protocol
275+
276+ Frobnicator: TypeAlias = Any
277+
278+ class Flubberer (Protocol ):
279+ def flubb_it (self , x : int , / ) -> str : ...
280+ ```
245281
246282# # Making Changes
247283
0 commit comments