Skip to content

[WIP] Fix cross-version: ABI tag-based precompilation cache directory#172

Closed
tkf wants to merge 2 commits into
JuliaPy:masterfrom
tkf:abi
Closed

[WIP] Fix cross-version: ABI tag-based precompilation cache directory#172
tkf wants to merge 2 commits into
JuliaPy:masterfrom
tkf:abi

Conversation

@tkf

@tkf tkf commented Jul 31, 2018

Copy link
Copy Markdown
Member

Here is an idea to fix cross-version capability of pyjulia. How about using Python ABI tag for separating compilation cache? In the current implementation, the cache directory uses only sys.version_info[0] (major version):

pyjulia/julia/core.py

Lines 359 to 360 in 18d98e5

self._call(u"unshift!(Base.LOAD_CACHE_PATH, abspath(Pkg.Dir._pkgroot()," +
"\"lib\", \"pyjulia%s-v$(VERSION.major).$(VERSION.minor)\"))" % sys.version_info[0])

It then doesn't work when switching between, e.g., 3.6 and 3.7.

With this patch, cache directory would be:

$ ls -1 ~/.julia/lib/
pyjulia.cp36m-v0.6
pyjulia.cp37m-v0.6
v0.6

Though I'm actually not sure if we should use the Python tag (e.g., cp37) instead of the ABI tag (e.g., cp37m). Would PyCall.jl create different precompilation cache if it is build against, say, debug build and normal build?

It is WIP until we resolve:

But the general idea seems to be fine; I can now use pyjulia with Python 3.6 and 3.7 with this patch.

Comment thread julia/core.py
# this is python 3.3 specific
from types import ModuleType, FunctionType

from setuptools.pep425tags import get_abi_tag

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good idea since this function is not setuptools's API. We should probably copy their function https://github.com/pypa/setuptools/blob/e0433cf32dfdf39c0c14a3740c3920c496f09486/setuptools/pep425tags.py#L81 if we want to use ABI tag. Alternatively, we can drop Python 2 support. In that case sysconfig.get_config_var('SOABI') would work (https://www.python.org/dev/peps/pep-3149/). Of course, if we don't need ABI, then we can just use sys.version_info.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and it fails in Windows because they don't have setuptools by default? https://ci.appveyor.com/project/Keno/pyjulia/build/1.0.98/job/kh23o578ngvjkysy#L89

@stevengj

Copy link
Copy Markdown
Member

Would PyCall.jl create different precompilation cache if it is build against, say, debug build and normal build?

No. PyCall's precompilation cache for pyjulia should only depend on the Python major version.

@tkf

tkf commented Jul 31, 2018

Copy link
Copy Markdown
Member Author

Hmm... Right, now I can't reproduce the bug I thought I fixed... Sorry for the noise.

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

Successfully merging this pull request may close these issues.

2 participants