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

Fixing GitHub Actions #202

Merged
merged 13 commits into from
Sep 16, 2024
Merged

Conversation

jaketanderson
Copy link
Collaborator

This PR aims to get the lint, ci, and codeql workflows working properly. To do so, it was necessary to introduce logic into devtools/conda-envs/test_env.yaml that says if python 3.9 is being used, enforce jax and jaxlib <= 0.4.28. This is because jax above that version contains str | None type operations, which aren't supported below python 3.10.

Python 3.8 doesn't encounter this issue because it defaults to a jax version way older (~0.4.14) which doesn't contain those type operations (Instead, depending on the version, it will use Optional[str] or simply None as the type hint).

One small thing I noticed while making these changes:

install_requires=["numpy"],

Is including numpy here necessary? Commenting out this line doesn't cause errors for me.

This was done to prevent `TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'` being thrown by
Jax. It occurs because Python 3.9 and lower doesn't support the `str | None` syntax, but Jax>0.4.28 uses it.
See https://stackoverflow.com/questions/76712720/typeerror-unsupported-operand-types-for-type-and-nonetype
Why wouldn't we want the tests to honor dependencies the same way
an average user would during installation? This way the change made
in 2069f44 is actually respected and tests can work.
The location doesn't functionally matter as far as I can tell, but I like the idea
of keeping as many dependencies as possible confined to one file.
Copy link

codecov bot commented Sep 7, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Project coverage is 81.86%. Comparing base (affc777) to head (f0b31dc).
Report is 15 commits behind head on master.

Additional details and impacted files

@@ -56,7 +56,7 @@ jobs:
- name: Install package
shell: bash -l {0}
run: |
python -m pip install --no-deps .
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed --no-deps when I included the "python3.9 requires jax<=0.4.28" logic in this file. I moved the logic to devtools/conda-envs/test_env.yaml in 9ad2d31, but I opted to keep the removal of --no-deps. I don't think it really makes any difference either way, as the only dependency specified here is numpy and that specification seems to be redundant.

Copy link

Choose a reason for hiding this comment

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

Sounds good to me

@jaketanderson
Copy link
Collaborator Author

@slochower @jeff231li if either of you have time in the near future, could you please review this PR? I want to get tests up and running before I make a new release.

Copy link

@jset231 jset231 left a comment

Choose a reason for hiding this comment

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

Looks good to me =)

os: [macOS-latest, ubuntu-latest]
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
Copy link

Choose a reason for hiding this comment

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

Nice, I like that pAPRika is passing with versions 3.11 and 3.12. You can probably drop support for 3.8, but it's probably okay to leave it here for now.

@@ -56,7 +56,7 @@ jobs:
- name: Install package
shell: bash -l {0}
run: |
python -m pip install --no-deps .
Copy link

Choose a reason for hiding this comment

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

Sounds good to me

@@ -39,4 +39,5 @@ dependencies:
# Pip-only installs
- pip:
- codecov

- jax<=0.4.28; python_version == '3.9' # Since python<=3.9 doesn't support `str | None` syntax, pin jax to a version that uses `None` or `Optional[str]`
- jaxlib<=0.4.28; python_version == '3.9'
Copy link
Member

Choose a reason for hiding this comment

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

Neat, haven't seen this trick before (I guess it's unbounded when python != 3.9).

@jaketanderson jaketanderson merged commit c0e52bd into GilsonLabUCSD:master Sep 16, 2024
8 checks passed
@jaketanderson
Copy link
Collaborator Author

Thanks both!

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

Successfully merging this pull request may close these issues.

3 participants