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

TyPython path can't update in new python envs #13

Open
songjhaha opened this issue Aug 10, 2022 · 2 comments
Open

TyPython path can't update in new python envs #13

songjhaha opened this issue Aug 10, 2022 · 2 comments

Comments

@songjhaha
Copy link
Member

If we have install jnumpy in python environment envA and exec jnumpy.init_jl() once, we will add TyPython path in our default project Manifest.toml. But if we create a new python environment and install new version jnumpy, the old one still work so the path in Manifest.toml would not update.

Maybe we should use different default Julia environments in every different python environments?

def get_project_args():
default_envs_dir = os.path.join(get_jnumpy_dir(), "envs/default")
return f"--project={default_envs_dir}"

@thautwarm
Copy link
Member

thautwarm commented Aug 10, 2022

This problem can be split into the following two parts:

  • the package TyPython referenced in the a Manifest.toml (of a Python package made by JNumPy) might change,but so far we cannot detect such changes.

  • suppose we succeed in detecting the changes, how could we support separation of environments when something like venv is used.

thautwarm added a commit that referenced this issue Aug 10, 2022
1. Cleanup: remove pydantic and toml
2. Use interpreted Julia to speed up some resolution
3. Managed to distinguish the correctness of a project's
   TyPython dependency. (partially address #13)
thautwarm added a commit that referenced this issue Aug 10, 2022
* remove redundant init

* fix typo of ORM

* improve initialization

* further improve initialization:
1. Cleanup: remove pydantic and toml
2. Use interpreted Julia to speed up some resolution
3. Managed to distinguish the correctness of a project's
   TyPython dependency. (partially address #13)

* lazy annotations

* remove unused deps

* when julia exits the first, Python should know things are dead.

* try support 1.6
@songjhaha
Copy link
Member Author

songjhaha commented Sep 2, 2022

It's seems that we didn't check the path of package TyPython changes here if the old path is still valid?

jnumpy/jnumpy/init.py

Lines 161 to 167 in 4ddd6e8

exec_julia(
f"""
import Pkg
Pkg.activate({escape_to_julia_rawstr(default_project_dir)}, io=devnull)
include({escape_to_julia_rawstr(InitTools_path)})
""",
use_gil=False,

ps: #44 uses default environment in path/to/package/jnumpy/JNumPyEnv, so the path of TyPython is always the same one in package jnumpy

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