-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move test data for local_import into folder * Add apkg import option * Install dev-requirements in gha * Update python version to 3.9 * Run mypy without arguments in gha * Add zstandard_wheels to repo * Remove support for new apkg format * Undo change to __init__ file * Add comment * chore: reorganize requirements * chore: add build script, edit readme * chore: comment out not wokring test * chore: remove todo comments * chore: update checks GHA * chore: fix build script * chore: Add note about running tests to readme * perf: Dont create zipfile for every file in zip * ref: Refactor tests * Check for media file conflicts in background
- Loading branch information
1 parent
7a1a5b8
commit 2c8b6da
Showing
20 changed files
with
479 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
It may not be possible to delete the add-on during runtime. | ||
In that case, you will need to open the addon directory by clicking 'View Files', | ||
close Anki, and manually delete the addon directory. | ||
|
||
# Development | ||
|
||
Run the following code to install all required packages | ||
## Installing packages needed for development | ||
```bash | ||
pip install -r dev-requirements.txt | ||
``` | ||
|
||
## Building the add-on | ||
```bash | ||
python scripts/build.py | ||
``` | ||
|
||
## Type checking | ||
You need to build the add-on first: | ||
```bash | ||
pip install --no-deps --target=./src/media_import/libs -r requirements.txt | ||
python scripts/build.py | ||
``` | ||
|
||
Run the following code to get a list of packages to add to requirements.txt | ||
Then you can run mypy: | ||
```bash | ||
mypy | ||
``` | ||
|
||
## Tests | ||
You need to build the add-on first: | ||
```bash | ||
pip install --target=./temp/libs <package_name> | ||
pip freeze --path=./temp/libs > temp_reqs.txt | ||
python scripts/build.py | ||
``` | ||
|
||
Then you can run pytest: | ||
```bash | ||
python -m pytest tests | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
-r requirements.txt | ||
|
||
git+https://github.com/andrewsanchez/[email protected] | ||
anki==2.1.56 | ||
aqt==2.1.56 | ||
|
||
pyqt5==5.15.5 | ||
pyqt5-qt5==5.15.2 | ||
pyqtwebengine==5.15.5 | ||
pyqtwebengine-qt5==5.15.2 | ||
pyaes==1.6.1 | ||
types-requests==2.31.0.1 | ||
|
||
git+https://github.com/ankipalace/pytest-anki.git | ||
mypy==0.971 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
[mypy] | ||
files = src/media_import, tests | ||
no_strict_optional = True | ||
disallow_untyped_defs = True | ||
exclude = (?:src/media_import/libs/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from pathlib import Path | ||
|
||
import _aqt | ||
import anki | ||
import subprocess | ||
|
||
|
||
def vendor_requirements(): | ||
"""Install requirements into the src/media_import/libs directory.""" | ||
subprocess.run( | ||
[ | ||
"python", | ||
"-m", | ||
"pip", | ||
"install", | ||
"--no-deps", | ||
"--target=./src/media_import/libs", | ||
"--upgrade", | ||
"-r", | ||
"requirements.txt", | ||
], | ||
check=True, | ||
) | ||
|
||
def create_init_file(module): | ||
module_path = Path(module.__path__[0]) | ||
init_file_path = module_path / "__init__.py" | ||
init_file_path.touch(exist_ok=True) | ||
|
||
|
||
if __name__ == "__main__": | ||
vendor_requirements() | ||
|
||
# This makes mypy type checking work on Anki versions >= 2.1.55 | ||
create_init_file(anki) | ||
create_init_file(_aqt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.