Taragolis commented on issue #28504:
URL: https://github.com/apache/airflow/issues/28504#issuecomment-1360061675
Simple Operator
```python
class SimplePythonVirtualenvOperator(PythonVirtualenvOperator):
def __init__(self, task_id: str, **kwargs):
task_id = kwargs
kwargs["python_callable"] = my_func
kwargs["python_version"] = "3.9"
kwargs["requirements"] = ["requests"]
super().__init__(task_id=task_id, **kwargs):
```
Or simple "factory"
```python
def simple_task_factory(
task_id: str, python_callable = None, python_version = None,
requirements = None, **kwargs
):
return PythonVirtualenvOperator(
task_id=task_id,
python_callable=python_callable or my_func,
python_version=python_version or "3.9",
requirements=requirements or ["requests"],
**kwargs
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]