__init__
files__init__
files empty unless exposing an interface. If you must expose objects to present a simpler API,
please follow these rules.
__init__
file should use a relative import. This is
required for type checkers
to understand the exposed interface.
__init__
file. You should only expose submodules when the module
is designed to be imported and used as a namespaced object.
For example, we do this for our schema and model modules. This is because it’s important to know if you are working with an API
schema or database model—both of which may have similar names.
prefect.serializers
.prefect.cli
.from
syntax is recommended for importing objects from modules. You should not import modules
with the from
syntax.
__init__.py
file.
TYPE_CHECKING
flag:
"State"
, since it is not available at runtime.
kubernetes
, docker
, and distributed
implementations for now.
prefect
module import times fast. In these cases, lazily
import the slow module by deferring import to the relevant function body. For modules consumed by many functions,
use the optional requirements pattern instead.
!r
.textwrap.dedent
to remove extraneous spacing for strings with triple quotes (""").API_VERSION
header with major,
minor, and patch versions.
For example, a request with the X-PREFECT-API-VERSION=3.2.1
header has a major version of 3
, minor version 2
, and patch
version 1
.
Change this version header by modifying the API_VERSION
constant in prefect.server.api.server
.
rc
, a
, or b
. These indicate pre-release versions that users can
opt into for testing and experimentation prior to a generally available release.
Each release will increase one of the version numbers. If we increase a number other than the patch version, the versions to the
right of it reset to zero.