dalley has quit [Remote host closed the connection]
encukou has quit [*.net *.split]
encukou has joined #hpy
<antocuni> what is the PEP which specifies the filename extension for CPython C extensions?
<antocuni> like, if I compile 'foo' I get foo.cpython-38d-x86_64-linux-gnu.so
<antocuni> there is PEP 3149 but if I understand it correctly it specifies only the "cpython-38d" part, not the "x86_64-linux-gnu" part
<antocuni> I'm thinking about filename extensions for hpy
<antocuni> I think that pure universal should be called e.g.:
<antocuni> foo.hpy-1-x86_64-linux-gnu.so
<antocuni> and hybrid modoules probably something like this:
<antocuni> foo.hpy-1-cpython-38d-x86_64-linux-gnu.so
<antocuni> I would like to be able to use a "+", but I don't know if it causes problems on e.g. windows. E.g.:
<antocuni> hpy-1+cpython-38d
<antocuni> uhm, maybe I should as on discord :)
mattip has quit [Ping timeout: 252 seconds]
<fangerer> concerning Windows: I'm happy to try it out. I've setup a Windows 10 VM particularly for debugging HPy problems 🙂
mattip has joined #hpy
<antocuni> fangerer: thank you! What is the filename extension of a normal CPython C extension on windows?
<fangerer> give me a minute to boot the VM
<fangerer> So, on my Python 3.10.7 running on Windows 10 (64-bit): `sysconfig.get_config_var('EXT_SUFFIX') == '.cp310-win_amd64.pyd'`
<antocuni> so, completely different than linux
<antocuni> although it makes more sense because it seems more closely related to the name of the wheels
<antocuni> ah, I found a trick: if I go to e.g. https://pypi.org/project/psutil/#files I can download wheels for all platforms and look directly at the filenames
mattip has quit [Ping timeout: 264 seconds]
mattip has joined #hpy
<mattip> fangerer: pinging about https://github.com/hpyproject/hpy/pull/246
<fangerer> thanks for reminding; starting to review ...
<antocuni> uhm, on the other hand, if you use the stable abi you get foo.abi3.so, without the x86_64-linux-gnu part
<antocuni> so I'm tempted to use the following naming convention
<antocuni> foo.hpy1.so for pure universal
<antocuni> foo.hpy1-cp38.so for hybrid
<antocuni> where cp38 is the same tag as used in the wheels, not the one used by SOABI
<antocuni> since it seems that the SOABI filenames vary wildly between platforms and there is no real standard
<antocuni> fangerer: what is get_convig_var('SHLIB_SUFFIX') on windows? .pyd or .dll?
<fangerer> seems that this var does not exist; there is `sysconfig.get_config_var('SO')` which is the same as for `EXT_SUFFIX`
<antocuni> ok
<antocuni> what a mess
<antocuni> I suppose I can hardcode '.pyd' for win32 and be happy
<antocuni> does SOABI exists?
<fangerer> no
<antocuni> ok, I'll just use EXT_SUFFIX then :)
<antocuni> thanks
<antocuni> and what about graalpy? What is EXT_SUFFIX for it?
<fangerer> similar to CPython without stable ABI, we have (e.g. on Mac): `'.graalpy-38-native-x86_64-darwin.dylib'`
<fangerer> mattip: I've finished review for https://github.com/hpyproject/hpy/pull/246 . We need to update the PR since things changed on master in the meantime
<fangerer> I'll take care of it. I hope that I can finish it today. When exactly do you need it?
<antocuni> fangerer: and I suppose that the '-native' part is important, right?
<antocuni> it's annoyingly hard to find a generic way to parse it
<antocuni> because it seems that the number of "parts" separated by dashes is vastly different between cases, and you care about a different subset of those
<antocuni> pff
dalley has joined #hpy
<fangerer> yes, the `-native` part is specific to graalpy because we also have a managed mode
<antocuni> I gave up writing a generic parser and resorted to do a big if/elif 😅
<fangerer> 😄
<mattip> fangerer: it would be nice to have early next week, but
<fangerer> already on it; I think I can finish today
<mattip> it seems that these things get lost quickly, so today would be nice
<antocuni> I pushed my changes
<antocuni> fangerer (or any other graalpy dev): could you please check that this is doing something reasonable for graalpy?
<mattip> antocuni: am I confused? As I understand things, "hybrid" and "legacy" mode need to link to the python so, so they are not different from any python c-extension
<mattip> and should use sysconfig['SO'] always
<antocuni> no
<antocuni> hybrid is a .hpy.so which also links against Py_* symbols
<antocuni> but it has a HPy_Init* symbol
<antocuni> so must be loaded by hpy.universal.load()
<antocuni> we don't have any "legacy" mode
<antocuni> we have "cpython" mode which is what you say and indeed uses sysconfig['EXT_SUFFIX']
<fangerer> > fangerer (or any other graalpy dev): could you please check that this is doing something reasonable for graalpy?
<fangerer> will do but probably tomorrow; I need to run ...
<antocuni> sure, no hurry
<fangerer> mattip: just finished the porting examples PR; please give it a review https://github.com/hpyproject/hpy/pull/246
<fangerer> I'll be away for today; see you 👋
<antocuni> see you
<mattip> ok, why not use the same "platform tag" as the sysconfig["EXT_SUFFIX"] ? is the problem it is too hard to find this formula?
<antocuni> there is no good way to factor out the "platform tag" from EXT_SUFFIX
<antocuni> if you look at the examples, you see that the format is widely different
<antocuni> e.g. cpython/linux is very different thatn cpython/windows
<mattip> yes, but the different platforms are consistent with themselves. So you will need specific linux/macos/windows code to produce the platform tag
<antocuni> but yes, my first idea was to include the platform tag, i.e. to have .hpy0-x86_64-linux-gnu.so
<antocuni> but then I realized that CPython itself does something different for abi3, for which it just uses .abi3.so
<antocuni> so I wanted to do the same for hpy
<antocuni> mattip: do you think that my current solution is problematic in any way? Note that the filename is not very important, because it's always passed as an argument to hpy.universal.load()
<antocuni> e.g., until now it was called '.hpy.so' even ON WINDOWS and it worked 😅
<mattip> it only matters if the names might conflict
<mattip> if files from different versions are in the same directory
<antocuni> different versions of what?
<mattip> which in practice never happens
<mattip> of anything: python version + platform version + implementation
<antocuni> yes, I don't think this is a case that we want to handle honestly
<antocuni> and .abi3.so has the same "problem" so if it's fine for them, it's fine for us
* antocuni afk
<mattip> theoretically, abi3.so only needs to deal with platform version conflict, python version and implementation don't matter
<antocuni> same as .hpy0.so
<mattip> +1
<mattip> so it doesn't matter
<antocuni> yes I think so
<antocuni> thanks for the help :)
dalley has quit [Ping timeout: 264 seconds]
dalley has joined #hpy