roedoejet / g2p

Grapheme-to-Phoneme transductions that preserve input and output indices, and support cross-lingual g2p!
https://g2p-studio.herokuapp.com
Other
119 stars 26 forks source link

Fix: allow running the app and tests from any directory #384

Closed joanise closed 1 week ago

joanise commented 1 week ago

Two related fixed enabling running app.py from directories other than the root:

  1. fix(app): do not rely on running at the g2p root dir

Use g2p.file to locate g2p/static and g2p/templates, don't rely on finding them under the current working directory.

This allows us to run uvicorn g2p.app:APP --reload --port 5000 and the gunicorn production variant from anywhere, not just the g2p sandbox root.

This also allows us to run cd g2p; tests/run.py or cd g2p/tests; ./run.py, or ./test_api_resources.py, etc.

  1. refactor: rename types->shared_types to avoid collision

Running app.py from g2p/g2p, libraries load g2p.types instead of standard types and thus app.py was broken.

codecov[bot] commented 1 week ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 93.19%. Comparing base (077afc2) to head (a13d0f2).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #384 +/- ## ======================================= Coverage 93.18% 93.19% ======================================= Files 17 17 Lines 2437 2440 +3 Branches 544 544 ======================================= + Hits 2271 2274 +3 Misses 95 95 Partials 71 71 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 1 week ago
CLI load time: 0:00.05
PR head a13d0f215c5b8b4c4807b6cd8c562a7bc5612453
Imports that take more than 0.1 s:
import time: self [us] | cumulative | imported package