Skip to content

Building Python 2 and Python 3 support in parallel #18

Open

Description

@Conan-Kudo

Currently, it looks like Inline::Python can only be built for one or the other.

Would you consider making it so that it can be built to provide Python 2 and Python 3 versions in one build?

I guess they would be Inline::Python2 and Inline::Python3, with all the equal capabilities of the original Inline::Python.

Activity

  1. marghidanu commented on Jul 7, 2017

    @marghidanu

    Use separate developments, something like local::lib. This way you can add multiple installations against different Python versions.

  2. Zer0-Tolerance commented on Jun 29, 2019

    @Zer0-Tolerance

    Hi,
    Got the same need, I need to run python2 & python3 code at the same time. And having 2 instance of Inline::Python one binded on python2 and the other on python3 but it doesn't work because I guess they are using the same namespace from the C library.

    Any idea how to build two different flavour ?

  3. niner commented on Jun 30, 2019

    @niner
    Owner

    There's just no way that Inline::Python could support Python 2 and Python 3 in the same program at the same time for the same reason that the switch to Python 3 requires you to upgrade all of your program including all libraries to Python 3. The Python interpreter uses the same symbol names (i.e. functions) in both versions and the linker gets confused by that.

    There would actually have been a way for them to work around this: run Python 2 and Python 3 in different processes and forward calls and data over some kind of IPC mechanism. That's really not that different from how Inline::Python works (or Inline::Perl5 for example). If you really need to use both Python versions in a program, you could do the same.

    As for supporting both Python version in a single build, that would certainly be possible. It would probably not even be all that hard. But it would be a major refactor of the build system and would require restructuring of the code, i.e. just a lot of work. I would definitely support someone doing this and be happy to take pull requests. Considering the existing workarounds (like local::lib) I just don't see this ever making it up far enough on my TODO list for me to do this all on my own. That we have Python 3 at all was due to the great work of @Imazuel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions