Skip to content

docs: use pinned dependencies in CICD #590

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SMoraisAnsys
Copy link
Contributor

Following the comments in #558 (comment)

This PR aims at adding guidance on the fact that CI/CD must use pinned version dependencies. For developers using poetry and a lock file, I don't expect any issues. But, for other developers leveraging requirements file(s) (e.g. with uv), I'm concerned about the update of this file(s) and how it will integrate in CI/CD. One way to solve this could be to have a new ansys action to the create and update of the requirements file(s). This file would be updated through dependabot PRs and transitive dependencies could either be updated at every PR or on a weekly base.

@SMoraisAnsys SMoraisAnsys marked this pull request as draft April 28, 2025 10:15
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Apr 28, 2025
@SMoraisAnsys
Copy link
Contributor Author

Thanks for the review @da1910

Comment on lines +235 to +251

If your project uses `flit` or `hatch`, you can use `uv <https://github.com/astral-sh/uv>`_
to resolve the dependencies and generate a requirements file. You can use the
``uv pip compile -o requirements.txt pyproject.toml`` command to generate a ``requirements.txt``
file with the main dependencies defined in your project. Note that, unlike the
``poetry.lock`` file, the requirements file does not include the variations for each installation
target. To create a requirements file with a specific extra, you can use the ``--extras`` option.
For example, you can create a requirement file with the `tests` extra by running the
``uv pip compile --extra tests -o requirements-tests.txt pyproject.toml``. Once the file has been created,
you can use the following command in your CI workflow to install the project with `tests`
dependencies:

.. code-block:: yaml

- name: Install dependencies with extra tests
run: |
pip install -r requirements-tests.txt
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we focus on giving guidance using the pylock.toml file moving forward (rather than the requirements.txt files usage). Not talking about poetry here

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good point, this is now available with recent uv version https://github.com/astral-sh/uv/releases/tag/0.6.15.

Copy link
Contributor Author

@SMoraisAnsys SMoraisAnsys Apr 29, 2025

Choose a reason for hiding this comment

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

Just checked and it's not available yet with poetry. It's available with the latest version of pip https://pip.pypa.io/en/stable/cli/pip_lock/

Copy link
Member

Choose a reason for hiding this comment

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

Yeah.. That's what I thought. That's also why I mentioned to leave poetry out of the mix for the pylock.toml file

Copy link
Contributor Author

@SMoraisAnsys SMoraisAnsys May 2, 2025

Choose a reason for hiding this comment

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

Note sure dependabot supports this kind of format yet, see dependabot/dependabot-core#12094
We should probably wait a bit more to move foward that approach. I agree to use pylock.toml though

@SMoraisAnsys
Copy link
Contributor Author

SMoraisAnsys commented May 2, 2025

Just a comment here even if the discussion is not directly related. If we want to be able to work with a specific list of scientific libraries and/or system libraries with a fine management of the "flavors"/"variants", for example specify:

  • install of h5py with hdf5 v.12.2, with MPI support, where we want to use of OpenMPI
  • install of numpy with OpenBLAS and a specific version of gcc or using Intel compiler, ...

We might want to have a look into a solution like https://spack.io/ (note that it should be working on windows, I don't know why they don't state it in the landing page)

@SMoraisAnsys
Copy link
Contributor Author

SMoraisAnsys commented May 5, 2025

Just for visibility: installing with pylock.toml in pip is not yet available pypa/pip#13369

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

Successfully merging this pull request may close these issues.

3 participants