Repository: PrefectHQ/prefect

Issue:
update distributed to be < 3.0
`distributed`'s `2.0` release was mostly deprecations. The current requirement prevents installs of `prefect` with projects that require more recent versions of the library i.e. those that use [`poetry`](https://poetry.eustace.io/) for version management

https://github.com/PrefectHQ/prefect/blob/4f56ceb492ddbc8ef91c1e9acd21d14f320d4cc3/requirements.txt#L5


Discussion:
Hi @knowsuchagency - we're currently looking into this.  Right now we're finding that the newest version of distributed isn't compatible with [dask-kubernetes](https://github.com/dask/dask-kubernetes) which would cause some Flows to fail in Prefect Cloud.  Will update here when we've sorted it out!

Resolving patch:
diff --git a/src/prefect/core/flow.py b/src/prefect/core/flow.py
--- a/src/prefect/core/flow.py
+++ b/src/prefect/core/flow.py
@@ -32,7 +32,7 @@
 from prefect.core.task import Parameter, Task
 from prefect.engine.result import NoResult
 from prefect.engine.result_handlers import ResultHandler
-from prefect.environments import CloudEnvironment, Environment
+from prefect.environments import RemoteEnvironment, Environment
 from prefect.environments.storage import Storage
 from prefect.utilities import logging
 from prefect.utilities.notifications import callback_factory
@@ -106,7 +106,7 @@ def my_task():
         - name (str): The name of the flow. Cannot be `None` or an empty string
         - schedule (prefect.schedules.Schedule, optional): A default schedule for the flow
         - environment (prefect.environments.Environment, optional): The environment
-           that the flow should be run in. If `None`, a `CloudEnvironment` will be created.
+           that the flow should be run in. If `None`, a `RemoteEnvironment` will be created.
         - storage (prefect.environments.storage.Storage, optional): The unit of storage
             that the flow will be written into.
         - tasks ([Task], optional): If provided, a list of tasks that will initialize the flow
@@ -156,7 +156,7 @@ def __init__(
 
         self.name = name
         self.schedule = schedule
-        self.environment = environment or prefect.environments.CloudEnvironment()
+        self.environment = environment or prefect.environments.RemoteEnvironment()
         self.storage = storage
         self.result_handler = (
             result_handler or prefect.engine.get_default_result_handler_class()()


Test patch:
diff --git a/tests/core/test_flow.py b/tests/core/test_flow.py
--- a/tests/core/test_flow.py
+++ b/tests/core/test_flow.py
@@ -134,12 +134,12 @@ def test_create_flow_with_storage(self):
         assert isinstance(f2.storage, prefect.environments.storage.Memory)
 
     def test_create_flow_with_environment(self):
-        f2 = Flow(name="test", environment=prefect.environments.CloudEnvironment())
-        assert isinstance(f2.environment, prefect.environments.CloudEnvironment)
+        f2 = Flow(name="test", environment=prefect.environments.RemoteEnvironment())
+        assert isinstance(f2.environment, prefect.environments.RemoteEnvironment)
 
     def test_create_flow_has_default_environment(self):
         f2 = Flow(name="test")
-        assert isinstance(f2.environment, prefect.environments.CloudEnvironment)
+        assert isinstance(f2.environment, prefect.environments.RemoteEnvironment)
 
     def test_create_flow_auto_generates_tasks(self):
         with Flow("auto") as f:
@@ -1430,7 +1430,7 @@ def test_serialize_validates_invalid_flows(self):
 
     def test_default_environment_is_cloud_environment(self):
         f = Flow(name="test")
-        assert isinstance(f.environment, prefect.environments.CloudEnvironment)
+        assert isinstance(f.environment, prefect.environments.RemoteEnvironment)
 
     def test_serialize_includes_storage(self):
         f = Flow(name="test", storage=prefect.environments.storage.Memory())