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

Pin test dependencies #5715

Merged
merged 13 commits into from
Apr 22, 2023
Merged

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Apr 12, 2023

Description

In this PR I add constraints files for napari test dependencies and workflow to perform every week update of dependencies.

The motivation for this PR is to avoid regular failures not related to PR context but caused by some dependency release.

Also, this PR will provide dependency versions on which napari works during release time.

This PR is inspired by workflow from PartSeg that example output could be found here 4DNucleome/PartSeg#932 (but here is not listening all updated dependencies)

This PR will require adding GHA_TOKEN to repository secrets with the following permissions:

obraz

References

Type of change

  • Bug-fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How has this been tested?

  • example: the test suite for my feature covers cases x, y, and z
  • example: all tests pass with my change
  • example: I check if my changes works with both PySide and PyQt backends
    as there are small differences between the two Qt bindings.

Final checklist:

  • My PR is the minimum possible work for the desired functionality
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • If I included new strings, I have used trans. to make them localizable.
    For more information see our translations guide.

@codecov
Copy link

codecov bot commented Apr 12, 2023

Codecov Report

Merging #5715 (3db1b59) into main (95356e4) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #5715   +/-   ##
=======================================
  Coverage   89.83%   89.84%           
=======================================
  Files         608      608           
  Lines       51881    51881           
=======================================
+ Hits        46608    46611    +3     
+ Misses       5273     5270    -3     

see 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@jaimergp
Copy link
Contributor

I like this! I recently learnt about the Dependency submissions API, which might be related to this in terms of purpose. Having the constraints already there should make it super easy to integrate!

@brisvag brisvag added tests Something related to our tests ci Continuous integration dependencies Pull requests that update a dependency file labels Apr 12, 2023
@Czaki Czaki marked this pull request as ready for review April 12, 2023 22:31
@Czaki Czaki added the maintenance PR with maintance changes, label Apr 18, 2023
@Czaki Czaki added this to the 0.5.0 milestone Apr 18, 2023
@jni jni changed the title Add pinning test depenedcies Pin test dependencies Apr 19, 2023
@jni
Copy link
Member

jni commented Apr 19, 2023

@Czaki can you elaborate on what kind of token I need to create? Is this a personal access token or something else? Detailed instructions appreciated. 😊

Copy link
Member

@jni jni left a comment

Choose a reason for hiding this comment

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

@Czaki thanks for this! Almost ready I think!

python3.9 -m pip install -U pip pip-tools
python3.10 -m pip install -U pip pip-tools

python3.8 -m piptools compile --upgrade -o resources/constraints/constraints_py3.8.txt setup.cfg resources/constraints/version_denylist.txt --extra pyqt5 --extra pyqt6_experimental --extra pyside2 --extra pyside6_experimental --extra testing --allow-unsafe --strip-extras --resolver=backtracking
Copy link
Member

Choose a reason for hiding this comment

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

@Czaki could you add a long comment here to explain what these lines and each of the options do? They are very long and scary. 😅

Copy link
Collaborator Author

@Czaki Czaki Apr 19, 2023

Choose a reason for hiding this comment

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

  • python3.8 -m piptools compile - call pip-compile but ensure proper intepretter
  • --upgrade upgrade to the latest possible version. Without this pip-compile will take a look to output files and reuse versions (so will ad something on when adding dependency.
  • -o resources/constraints/constraints_py3.8.txt - output file
  • setup.cfg resources/constraints/version_denylist.txt - source files. the resources/constraints/version_denylist.txt - contains our test specific constraints like pytes-cov`
  • --extra pyqt5 etc - names of extra sections from setup.cfg that should be checked for the dependencies list (maybe we could create a super extra section to collect them all in)
  • --allow-unsafe - allow to put in constraints things like setuptools (look at the end of one of the generated files). It will be the default behavior in the future.
  • --strip-extras - pip constrains format does not allow to specify extras (like dask[array]) so we need to use this option
  • --resolver=backtracking - future default resolver. It fasters. Lower probability of long CI run.

Did you want to put this comment in yml file?

Copy link
Member

Choose a reason for hiding this comment

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

It sounds kind of ridiculous, yes, but kind of yes? I wonder if it would work with a multiline string with trailing yaml comments?

.github/workflows/upgrade_test_constraints.yml Outdated Show resolved Hide resolved
tools/check_updated_packages.py Outdated Show resolved Hide resolved
Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
@Czaki
Copy link
Collaborator Author

Czaki commented Apr 20, 2023

@Czaki can you elaborate on what kind of token I need to create? Is this a personal access token or something else? Detailed instructions appreciated. blush

Go to napari Settings > Third-party Access > Personal access tokens > Settings
image

Then allow Fine-grained personal access tokens but keep "Require administrator approval"

image

Go to personal Settings > Developer Settings > Personal access tokens > Fine-grained tokens
image

Generate new Token

Set resource owner to napari. Set long lime of expiration. Use "Only select repositories"

Here is an example of the configuration for PartSeg, as the napari repository do not allow currently for these tokens:
image

Then in repository permissions, set Pull request permissions to Read and Write:
image

Click "generate token".

Such toke could also solve the problem of not starting CI on updating vendor dependency PR.

@kephale
Copy link
Contributor

kephale commented Apr 21, 2023

@Czaki out of curiosity, why are the pip install and examples tests using 3.9 instead of 3.10?

@kephale
Copy link
Contributor

kephale commented Apr 21, 2023

@Czaki is tools/constraints/version_blacklist.txt missing?

@Czaki
Copy link
Collaborator Author

Czaki commented Apr 21, 2023

@Czaki is tools/constraints/version_blacklist.txt missing?

Was renamed to version_denylist. I do not regenerate files to simpler check if its working good after merge.

@Czaki out of curiosity, why are the pip install and examples tests using 3.9 instead of 3.10?

At some moment there was the decision to not use the latest supported, but one before. When we enable python 3.11 test then we should switch it to python 3.10

@kephale
Copy link
Contributor

kephale commented Apr 21, 2023

Awesome, thank you @Czaki !

@Czaki
Copy link
Collaborator Author

Czaki commented Apr 21, 2023

@Carreau This PR may conflict with parts of your work. What did you think about it?

@alisterburt
Copy link
Contributor

Love this - going to merge because we have two approving reviews but we can always revert if @Carreau has issues

@alisterburt alisterburt merged commit b5f2fb5 into napari:main Apr 22, 2023
@alisterburt alisterburt deleted the feature/pin_dependecise_for_tests branch April 22, 2023 11:58
@Czaki Czaki mentioned this pull request Apr 22, 2023
12 tasks
jni pushed a commit that referenced this pull request Apr 23, 2023
Path to `check_updated_packages.py` was set incorrectly
in #5715. This fixes the path.
jni pushed a commit that referenced this pull request Apr 26, 2023
#5777)

# Description

This PR reenables using fine-grained Personal access tokens to trigger
tests in PR created by workflow.

The previous problem was caused by a lack of **code** permission
in tokens.

![permissions](https://user-images.githubusercontent.com/3826210/234532611-5c713481-13f0-4401-8c83-f5fed43c4aba.png)

But when setting these permissions, they are not named **code** but
**contents**:

![permission name](https://user-images.githubusercontent.com/3826210/234532254-a0d5fb98-f3a9-4153-a866-15dc7b5c2617.png)

# References

Previous PRs:

#5715 
#5774
@Czaki Czaki modified the milestones: 0.5.0, 0.4.18 Jun 8, 2023
@Czaki Czaki mentioned this pull request Jun 9, 2023
Czaki added a commit that referenced this pull request Jun 19, 2023
# Description
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

In this PR I add constraints files for napari test dependencies and
workflow to perform every week update of dependencies.

The motivation for this PR is to avoid regular failures not related to
PR context but caused by some dependency release.

Also, this PR will provide dependency versions on which napari works
during release time.

This PR is inspired by workflow from PartSeg that example output could
be found here 4DNucleome/PartSeg#932 (but here
is not listening all updated dependencies)

This PR will require adding `GHA_TOKEN` to repository secrets with the
following permissions:


![obraz](https://user-images.githubusercontent.com/3826210/233028398-daa24aeb-3af9-455d-b8c4-b722a3c0d413.png)


# References
<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

## Type of change
<!-- Please delete options that are not relevant. -->
- [ ] Bug-fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.  

## Final checklist:
- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).

---------

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Czaki added a commit that referenced this pull request Jun 19, 2023
Path to `check_updated_packages.py` was set incorrectly
in #5715. This fixes the path.
Czaki added a commit that referenced this pull request Jun 21, 2023
# Description
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

In this PR I add constraints files for napari test dependencies and
workflow to perform every week update of dependencies.

The motivation for this PR is to avoid regular failures not related to
PR context but caused by some dependency release.

Also, this PR will provide dependency versions on which napari works
during release time.

This PR is inspired by workflow from PartSeg that example output could
be found here 4DNucleome/PartSeg#932 (but here
is not listening all updated dependencies)

This PR will require adding `GHA_TOKEN` to repository secrets with the
following permissions:


![obraz](https://user-images.githubusercontent.com/3826210/233028398-daa24aeb-3af9-455d-b8c4-b722a3c0d413.png)


# References
<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

## Type of change
<!-- Please delete options that are not relevant. -->
- [ ] Bug-fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.  

## Final checklist:
- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).

---------

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Czaki added a commit that referenced this pull request Jun 21, 2023
Path to `check_updated_packages.py` was set incorrectly
in #5715. This fixes the path.
Czaki added a commit that referenced this pull request Jun 21, 2023
# Description
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

In this PR I add constraints files for napari test dependencies and
workflow to perform every week update of dependencies.

The motivation for this PR is to avoid regular failures not related to
PR context but caused by some dependency release.

Also, this PR will provide dependency versions on which napari works
during release time.

This PR is inspired by workflow from PartSeg that example output could
be found here 4DNucleome/PartSeg#932 (but here
is not listening all updated dependencies)

This PR will require adding `GHA_TOKEN` to repository secrets with the
following permissions:


![obraz](https://user-images.githubusercontent.com/3826210/233028398-daa24aeb-3af9-455d-b8c4-b722a3c0d413.png)


# References
<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

## Type of change
<!-- Please delete options that are not relevant. -->
- [ ] Bug-fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.  

## Final checklist:
- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).

---------

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Czaki added a commit that referenced this pull request Jun 21, 2023
Path to `check_updated_packages.py` was set incorrectly
in #5715. This fixes the path.
Czaki added a commit that referenced this pull request Jun 21, 2023
# Description
<!-- What does this pull request (PR) do? Why is it necessary? -->
<!-- Tell us about your new feature, improvement, or fix! -->
<!-- If your change includes user interface changes, please add an
image, or an animation "An image is worth a thousand words!" -->
<!-- You can use https://www.cockos.com/licecap/ or similar to create
animations -->

In this PR I add constraints files for napari test dependencies and
workflow to perform every week update of dependencies.

The motivation for this PR is to avoid regular failures not related to
PR context but caused by some dependency release.

Also, this PR will provide dependency versions on which napari works
during release time.

This PR is inspired by workflow from PartSeg that example output could
be found here 4DNucleome/PartSeg#932 (but here
is not listening all updated dependencies)

This PR will require adding `GHA_TOKEN` to repository secrets with the
following permissions:


![obraz](https://user-images.githubusercontent.com/3826210/233028398-daa24aeb-3af9-455d-b8c4-b722a3c0d413.png)


# References
<!-- What resources, documentation, and guides were used in the creation
of this PR? -->

## Type of change
<!-- Please delete options that are not relevant. -->
- [ ] Bug-fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [ ] example: the test suite for my feature covers cases x, y, and z
- [ ] example: all tests pass with my change
- [ ] example: I check if my changes works with both PySide and PyQt
backends
      as there are small differences between the two Qt bindings.  

## Final checklist:
- [ ] My PR is the minimum possible work for the desired functionality
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] If I included new strings, I have used `trans.` to make them
localizable.
For more information see our [translations
guide](https://napari.org/developers/translations.html).

---------

Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Czaki added a commit that referenced this pull request Jun 21, 2023
Path to `check_updated_packages.py` was set incorrectly
in #5715. This fixes the path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Continuous integration dependencies Pull requests that update a dependency file maintenance PR with maintance changes, task tests Something related to our tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants