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

Fix reading resource when packaged in zip #170

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hukkin
Copy link
Contributor

@hukkin hukkin commented Feb 1, 2025

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.

Copy link

codecov bot commented Feb 1, 2025

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 91.40%. Comparing base (75a819a) to head (6833324).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/em/cli.py 85.71% 2 Missing ⚠️
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     
Flag Coverage Δ
macos-latest 89.84% <86.66%> (-1.43%) ⬇️
ubuntu-latest 89.84% <86.66%> (-1.43%) ⬇️
windows-latest 89.84% <86.66%> (-1.43%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hugovk hugovk added the changelog: Fixed For any bug fixes label Feb 4, 2025
@@ -71,6 +71,12 @@ repos:
exclude: ^src/em/emoji.*\.json$
exclude_types: [yaml]

- repo: https://github.com/pre-commit/mirrors-mypy
Copy link
Owner

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]
Copy link
Owner

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:

Suggested change
from em import _version # type: ignore[attr-defined]
from em import _version

Copy link
Contributor Author

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).

rev: v1.14.1
hooks:
- id: mypy
files: '^src/em/'
Copy link
Owner

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/?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: Fixed For any bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A probable bug with zip imports
2 participants