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

doc: guidelines for PDM usage in CI #2472

Open
deronnax opened this issue Dec 7, 2023 · 9 comments
Open

doc: guidelines for PDM usage in CI #2472

deronnax opened this issue Dec 7, 2023 · 9 comments
Labels
📖 documentation Improvements or additions to documentation

Comments

@deronnax
Copy link
Sponsor Contributor

deronnax commented Dec 7, 2023

Is your feature request related to a problem? Please describe.

Currently, the documentation gives no instructions for CI: what directories should be cached, or should it even be, should the pip cache be cached, what command you be used in the CI (install vs sync)? Inspiration can be drawn from Poetry and CI builds -- best practices, knowledge share (travisci), and discussion

I am asking because I migrated our pipelines from Pipenv to PDM, and package install time doubled. With pipenv we used to cache the pip cache between jobs, but I suspect PDM is not only reliable on this. Will caching the cache_dir make an impact on installs in CI ? Will it on locking? (we have repos were the pdm.lock is not checked-out).

Thank you.

@deronnax deronnax added the ⭐ enhancement Improvements for existing features label Dec 7, 2023
@frostming
Copy link
Collaborator

frostming commented Dec 8, 2023

What about https://pdm-project.org/latest/usage/advanced/#use-pdm-in-continuous-integration

PDM is storing caches at what pdm config cache_dir is pointing to. PDM isn't running pip under the hood, on contrary to what many expect, so it has nothing to do with pip's cache. Besides, you can also cache $working_dir/.venv for each (python version, platform, architecture) combination. All above have been handled by the official pdm-project/setup-pdm GitHub Action.

Feel free to contribute to the docs if there is anything unclear.

@deronnax
Copy link
Sponsor Contributor Author

deronnax commented Dec 8, 2023

But we use Gitlab CI, so we can't take advantage of the action, otherwise I would just have had and not bothered you 😉
The #use-pdm-in-continuous-integration basically just says to use the GitHub Action, but we are not on GitHub Action.
I will have a quick look at the action's code, and I will try to write down what is relevant to do in a PDM CI job if you can't have the GitHub actions (e.g, do what is needed to cache the PDM cache. Gitlab mandates cached directory be children of the current job run directory, so you have to change the package manager cache location, for one).

@sanmai-NL
Copy link
Contributor

sanmai-NL commented Dec 8, 2023

@deronnax I'll write a PR with generic guidance and examples, as we use it on GitLab CI. I'll update the Containerfile example.

One problem I was about to look into is and fix with a PR is #2398, that also runs into that job directory issue.

@deronnax
Copy link
Sponsor Contributor Author

deronnax commented Dec 8, 2023

OK. I am dying to see it. I will look at it as soon as you create it.
As for me, I don't think we are affected by #2398

@deronnax deronnax closed this as completed Dec 8, 2023
@deronnax deronnax reopened this Dec 8, 2023
@deronnax
Copy link
Sponsor Contributor Author

deronnax commented Dec 8, 2023

btw, in the multi-stage Dockerfile example, the documentation is still using a __pypackages__, is it something we want to keep?

@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Dec 8, 2023

I think it's OK to keep it, though we should provide a venv example too, good catch.

@sanmai-NL
Copy link
Contributor

See #2482 for further discussion please.

@JeyDi
Copy link

JeyDi commented Dec 17, 2023

Hi guys do you have some guidelines on how to build a package using CI and PDM? On Github and Gitlab?
I'm struggling with the tags in particular: I am trying to dynamically assign my tag from the CD to the python package I want to build with PMD build, do you have any ideas or examples?

@sanmai-NL
Copy link
Contributor

Hi guys do you have some guidelines on how to build a package using CI and PDM? On Github and Gitlab? I'm struggling with the tags in particular: I am trying to dynamically assign my tag from the CD to the python package I want to build with PMD build, do you have any ideas or examples?

Please ask this as a Discussions question.

@frostming frostming added 📖 documentation Improvements or additions to documentation and removed ⭐ enhancement Improvements for existing features labels Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📖 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants