-
Notifications
You must be signed in to change notification settings - Fork 8
Move from install to sync cmd
#450
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
base: main
Are you sure you want to change the base?
Move from install to sync cmd
#450
Conversation
|
I don't know how to address this one since locally and in my fork(Github Actions) are passing |
| poetryVersion = "2.*" | ||
| } | ||
| installCmd := []string{"sync"} | ||
| // Can be remove once support for poetry v1 is removed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought as we do this for other buildpacks.
Maybe the arguments could be configurable? Like BP_POETRY_INSTALL_ARGS. You could default that to the appropriate args for each version. Users could then override that if they want other args.
Seems like it would solve this problem but continue to be a useful feature beyond this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, but I don't think the default install buildpack works as intended.
I have included the following example as a test project I created for myself.
pyproject.toml
[tool.poetry]
package-mode = false
[tool.poetry.dependencies]
python = "^3.13"
django = "^5.2.4"
fastapi = "^0.116.1"project.toml
[build]
exclude = [
".venv",
]
Procfile
web: python3 main.py
main.py
try:
import django
print(django)
except ImportError:
print("Fail to import django")
try:
import fastapi
print(fastapi)
except ImportError:
print("Fail to import fastapi")So I built an image with
pack build --builder=paketobuildpacks/builder-jammy-base:latest --run-image=paketobuildpacks/run-jammy-base:latest test-imageThen run it
docker run test-imageOutput
<module 'django' from '/layers/paketo-buildpacks_poetry-install/poetry-venv/non-package-mode-xS3fZVNL-py3.13/lib/python3.13/site-packages/django/__init__.py'>
<module 'fastapi' from '/layers/paketo-buildpacks_poetry-install/poetry-venv/non-package-mode-xS3fZVNL-py3.13/lib/python3.13/site-packages/fastapi/__init__.py'>As expected, okay, let's remove fastapi from pyproject.toml and update lock file. And repeat the build and run command.
Output
<module 'django' from '/layers/paketo-buildpacks_poetry-install/poetry-venv/non-package-mode-xS3fZVNL-py3.13/lib/python3.13/site-packages/django/__init__.py'>
<module 'fastapi' from '/layers/paketo-buildpacks_poetry-install/poetry-venv/non-package-mode-xS3fZVNL-py3.13/lib/python3.13/site-packages/fastapi/__init__.py'>Hmm, weird, where does FastAPI come from? If I rebuild with no cache
<module 'django' from '/layers/paketo-buildpacks_poetry-install/poetry-venv/non-package-mode-xS3fZVNL-py3.13/lib/python3.13/site-packages/django/__init__.py'>
Fail to import fastapid5b9ae3 to
75fc83e
Compare

Summary
Use
sync(install --syncin v1) for installing dependenciesCloses #96
Use Cases
When changing
BP_POETRY_INSTALL_ONLYbetweenmainanddevand running pack build, I noticed that install doesn't remove deps that are not matching the selected group, and only checks that all deps from specified group are installed.Checklist