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

Basic Support for Python 3 #827

Merged
merged 8 commits into from Jan 23, 2017
Merged

Basic Support for Python 3 #827

merged 8 commits into from Jan 23, 2017

Conversation

BeryJu
Copy link
Contributor

@BeryJu BeryJu commented Jan 21, 2017

Imports & everything else adjusted to python3, works with both python 2 and 3. Unit tests succeed for 2.7, 3.4, 3.5 and 3.6: https://travis-ci.org/BeryJu-org/netbox

@jeremystretch
Copy link
Member

This is great, thanks!

Django will bump up to 2.0 after 1.11, at which point support for Python 2 will cease. I'd like to continue supporting Python 2 until then to give users some time to transition. The documentation will need to be adjusted to reflect that both Python versions are supported.

Also, for settings.py, let's just use from netbox import configuration instead of repeating netbox.configuration so many times.

I'm still debating what to do about ldap_config.py: It would be nice to absorb it into configuration.py but there's an argument to be had for keeping it separate as well. At any rate, let's separate that change from this PR as it's not relevant to Python 3.

@BeryJu
Copy link
Contributor Author

BeryJu commented Jan 23, 2017

I also have to test this more on python 2 as I think using __str__ brakes the interface because python 2 wants __unicode__.

@jeremystretch
Copy link
Member

I think we need the python_2_unicode_compatible() decorator: https://docs.djangoproject.com/en/1.10/topics/python3/#str-and-unicode-methods

@BeryJu
Copy link
Contributor Author

BeryJu commented Jan 23, 2017

I was looking for something like python_2_unicode_compatible but didn't find anything. I have added to every model that defines a __str__ in a612012.

@jeremystretch
Copy link
Member

Looks good to me. FYI this is commit number 1000!

@jeremystretch jeremystretch merged commit 80439c4 into netbox-community:develop Jan 23, 2017
@jeremystretch jeremystretch mentioned this pull request Jan 26, 2017
lampwins pushed a commit to lampwins/netbox that referenced this pull request Oct 13, 2017
* Rudimentary python3 support

* update docs and trigger Travis

* fix some of the tests

* fix all python3 errors

* change env calls to just python

* add @python_2_unicode_compatible decorator to models for python2 compatibility

* switch netbox.configuration to from netbox import configuration
@lock lock bot locked as resolved and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants