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

Tests #14

Draft
wants to merge 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6ea2151
checkpoint: much fewer errors
nienna73 Mar 6, 2023
82c4ba5
remove: old migrations, replaced with one
nienna73 Mar 7, 2023
b17eded
checkpoint: tests still not running
nienna73 Mar 7, 2023
d74cd73
Merge branch 'main' of github.com:UAlbertaALTLab/morphodict-backend i…
nienna73 Mar 7, 2023
783081d
checkpoint: no progress
nienna73 Mar 7, 2023
4c72071
Merge branch 'main' of github.com:UAlbertaALTLab/morphodict-backend i…
nienna73 Mar 9, 2023
20b6e74
Merge branch 'main' of github.com:UAlbertaALTLab/morphodict-backend i…
nienna73 Mar 29, 2023
aa2b908
try: uncomment dependency on tests
nienna73 Mar 29, 2023
7b068b4
fix: pages weren't rendering good
nienna73 Mar 29, 2023
87a27d5
add: temp test workflow
nienna73 Mar 29, 2023
cd21f1b
try: remove nb-black
nienna73 Mar 29, 2023
4a9b6ee
remove: temp test workflow
nienna73 Mar 29, 2023
b416e69
restore: admin.register
nienna73 Mar 29, 2023
ff96de9
add: install mypy stubs
nienna73 Mar 29, 2023
a440e36
fix: call to mypy
nienna73 Mar 29, 2023
7cc18f5
add: non-interactive flag
nienna73 Mar 29, 2023
492eb0f
remove: install libraries
nienna73 Mar 29, 2023
b7adde2
Merge branch 'main' of github.com:UAlbertaALTLab/morphodict-backend i…
nienna73 Mar 30, 2023
00357f9
try: type ignore, should have 6 fewer errors
nienna73 Mar 30, 2023
530ed5b
add: type ignore
nienna73 Apr 3, 2023
0f85693
add: type ignore
nienna73 Apr 3, 2023
7f42e7f
add: mypy ini
nienna73 Apr 4, 2023
4f59f0d
Revert "try: type ignore, should have 6 fewer errors"
nienna73 Apr 4, 2023
714b27e
add: so many type: ignore
nienna73 Apr 4, 2023
200e257
working on tests
nienna73 Apr 4, 2023
9731017
Merge branch 'main' of github.com:UAlbertaALTLab/morphodict-backend i…
nienna73 Apr 4, 2023
597d6e1
remove: prefix to import
nienna73 Apr 4, 2023
c2cfda5
more type: ignore
nienna73 Apr 4, 2023
b0ff020
still working on tests
nienna73 Apr 4, 2023
8d3a5f6
more type: ignore
nienna73 Apr 4, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on: [ push, pull_request ]
env:
# Version required to run itwêwina:
ACTIONS_PYTHON_VERSION: 3.9
# Version required to run npm build:
ACTIONS_NODE_VERSION: 14

jobs:
# Skips deploy if [skip deploy] is present in the commit message
Expand Down Expand Up @@ -94,11 +92,6 @@ jobs:
id: setup-python
with:
python-version: ${{ env.ACTIONS_PYTHON_VERSION }}
- name: Setup Node ${{ env.ACTIONS_NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.ACTIONS_NODE_VERSION }}
cache: npm
- name: 🖥 Install system dependencies
run: sudo apt-get install -y libfoma0 libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
- name: ☤ Install pipenv
Expand Down Expand Up @@ -129,8 +122,8 @@ jobs:

needs:
- should-deploy
# - unit-test
# - integration-test
- unit-test
- integration-test

if: needs.should-deploy.outputs.should-run == 'true'

Expand Down
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ mypy = "*"
pytest-env = "*"
jupyterlab = "*"
appnope = "*"
nb_black = "*"
statsmodels = "*"
pandas-stubs = "*"
pytest-pythonpath = "*"
Expand Down
1,053 changes: 474 additions & 579 deletions Pipfile.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions arpeng-manage
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Command-line utility for administrative tasks.
"""

import os
import sys
from pathlib import Path
import os # type: ignore
import sys # type: ignore
from pathlib import Path # type: ignore

# sys.path[0] is initialized to the directory containing the script, which
# isn’t right for our purposes.
Expand All @@ -14,6 +14,6 @@ sys.path[0] = os.fspath(Path(sys.path[0]) / "src")
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "arpeng.site.settings")

from django.core.management import execute_from_command_line
from django.core.management import execute_from_command_line # type: ignore

execute_from_command_line(sys.argv)
8 changes: 4 additions & 4 deletions crkeng-manage
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Command-line utility for administrative tasks.
"""

import os
import sys
from pathlib import Path
import os # type: ignore
import sys # type: ignore
from pathlib import Path # type: ignore

# sys.path[0] is initialized to the directory containing the script, which
# isn’t right for our purposes.
Expand All @@ -14,6 +14,6 @@ sys.path[0] = os.fspath(Path(sys.path[0]) / "src")
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "crkeng.site.settings")

from django.core.management import execute_from_command_line
from django.core.management import execute_from_command_line # type: ignore

execute_from_command_line(sys.argv)
8 changes: 4 additions & 4 deletions cwdeng-manage
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Command-line utility for administrative tasks.
"""

import os
import sys
from pathlib import Path
import os # type: ignore
import sys # type: ignore
from pathlib import Path # type: ignore

# sys.path[0] is initialized to the directory containing the script, which
# isn’t right for our purposes.
Expand All @@ -14,6 +14,6 @@ sys.path[0] = os.fspath(Path(sys.path[0]) / "src")
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cwdeng.site.settings")

from django.core.management import execute_from_command_line
from django.core.management import execute_from_command_line # type: ignore

execute_from_command_line(sys.argv)
10 changes: 5 additions & 5 deletions docker/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

# This script is called by the deploy.altlab.dev webhook

import os
from argparse import ArgumentParser
from pathlib import Path
from subprocess import check_call
import os # type: ignore
from argparse import ArgumentParser # type: ignore
from pathlib import Path # type: ignore
from subprocess import check_call # type: ignore


def main():
Expand All @@ -25,7 +25,7 @@ def main():
# The rest of the deploy is separated out into a different script that is
# only loaded *after* the git pull. Otherwise we’d be running some old
# version of the script from a commit that is not the one being deployed.
import inner_deploy
import inner_deploy # type: ignore

inner_deploy.run(call=call)

Expand Down
18 changes: 9 additions & 9 deletions docker/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
# the YAML files point at the right places because they are both created by code
# that ultimately gets their location from the same variable.

import argparse
import itertools
import subprocess
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
from os import fspath, execvp, chdir

from helpers.settings import DOCKER_COMPOSE_DIR, APPS
from helpers.setup import do_setup
from helpers.yaml import make_yaml
import argparse # type: ignore
import itertools # type: ignore
import subprocess # type: ignore
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter # type: ignore
from os import fspath, execvp, chdir # type: ignore

from helpers.settings import DOCKER_COMPOSE_DIR, APPS # type: ignore
from helpers.setup import do_setup # type: ignore
from helpers.yaml import make_yaml # type: ignore


def main():
Expand Down
4 changes: 2 additions & 2 deletions docker/helpers/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os.path
from pathlib import Path
import os.path # type: ignore
from pathlib import Path # type: ignore


class App:
Expand Down
4 changes: 2 additions & 2 deletions docker/helpers/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path
from pathlib import Path # type: ignore

from .app import App
from .app import App # type: ignore

# The directory containing the docker-compose file
DOCKER_COMPOSE_DIR = Path(__file__).parent.parent
Expand Down
16 changes: 8 additions & 8 deletions docker/helpers/setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import re
from os import chmod, fspath, getuid
from pathlib import Path
from pwd import getpwuid
from shutil import chown
from subprocess import check_call

from .settings import APPS, DOCKER_COMPOSE_DIR
import re # type: ignore
from os import chmod, fspath, getuid # type: ignore
from pathlib import Path # type: ignore
from pwd import getpwuid # type: ignore
from shutil import chown # type: ignore
from subprocess import check_call # type: ignore

from .settings import APPS, DOCKER_COMPOSE_DIR # type: ignore

# Note the extra g+s bit. inode(7) says, “for that directory: files
# created there inherit their group ID from the directory, not from
Expand Down
8 changes: 4 additions & 4 deletions hdneng-manage
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Command-line utility for administrative tasks.
"""

import os
import sys
from pathlib import Path
import os # type: ignore
import sys # type: ignore
from pathlib import Path # type: ignore

# sys.path[0] is initialized to the directory containing the script, which
# isn’t right for our purposes.
Expand All @@ -14,6 +14,6 @@ sys.path[0] = os.fspath(Path(sys.path[0]) / "src")
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hdneng.site.settings")

from django.core.management import execute_from_command_line
from django.core.management import execute_from_command_line # type: ignore

execute_from_command_line(sys.argv)
70 changes: 70 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[mypy]

[mypy-CreeDictionary.API.migrations.*]
# Skip checking Django-auto-generated migration code
ignore_errors = True

[mypy-morphodict.lexicon.migrations.*]
# Skip checking Django-auto-generated migration code
ignore_errors = True

# External packages that we haven’t set up types for

[mypy-Levenshtein.*]
ignore_missing_imports = True

[mypy-colorama.*]
ignore_missing_imports = True

[mypy-cree_sro_syllabics.*]
ignore_missing_imports = True

[mypy-dawg.*]
ignore_missing_imports = True

[mypy-debug_toolbar.*]
ignore_missing_imports = True

[mypy-gensim.*]
ignore_missing_imports = True

[mypy-numpy.*]
ignore_missing_imports = True

[mypy-sortedcontainers.*]
ignore_missing_imports = True

[mypy-django.*]
# https://github.com/typeddjango/django-stubs exists, but attempts to use
# it were fiddly enough that it didn’t seem worth the hassle
#
# https://groups.google.com/g/django-developers/c/C_Phs05kL1Q/discussion
# “Technical Board statement on type hints for Django”, 2020-04-14:
# “It is the view of the Django Technical Board that inline type
# annotations should not be added to Django at the current time … the
# barrier for further inline changes will be high.”
ignore_missing_imports = True

[mypy-django_js_reverse.*]
ignore_missing_imports = True

[mypy-foma.*]
ignore_missing_imports = True

[mypy-snowballstemmer.*]
ignore_missing_imports = True

[mypy-pytest_django.*]
ignore_missing_imports = True

[mypy-environs.*]
ignore_missing_imports = True

[mypy-secure.*]
ignore_missing_imports = True

[mypy-setuptools.*]
ignore_missing_imports = True

[mypy-tqdm.*]
ignore_missing_imports = True
14 changes: 7 additions & 7 deletions src/API/apps.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging
import os
import logging # type: ignore
import os # type: ignore

from django.apps import AppConfig
from django.conf import settings
from django.apps import AppConfig # type: ignore
from django.conf import settings # type: ignore

import cvd
import cvd # type: ignore

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -32,8 +32,8 @@ def ready(self) -> None:
self.perform_time_consuming_initializations()

def perform_time_consuming_initializations(self):
from API.search import affix
from lexicon.models import wordform_cache
from API.search import affix # type: ignore
from lexicon.models import wordform_cache # type: ignore

logger.debug("preloading caches")
affix.cache.preload()
Expand Down
4 changes: 2 additions & 2 deletions src/API/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 2.2.15 on 2020-10-07 02:43

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models # type: ignore
import django.db.models.deletion # type: ignore


class Migration(migrations.Migration):
Expand Down
4 changes: 2 additions & 2 deletions src/API/migrations/0002_definition_auto_translation_source.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 2.2.18 on 2021-02-26 22:39

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models # type: ignore
import django.db.models.deletion # type: ignore


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion src/API/migrations/0003_wordform_indexes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 2.2.18 on 2021-03-18 18:01

from django.db import migrations, models
from django.db import migrations, models # type: ignore


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion src/API/migrations/0004_more_wordform_indexes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2 on 2021-04-14 23:15

from django.db import migrations, models
from django.db import migrations, models # type: ignore


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion src/API/migrations/0005_wordform_paradigm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2 on 2021-05-07 16:57

from django.db import migrations, models
from django.db import migrations, models # type: ignore


class Migration(migrations.Migration):
Expand Down
2 changes: 1 addition & 1 deletion src/API/migrations/0006_drop_api_tables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.db import migrations
from django.db import migrations # type: ignore


class Migration(migrations.Migration):
Expand Down
6 changes: 3 additions & 3 deletions src/API/schema.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
this file contains `TypedDict` classes that effectively serves as json schema for serialized objects
"""
from typing import List, Optional, Sequence, Tuple, Union
from typing import List, Optional, Sequence, Tuple, Union # type: ignore

from typing_extensions import Literal, TypedDict
from typing_extensions import Literal, TypedDict # type: ignore

from morphodict_types import FSTTag
from morphodict_types import FSTTag # type: ignore


class SerializedDefinition(TypedDict):
Expand Down
2 changes: 1 addition & 1 deletion src/API/search/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .runner import search
from .runner import search # type: ignore


def search_with_affixes(
Expand Down
Loading