-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fix reading resource when packaged in zip #170
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #170 +/- ##
==========================================
- Coverage 92.85% 91.40% -1.46%
==========================================
Files 3 3
Lines 126 128 +2
==========================================
Hits 117 117
- Misses 9 11 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
.pre-commit-config.yaml
Outdated
@@ -71,6 +71,12 @@ repos: | |||
exclude: ^src/em/emoji.*\.json$ | |||
exclude_types: [yaml] | |||
|
|||
- repo: https://github.com/pre-commit/mirrors-mypy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please could you move this before pyproject-fmt? Just because that's where it is in some of my other projects and it makes it easier to diff and compare.
Let's bump the other repos whilst we're here: pre-commit autoupdate --jobs 0
@@ -15,6 +15,6 @@ | |||
|
|||
from __future__ import annotations | |||
|
|||
from em import _version | |||
from em import _version # type: ignore[attr-defined] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed? It passes for me without it:
from em import _version # type: ignore[attr-defined] | |
from em import _version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a mypy failure in CI without it.
The _version.py
file is created dynamically by hatch-vcs
. It doesn't exist until the package is built, so before that mypy will fail (without the type: ignore
).
.pre-commit-config.yaml
Outdated
rev: v1.14.1 | ||
hooks: | ||
- id: mypy | ||
files: '^src/em/' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's include tests/
too, perhaps by removing files:
and excluding scripts/
?
Fixes #169
I was unsure of the
Traversable
type's API, so I checked types with mypy, and made small changes to make it pass. Those changes are also included, but I can remove or separate those changes if that's better.