Skip to content

Change type of virtualenv_dir argument from path to string#1721

Closed
pankajastro wants to merge 10 commits into
mainfrom
fix_ve_example
Closed

Change type of virtualenv_dir argument from path to string#1721
pankajastro wants to merge 10 commits into
mainfrom
fix_ve_example

Conversation

@pankajastro
Copy link
Copy Markdown
Contributor

@pankajastro pankajastro commented Apr 29, 2025

closes: #1707

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 29, 2025

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
🔨 Latest commit f7b12fb
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/6810a9496652660008e89318

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 29, 2025

Deploying astronomer-cosmos with  Cloudflare Pages  Cloudflare Pages

Latest commit: f7b12fb
Status: ✅  Deploy successful!
Preview URL: https://0c16f483.astronomer-cosmos.pages.dev
Branch Preview URL: https://fix-ve-example.astronomer-cosmos.pages.dev

View logs

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.48%. Comparing base (f9bdcc1) to head (1f1947c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1721      +/-   ##
==========================================
- Coverage   97.50%   97.48%   -0.02%     
==========================================
  Files          83       83              
  Lines        5049     5051       +2     
==========================================
+ Hits         4923     4924       +1     
- Misses        126      127       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pankajkoti pankajkoti changed the title Change Vitrual env mini env path to string Change type of virtualenv_dir argument from path to string Apr 29, 2025
Comment thread cosmos/operators/virtualenv.py Outdated
pip_install_options: list[str] | None = None,
py_system_site_packages: bool = False,
virtualenv_dir: Path | None = None,
virtualenv_dir: str | None = None,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pankajastro this could be seen as a breaking change - what motivated it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed that change @tatiana in 1f1947c. We had a discussion regarding this in the other PR at #1718 (comment).

Apparently Airflow 3 is evaluating & validating that the Path exists as part of its rending as mentioned by Pankaj in the other PR's description.

Copy link
Copy Markdown
Collaborator

@tatiana tatiana Apr 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pankajkoti I just read the thread - would it be possible for this to remain a Path and for us to convert to a string if Airflow 3, as part of the operator implementation? In the worst case, we could support this field being both str and path and handling it in the operator. It would be better if we didn't introduce a breaking change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to try out though, when does the rendering evaluate and if we have control over it(meaning if the rendering happens even before the operator initializes/executes and if yes, if there's a method to override the type for it).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will try it out later today to dig into this.

pre-commit-ci Bot and others added 7 commits April 29, 2025 15:35
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.6 →
v0.11.7](astral-sh/ruff-pre-commit@v0.11.6...v0.11.7)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
The PR adds the following files to `.gitignore`

1. `mock-venv`: generated when running cosmos unit tests locally, e.g.
`hatch run tests.py3.11-3.0-1.9:test-cov`
2. `simple_auth_manager_passwords.json.generated`: Airflow 3 standalone
generated password file
…xes (#1719)

While the initial x.x.0 versions of dbt adapters may have compatibility
issues with certain dependencies, I observed that these
incompatibilities are progressively addressed in later patch releases.
The issue reported in #1709 appears to stem from dbt-bigquery accessing
a protected member `google.cloud.bigquery._helpers._CELLDATA_FROM_JSON`,
which was removed in `google-cloud-bigquery 3.31.0`. This access I
believe was introduced in
[dbt-bigquery#974](dbt-labs/dbt-bigquery#974)
and later removed in
[dbt-bigquery#1061](dbt-labs/dbt-bigquery#1061),
with the fix subsequently back-ported to the 1.7 series via
[dbt-bigquery#1074](dbt-labs/dbt-bigquery#1074).
Therefore, I believe that relying on the latest patch versions is a
better approach to avoid such issues, rather than individually resolving
discrepancies. This PR aligns with that strategy.


closes: #1709

---------

Co-authored-by: Tatiana Al-Chueyr <tatiana.alchueyr@gmail.com>
Implement dbt exposure selector, following exactly the same pattern as
source.
This is just an updated version of #1559 with the requested additional
unit test... sorry for the delay 🙈

Closes #1551
During some experimentation with
[callbacks](https://astronomer.github.io/astronomer-cosmos/configuration/callbacks.html#example-using-callbacks-with-a-single-operator)
I have noticed that we can only use a single callback per time, which
can be very limiting if I want to add custom callbacks together with the
default ones provided by cosmos.

This PR is very simple and aims to allow multiple callbacks to be passed
as a list of functions, that will then be executed sequentially.
Cosmos 1.9.0 introduced a change such that `AbstractDbtBase` no longer
inherits from airflow `BaseOperator` and I believe this introduced two
bugs.

- In the past you could give arguments using airflows `default_args` and
these would end up being passed to cosmos. So for example we were
specifying the `project_dir` as a default arg, and in 1.9.0 these
projects were broken because AbstractDbtBase was not longer getting a
project_dir specified. So the first change is to check both kwargs and
default_args for the values AbstractDbtBase requires. ~I've only made
this change for the kubernetes operator, but I'd argue it should be done
for the local a docker ones too.~
- The existing code tries to inspect `KubernetesPodOperator` for the
args that it requires, but notably this approach misses arguments that
are required by `BaseOperator`, e.g. the task_group.
- ~I've made an effort to restore the convention in airflow that all
arguments must be consumed by the operator. So an argument must either
be consumed by `AbstractDbtBase` or it will be passed along to the
operator, it may also be consumed by both classes.~
During some experimentation with
[callbacks](https://astronomer.github.io/astronomer-cosmos/configuration/callbacks.html#example-using-callbacks-with-a-single-operator)
I have noticed that we can only use a single callback per time, which
can be very limiting if I want to add custom callbacks together with the
default ones provided by cosmos.

This PR is very simple and aims to allow multiple callbacks to be passed
as a list of functions, that will then be executed sequentially.
@pankajkoti
Copy link
Copy Markdown
Contributor

After rebasing, this PR shows a lot of files changed although the changes are already in main and would make it difficult to review. I created a fresh PR to reflect only the changes being made #1724

Hence, I am closing this PR.

@pankajkoti pankajkoti closed this Apr 29, 2025
@pankajkoti pankajkoti deleted the fix_ve_example branch April 29, 2025 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FAILED tests/operators/test_virtualenv.py::test_integration_virtualenv_operator AF 3 CI

6 participants