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

simplify dev vs prod installs #3028

Open
marcel-goldschen-ohm opened this issue Jul 17, 2024 · 3 comments
Open

simplify dev vs prod installs #3028

marcel-goldschen-ohm opened this issue Jul 17, 2024 · 3 comments
Labels
⭐ enhancement Improvements for existing features

Comments

@marcel-goldschen-ohm
Copy link

marcel-goldschen-ohm commented Jul 17, 2024

I'm new to PDM, so I probably am not be considering everything. However, I find it both non-intuitive and overly convoluted to swap between development and production installs. For example, consider a pyproject.toml with:

[project]
dependencies = [
    "mypackage"
]
[tool.pdm.dev-dependencies]
dev = [
    "-e mypackage @ file:///${PROJECT_ROOT}/path/to/mypackage",
]

where mypackage is both available via pypi and installed locally at path/to/mypackage for development.

For development only, things are simple. Running pdm install creates the pdm.lock file that refers to the local path/to/mypackage file and installs it in editable mode. Great!

However, as soon as I want to test the production version, things get tricky. I find it very non-intuitive that running pdm install --prod does not replace the local editable path/to/mypackage with the mypackage from pypi. I now understand that pdm.lock only refers to path/to/mypackage and not the mypackage from pypi. However, it is annoying to have to manually create a new lock file such as pdm lock --prod -L pdm.prod.lock and constantly refer to it with the extra flag -L pdm.prod.lock. Even so, running pdm install -L pdm.prod.lock still does NOT overwrite the editable path/to/mypackage that was installed for development. The non-intuitive solution after some digging is to run pdm install -L pdm.prod.lock --no-editable. Although this works, I find it both non-intuitive and overly complicated. Why can't pdm install --dev or pdm install --prod handle all of this including creating any appropriate lock files as needed?

I'm sure there is probably a good answer to this. However, as a new user I'd just say that I found this to be very frustrating.

Cheers

@marcel-goldschen-ohm marcel-goldschen-ohm added the ⭐ enhancement Improvements for existing features label Jul 17, 2024
@o-moe
Copy link
Contributor

o-moe commented Jul 26, 2024

Have you thought about creating a new virtualenv for testing your production environment and not reusing the development environment? Afaik, pdm can handle multiple ones - you still would need the extra lock file to my understanding, so this could, indeed, be more streamlined. Nevertheless, for me, I am using an additional environment to test productive behavior. I am not even using pdm to create it, just using pip because I assume that's what most users will do.

At the end, I have this automated as Gitlab pipeline that also does simple smoke tests (to see if the dependencies resolve ok etc.)

@marcel-goldschen-ohm
Copy link
Author

Thanks @o-moe, I agree that this issue is fairly trivially solved. I simply find it a bit more convoluted than ideal, and I think new users would benefit from some additional recommendations for a typical development setup as I found the gotchas to be non-intuitive. Cheers.

@marcel-goldschen-ohm
Copy link
Author

marcel-goldschen-ohm commented Jul 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

No branches or pull requests

2 participants