Skip to content

Install typing_extensions if needed #98

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

Merged
merged 5 commits into from
Jan 28, 2025

Conversation

aphedges
Copy link
Collaborator

I discovered a bug where importing from typing_extensions would fail because it's not listed as a dependency. Until now, I've always had typing_extensions installed as a dependency of another package, so it took a while to encounter this particular bug.

As part of this PR, I fixed the test setup so I could verify my changes don't break anything.

@aphedges aphedges added the bug Something isn't working label Jan 26, 2025
@aphedges aphedges requested a review from mjspeck January 26, 2025 00:15
@aphedges aphedges self-assigned this Jan 26, 2025
I copied multiple improvements from `chiron-utils`'s GitHub Actions
setup to this file:

- Enable running on pushes, which makes testing CI changes easier
- Remove all GitHub API permissions for security
- Cancel running CI job if a change is pushed
- Update used actions to non-deprecated versions
- Factor out Python version for easier reuse
- Use stricter configuration for shell to catch more bugs

Improvements copied from
https://github.com/ALLAN-DIP/chiron-utils/blob/3a795038e73a7099dd9012c2480df7d35f74e05e/.github/workflows/checks.yaml
CI was broken because `ubuntu-latest` changed from Ubuntu 22.04 to
24.04, and the latter doesn't have Python 3.7. I pinned to using Ubuntu
22.04 so we can continue using Python 3.7.

In addition, I pinned to the specific Python 3.7 patch release to limit
possible breakage.
This commit contains multiple related changes:

- Update `dev` dependencies as much as possible
  - The pinned versions did not work with Python 3.11, but using the
    latest versions does not work with Python 3.7. The new versions work
    for both Python 3.7 and 3.11.
- Pin `black` and `isort` versions
  - Unlike the other `dev` dependencies, which are specified with `==`,
    these two dependencies were specified with `>=`. I pinned these to
    specific versions to match the other dependencies and limit
    breakage.
- Update `pip` in `test-pr.yml`
  - The version of `pip` shipped in GitHub Actions shows warnings that
    are fixed by upgrading to the latest supported version.
The `typing_extensions` module was imported but not listed as a
requirement, so importing `daidepp` failed if `typing_extensions` wasn't
installed for another reason.

I have added it as an explicit requirement and only use it if `Literal`
or `get_args` cannot be imported directly from the `typing` module.
@aphedges aphedges force-pushed the install-typing_extensions branch from 9016ce6 to 8636323 Compare January 26, 2025 00:42
@aphedges
Copy link
Collaborator Author

It turns out that the test-pr CI workflow broke since the previous PR was made! I included commits to fix the workflow and to otherwise improve it.

@aphedges
Copy link
Collaborator Author

@mjspeck, do you want to review this PR, or should I just go ahead and merge it?

@mjspeck
Copy link
Collaborator

mjspeck commented Jan 27, 2025

@aphedges reviewing now

@aphedges aphedges requested a review from mjspeck January 28, 2025 00:05
@aphedges
Copy link
Collaborator Author

@aphedges reviewing now

Thanks! I've made the requested changes.

Copy link
Collaborator

@mjspeck mjspeck left a comment

Choose a reason for hiding this comment

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

LGTM. Merge when ready.

@aphedges aphedges merged commit b9107d8 into SHADE-AI:main Jan 28, 2025
1 check passed
@aphedges aphedges mentioned this pull request Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants