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

Modernize code for Python 3 #4

Merged
merged 40 commits into from Nov 27, 2013
Merged

Modernize code for Python 3 #4

merged 40 commits into from Nov 27, 2013

Conversation

dan-blanchard
Copy link
Contributor

This is a fairly substantial set of changes, but the main changes are:

  1. String attribute issues with Python 3 have all been resolved, and now each function that takes a string can handle unicode strings, and returns unicode strings.
  2. All code has been updated to use future imports for unicode_literals and print_function, so we're effectively writing Python 3 code now.
  3. PEP8 compliance changes all over the place, except those that would break names required by underlying C DRMAA library.
  4. Now automatically run unit tests of Travis-CI with SGE, and all tests pass for Python 2.6, 2.7, and 3.2. SGE is installed using scripts I describe in this gist.
  5. Unit tests are now in a top-level directory instead of a sub-directory under the drmaa package.
  6. There is now a session.py module that contains most of the code that was in __init__.py before, and __init__ just imports things and sets __all__ and __version__, as is typically recommended now.
  7. Drops support for Python 2.5.
  8. Bumps version up to 0.7.
  9. Removes setup.cfg.

When/if you merge this PR, please update the badge URL in README.rst to use drmaa-python/drmaa-python instead of dan-blanchard/drmaa-python. You'll also want to setup a free Travis-CI account and enable building for the main drmaa-python project.

dan-blanchard and others added 30 commits September 16, 2013 14:32
In Python 3 string literals are str, and not bytes, so `DictAttribute.__set___` would pass the wrong type of argument to the C functino `drmaa_set_vector_attribute`. This simple change encodes strings to bytes with the system default encoding. Since you can called `.encode()` on byte strings in Python 2.x without side-effect, this simple change should work with both.
Switch to using new style format strings instead of old ones.
… all functions that take strings take unicode strings.
@davidr
Copy link
Contributor

davidr commented Sep 19, 2013

I'll test this out over the next couple days. Thanks!
On Sep 17, 2013 8:54 PM, "Dan Blanchard" notifications@github.com wrote:

This is a fairly substantial set of changes, but the main changes are:

  1. String attribute issues with Python 3 have all been resolved, and
    now each function that takes a string can handle unicode strings, and
    returns unicode strings.
  2. All code has been updated to use future imports for
    unicode_literals and print_function, so we're effectively writing Python 3
    code now.
  3. PEP8 compliance changes all over the place, except those that would
    break names required by underlying C DRMAA library.
  4. Now automatically run unit tests of Travis-CI with SGE, and all
    tests pass for Python 2.6, 2.7, and 3.2. SGE is installed using scripts I
    describe in this gist https://gist.github.com/dan-blanchard/6586533
  5. Unit tests are now in a top-level directory instead of a
    sub-directory under the drmaa package.
  6. There is now a session.py module that contains most of the code
    that was in init.py before, and init just imports things and
    sets all and version, as is typically recommended now.
  7. Drops support for Python 2.5.
  8. Bumps version up to 0.7.
  9. Removes setup.cfg.

When/if you merge this PR, please update badge URL in README.rst to use
drmaa-python/drmaa-python instead of dan-blanchard/drmaa-python. You'll
also want to setup a free Travis-CI account and enable building for the

main drmaa-python project.

You can merge this Pull Request by running

git pull https://github.com/dan-blanchard/drmaa-python master

Or view, comment on, or merge it at:

#4
Commit Summary

  • Python 3 compatability fix
  • Merge pull request Python 3 compatibility and version 0.6 bump #1 from dan-blanchard/patch-1
  • Switch to using new style format strings instead of old ones.
  • Merge pull request Import Error #2 from dan-blanchard/patch-1
  • Made all constants explicit byte strings since they're frequently
    passed to C
  • Merge branch 'patch-1'
  • PEP8 fixes all over the place.
  • Yet another work around to work with Python 3.
  • Merge branch 'patch-1'
  • Fix missing import
  • Add .encode() to string_vector to get around the whole problem of
    needing to pass bytes in the first place.
  • Made .encodes conditional, in case someone explicitly passes bytes
    in Python 3
  • Massive amount of PEP8 compliance clean up.
  • More cleaning/refactoring. I believe I've now standardized it so
    that all functions that take strings take unicode strings.
  • Fix a NoneType issue with py_drmaa_init
  • Add Travis unit test stuff.
  • Added missing smp bit to pe_list line of queue_template.
  • Swap order of creating queue and parallel environment to fix crash.
  • Moved tests into separate directory and cleaned them up a bit.
  • Added missing import to testwrap.py
  • Added another missing import for testwrap.
  • Fix str typeerror in Python 3
  • Make sure boolean converter always converts things to bytes
  • Fix copy-paste error
  • Increase sleep time to 10 seconds when waiting for Grid Engine to
    start.
  • Added a little message about how we're waiting for the grid engine
    to come up in install_sge.sh.
  • Added another sleep to install_sge.sh to prevent synchronization
    issues
  • Made qstat output more verbose in install_sge.sh
  • Add Travis build badge to README
  • Restart execd in install_sge.sh just in case
  • Changed order of gridengine package installation to make sure master
    is up and running before exec gets installed
  • Broke apt-get install into two commands in install_sge.sh
  • Took out sleeps from install_sge.sh because splitting apt-get into
    two steps seems to solve those problems.

File Changes

Patch Links:

@dan-blanchard
Copy link
Contributor Author

Did you discover any issues with this?

@davidr
Copy link
Contributor

davidr commented Oct 27, 2013

Oh jeez. I did nothing with this. Many apologies. I'll take it up on Monday!

On Fri, Oct 25, 2013 at 9:46 AM, Dan Blanchard notifications@github.comwrote:

Did you discover any issues with this?


Reply to this email directly or view it on GitHubhttps://github.com//pull/4#issuecomment-27098148
.

@davidr
Copy link
Contributor

davidr commented Nov 1, 2013

Still looking, sorry for the delay. :)

@davidr
Copy link
Contributor

davidr commented Nov 1, 2013

You know, as I'm testing this out, it occurred to me that you've done far more work on drmaa-python than I have. Would you like to be added as a maintainer? (you don't have an email listed on your public profile, or I would have emailed it to you)

@dan-blanchard
Copy link
Contributor Author

Sure, I'd be happy to be a maintainer. After all that work I do feel a bit of an attachment to it. 😄

@dan-blanchard
Copy link
Contributor Author

Hello again. 😄

I just wanted to see how things with this are going. For some deployment things I'm working on, I'd prefer to be able to point to PyPI to install drmaa-python instead of my fork.

Thanks!

@dan-blanchard
Copy link
Contributor Author

Hello again,

Any progress on this front? I'm trying to create a conda recipe for drmaa to possibly get it added to the Anaconda distribution someday, but until this is merged, that's impossible (because it doesn't support Python 3).

Thanks,
Dan

@dan-blanchard
Copy link
Contributor Author

I understand that this doesn't appear to be a priority for you, but this is something I need available on PyPI, so unless I hear back in the next couple days, I'll just go ahead and create a new PyPI package called drmaa3k for this. I was hoping to avoid fragmentation like that, but I feel like that'll be a lot better for us both than me being a constant nag.

@davidr
Copy link
Contributor

davidr commented Nov 26, 2013

Heh. I'm really sorry about that. I was out of the country for a few weeks,
and the internet was not as good as I had hoped. You're very right to be
frustrated. We'll get this fixed up today. What's your pypi account again?

On Monday, November 25, 2013, Dan Blanchard wrote:

I understand that this doesn't appear to be a priority for you, but this
is something I need available on PyPI, so unless I hear back in the next
couple days, I'll just go ahead and create a new PyPI package called
drmaa3k for this. I was hoping to avoid fragmentation like that, but I
feel like that'll be a lot better for us both than me being a constant nag.


Reply to this email directly or view it on GitHubhttps://github.com//pull/4#issuecomment-29231008
.

@dan-blanchard
Copy link
Contributor Author

It's okay. I totally understand that sometimes life gets in the way. My PyPI username is Daniel.Blanchard.

@davidr
Copy link
Contributor

davidr commented Nov 27, 2013

I think everything is fixed now. Sorry again and welcome. May you continue
to shame me to do a better job. :)

On Tuesday, November 26, 2013, Dan Blanchard wrote:

It's okay. I totally understand that sometimes life gets in the way. My
PyPI username is Daniel.Blanchard.


Reply to this email directly or view it on GitHubhttps://github.com//pull/4#issuecomment-29296567
.

@dan-blanchard
Copy link
Contributor Author

Cool. Thanks for making me part of the team. Are you okay with me merging this and creating a new release on PyPI? I don't want to just come in and usurp things. 😄

@davidr
Copy link
Contributor

davidr commented Nov 27, 2013

Go for it! It seems to work for me. You won't do a worse job than me. :)

On Tuesday, November 26, 2013, Dan Blanchard wrote:

Cool. Thanks for making me part of the team. Are you okay with me merging
this and creating a new release on PyPI? I don't want to just come in and
usurp things. [image: 😄]


Reply to this email directly or view it on GitHubhttps://github.com//pull/4#issuecomment-29353810
.

dan-blanchard added a commit that referenced this pull request Nov 27, 2013
Modernize code for Python 3
@dan-blanchard dan-blanchard merged commit 47732e2 into pygridtools:master Nov 27, 2013
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.

None yet

2 participants