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

Python 3 #1

Open
jpopelka opened this issue Mar 7, 2016 · 15 comments
Open

Python 3 #1

jpopelka opened this issue Mar 7, 2016 · 15 comments

Comments

@jpopelka
Copy link

jpopelka commented Mar 7, 2016

any plans to port to Python 3 ?

I for example see:

python3 -c 'import redhawk.common.selector'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.4/site-packages/redhawk/common/selector.py", line 75, in <module>
    import _selector
ImportError: No module named '_selector'
@ncoghlan
Copy link
Contributor

ncoghlan commented Apr 6, 2016

I started work on an initial PR for Python 2/3 compatibility at ncoghlan@e924aec

The major changes in the initial patch are:

  • switching to explicit relative imports
  • using print as a function rather than as a statement
  • using the "exception as name" except clause syntax rather than "exception, name"
  • wrapping various builtins with "list" calls to preserve the Py2 behaviour of producing a list
  • using six.moves to cope with some standard library rearrangements

The modified implementation mostly passes "python setup.py test" under Python 3.4, but I haven't checked it for Python 2.6/7 compatibility yet. There are also a couple of test failures: test_c_declarations and test_c_expressions both fail to locate their "test_descriptions" file (and switching those lines to use os.path.join didn't make a difference).

@spranesh
Copy link
Owner

spranesh commented Apr 6, 2016

Wow, thanks, @ncoghlan! I had a preliminary peek and it looks good - I'd be happy to review and upstream it when you are done. Let me know if anything seems particularly hard or unwieldy - I'd be happy to help.

@spranesh
Copy link
Owner

spranesh commented Apr 6, 2016

@jpopelka: Thank you for filing an issue. Just to clarify, when you say port do you mean:

  1. Redhawk parses and queries python3 codebases.
  2. Or Redhawk source code should be python3 compatible?

@ncoghlan's change should address the latter, but not the former.

Right now, I don't have the bandwidth to work on adding Python3 support in the LAST. I suspect I can get around to this over the next quarter, but I cannot make a firm guarantee at this time.

I can provide pointers if that'd help. I'd be happy to review and accept patches!

@ncoghlan
Copy link
Contributor

ncoghlan commented Apr 7, 2016

This issue is specifically about getting Redhawk itself running on Python 3 (Jiri & I are working on the same project, and we're interested in running that on 3.4 or 3.5 instead of 2.7)

I filed #2 to cover eventually supporting the new syntactic constructs introduced in 3.3 and 3.5, but most of the code bases we're interested in analysing won't be using those new constructs yet.

@spranesh
Copy link
Owner

spranesh commented Apr 8, 2016

Thanks for clarifying and triaging!

@bkabrda
Copy link
Contributor

bkabrda commented Apr 21, 2016

Hi, so I pushed several commits to @ncoghlan's py3-compat branch. All the tests that pass for me on Python 2 now also pass on Python 3; there are however 31 tests (out of 234) that fail on both versions. I'm quite sure that the failures are the same in Python 2 and 3, so it seems I didn't break anything. Nick, feel free to review my commits and create a PR if you think this is good enough. @spranesh, feel free to review any time, I'd be glad for any comments/suggestions.

@ncoghlan
Copy link
Contributor

PR submitted: #3

@bkabrda GitHub was clever enough to migrate my and @jpopelka's comments on the initial python-modernize output from the fork, so you may want to look into those.

@bkabrda
Copy link
Contributor

bkabrda commented Apr 22, 2016

Thanks. I had a look and pushed one more commit that addresses the issues. The PR is ready to be reviewed by @spranesh

@bkabrda
Copy link
Contributor

bkabrda commented Apr 25, 2016

@spranesh sorry to bother you again, but could you please release a new Redhawk version on PyPI? It'd really help me. Now I need to install things from git by pip if I want Python 3 support which is not very nice - I would like to be able to install from PyPI with Python 3 support. Thanks!

@bkabrda
Copy link
Contributor

bkabrda commented May 11, 2016

@spranesh ping, any plans for releasing new version of Redhawk with Py3 support?

@spranesh
Copy link
Owner

Yes, I plan to do a release with your changes within the next week or two.

@jpopelka
Copy link
Author

jpopelka commented Aug 5, 2016

Hello @spranesh
It's been few weeks and we'd like to know what's your realistic estimation of the release date. Don't feel pressed - we just want to finish the porting of our project to Python 3 and need to decide whether to still wait for the release or start running redhawk from the repository. Thank you !

@spranesh
Copy link
Owner

spranesh commented Aug 5, 2016

Sorry for dropping the ball on this. Please expect a release by August 23rd (i.e, two weeks from now).

@spranesh spranesh closed this as completed Aug 5, 2016
@spranesh spranesh reopened this Aug 5, 2016
@ncoghlan
Copy link
Contributor

ncoghlan commented Aug 6, 2016

Not a problem! Thanks for setting a target date, though - while we've always had the option of installing 68a7400 directly from version control, we do consider it preferable to run on officially released versions of dependencies :)

@ncoghlan
Copy link
Contributor

The 1.2.3 release now includes experimental support for running on Python 3.

However, as noted in #2, additional work will be needed to analyse new Python 3 specific syntax, and @bkabrda indicated in #3 (comment) that there can be problems with analysing Python 2 only syntax when running on Python 3.

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

4 participants