Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locally build PROD image contains local source for airflow but pypi code for providers #37815

Closed
1 task done
potiuk opened this issue Mar 1, 2024 · 1 comment · Fixed by #37796
Closed
1 task done
Labels
kind:meta High-level information important to the community

Comments

@potiuk
Copy link
Member

potiuk commented Mar 1, 2024

Body

The PROD image built using breeze prod-image build after #36536 and after changes in pip and setuptools made it impossible to install --editable installation in --user installation is broken - see pypa/pip#7953 for details.

It contains only airflow sources copied from local code, but provider s are installed from PyPI which makes it impossible to iterate locally on the PROD image changes and makes it difficult to test any local changes - for example in cncf.kubernetes provider.

This does not affect CI tests - because CI tests build PROD image by pre-building dev packages for all PROD-image providers and airflow and install both Airflow and Providers from such pre-built packages copied to docker-context-files, so our CI still test what is in the PR.

This isssue can be solved once we merge #37796 - there we switch PROD image to use venv rather than --user flag and that should allow to fix local instalation to revert back to use --editable build and copy all airflow sources to the image including all providers, allowing to iteratively test it. Also, by doing that we should be able to add better ways of sharing the code in the future (for example using Telepresence

Committer

  • I acknowledge that I am a maintainer/committer of the Apache Airflow project.
@potiuk potiuk added the kind:meta High-level information important to the community label Mar 1, 2024
@potiuk
Copy link
Member Author

potiuk commented Mar 1, 2024

cc: cc: @sudiptob2 and @o-nikolas @jedcunningham - recorded the issue with PROD image/ Kubernetes here - I hope with #37796 merged, we will be able to solve it quickly.

potiuk added a commit that referenced this issue Mar 2, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 2, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 2, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 2, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit to potiuk/airflow that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: apache#37785
Fixes: apache#37815
potiuk added a commit that referenced this issue Mar 3, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 5, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815
potiuk added a commit that referenced this issue Mar 5, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815

Update contributing-docs/testing/k8s_tests.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update contributing-docs/testing/k8s_tests.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update scripts/docker/install_airflow.sh

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/changelog.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>
potiuk added a commit that referenced this issue Mar 5, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: #37785
Fixes: #37815

Update contributing-docs/testing/k8s_tests.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update contributing-docs/testing/k8s_tests.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update scripts/docker/install_airflow.sh

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/changelog.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>

Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>
@potiuk potiuk closed this as completed in a1717a6 Mar 6, 2024
utkarsharma2 pushed a commit to astronomer/airflow that referenced this issue Apr 22, 2024
This PR introduces a joint way to treat the .local (--user) folder
as both - venv and `--user` package installation. It fixes a number
of problems the `--user` installation created us in the past and
does it in fully backwards compatible way.

This improves both "production" use for end user as well as local
iteration on the PROD image during tests - but also for CI.

Improvements for "end user":

* user does not have to use `pip install --user` to install new
  packages any more and it is not enabled by default with PIP_USER
  flag.

* users can use uv to install packages when they extend the image
  (but it's not obligatory - pip continues working as it did)

* users can use `uv` to build custom production image, which gives
  40%-50% saving for image build time compring to `pip`.

* python -m venv --system-site-packages continues to use the
  .local packages from the .local installation (and not uses
  them if --system-site-packages is not used) - so we have full
  compatibility with previous images.

Improvements for development:

* when image is built from sources (no --use-docker-context-files
  are specified), airflow is installed in --editable mode, which
  means that airflow + all providers are installed locally from
  airflow sources, not from packages - which means that both
  airflow and providers have the latest version inside the
  prod image.

* when local sources changes and you want to run k8s tests locally,
  it is now WAY faster (several minutes) to iterate with your changes
  because you do not have to rebuild the base image - the only thing
  needed is to copy sources to the PROD image to "/opt/airflow" which
  is where editable installlation is done from. You only need to
  rebuild the image if dependencies change.

* By default `uv` is used for local source build for k8s tests so
  even if you have to rebuild it, it is way faster (60%-80%) during
  iterating with the image.

CI/DEV tooling improvements:

* this PR switches to use `uv` by default for most prod images we
  build in CI, but it adds a check if the image still builds with `pip`.

* we also switch to more PEP standard way of installing packages
  from local filesystem (package-name @ file:///FILE)

Fixes: apache#37785
Fixes: apache#37815

Update contributing-docs/testing/k8s_tests.rst



Update contributing-docs/testing/k8s_tests.rst



Update docs/docker-stack/build.rst



Update docs/docker-stack/build.rst



Update docs/docker-stack/build.rst



Update docs/docker-stack/build.rst



Update docs/docker-stack/build.rst



Update scripts/docker/install_airflow.sh



Update docs/docker-stack/changelog.rst



Update docs/docker-stack/build.rst

Co-authored-by: Niko Oliveira <onikolas@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:meta High-level information important to the community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant