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 typer command cannot run scripts that imports other scripts #869

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

atomiechen
Copy link

Issue

typer command cannot run a script which imports other scripts in the same directory, or in the subdirectory.

The original problem comes from tiangolo/typer-cli#142, and I still can reproduce this with typer version 0.12.3.

Changes I Made

  • add sys.path.append(str(state.file.parent)) before exec_module
  • add a test for this

You can check that the test won't pass without the modification of sys.path.

@svlandeg svlandeg added feature New feature, enhancement or request p3 labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature, enhancement or request p3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants