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

Repository restructure to fix mypy issues? #22

Open
ahlec opened this issue Oct 16, 2022 · 1 comment
Open

Repository restructure to fix mypy issues? #22

ahlec opened this issue Oct 16, 2022 · 1 comment

Comments

@ahlec
Copy link
Collaborator

ahlec commented Oct 16, 2022

I ran into one unfixable issue with mypy . while working on #21.

mypy is confused with our directory structure + unit tests. Both reading.py and utils.py show a mypy error, because they are imported by __init__.py as .reading, but are imported by the unit tests as reading. I wasn't able to fix this without reorganizing the repository. I think we would need something like this:

/anki_furigana
  __init__.py    // ← Anki entry point
  reading.py
  utils.py
/tests
  test_reading.py
  test_util.py
README

In order to fix the problem. Without adding more variables to python3 -m unittest, I wasn't able to use relative imports from /tests into the repository root; and without the relative imports, the plugin doesn't work when loaded by Anki.

I wanted to speak with you about this/get your thoughts before I opened a proposal PR that tried out this change.

@obynio
Copy link
Owner

obynio commented Oct 20, 2022

I don't have strong opinion on the project structure. It's a small project and your architecture proposal seems fine. I'm not using mypy personally, but if you think you would be more confortable with this structure you can go ahead if you like 👍

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

No branches or pull requests

2 participants