- edited description
Port to Python 3
Need to port to Python 3 this year (2019) - support for 2.7 drops at the start of 2020.
No longer any blocking dependencies - django-pagination
no longer being used, django-qsstats-magic
has been upgraded to support Python 3, and presumably django-solo
has too.
No point attempting to support Python 2.7 and Python 3 simultaneously - all users will need to go through the pain of the upgrade, we may as well go through it together! Also, targeting Django 2.2 which only supports Python 3.5 to 3.7.
Using:
Comments (104)
-
reporter -
Seems that the fix for django-qsstats-magic is very simple:
http://github.com/kmike/django-qsstats-magic/pull/3/commits/61bbe5e45adad16323ce83c0f5c6beabd903bc68
I've just messaged the author of django-qsstats-magic to ask if he'll update the package with the fix.
-
reporter Attempted to change all dicom imports to pydicom. Refs
#404,#530→ <<cset 46f8ef095fd3>>
-
reporter Set tox to install pydicom 1.0.0a1 and edited pynetdicom from github when testing. Refs
#404,#530→ <<cset a902622e5de0>>
-
reporter Removing -e from pip install. Hoping it fixes pipeline egg request! Refs
#404,#530→ <<cset 929856ec22ff>>
-
reporter - changed milestone to Future
Not going to happen for 0.8.0
-
reporter Adding python 2 only to setup as per Python 2 to 3 porting guide. Refs
#404→ <<cset dc9582a6e157>>
-
reporter Automatic futurize porting of qrscu.py to work with 2 and 3. Passes tests. Refs
#404→ <<cset ed426d587df3>>
-
reporter Ported qr tests. Refs
#404→ <<cset d2180cdc762e>>
-
reporter Adding future to requirements, hopefully will allow tests to run... Refs
#404→ <<cset 2f385508bef8>>
-
reporter Futurized all the other tests. A few PEP8 changes whist there. Refs
#404→ <<cset df81e5f4cdf3>>
-
reporter Futurized tools. Refs
#404→ <<cset ec595249819f>>
-
reporter Futurized exports. Refs
#404→ <<cset 128579ba1261>>
-
reporter Futurized extractors. Refs
#404→ <<cset 32924ae296a1>>
-
reporter Futurized interface. Refs
#404→ <<cset da47128ea435>>
-
reporter Futurized forms, models and fields. Refs
#404→ <<cset c08a91b1fb0b>>
-
reporter - edited description
-
reporter Didn't futurize the rest of netdicom previously. Now done. Refs
#404→ <<cset c57259dcaa4a>>
-
reporter Extractor files have remapp/Django setup stuff at top, doesn't need to be duplicated, doesn't need to import file that was upsetting futurize. Refs
#404→ <<cset 1a4b694e72ad>>
-
reporter Removing redundant extractors/openrem_settings.py, plus three very old csv extractors that wouldn't work with the current code. Refs
#404→ <<cset 9fe5e5728fd8>>
-
reporter Adding in missing blank lines from codacy report. Refs
#404[skip ci]→ <<cset 623c134bbcfd>>
-
reporter Disabling pylint warnings regarding overriding builtins due to future. Refs
#404Should be possible with a single config line in pylint, but I'm not sure how to do it in Codacy!→ <<cset 827ba5240239>>
-
reporter Addressing some of the issues not related to this PR but have triggered Codacy... Refs
#404→ <<cset f0dff6f7c6df>>
-
reporter Removed unnecessary import sys. Added some unnecessary docstrings to Meta classes. Refs
#404→ <<cset 6c3a338aa4a5>>
-
reporter Adding ref
#404to changes→ <<cset e4edeb3de3ad>>
-
reporter Merged in issue404python3 (pull request #289)
Refs
#404but more work to do for that issue.→ <<cset 56b4497f05fc>>
-
reporter Incidental: Added proper exception type to user profile test. Sort of refs
#404→ <<cset b5c6b05d763c>>
-
reporter Converted CT Filtered Study List page to use built-in pagination, with extra styling and functionality from https://gist.github.com/sumitlni/4f308e5999d2d4d8cb284fea7bf0309c Refs
#404→ <<cset 31dbd7c281f9>>
-
reporter @dplatten @LuukO - can you take a quick look at http://testing.openrem.org/openrem/ct/ please?
I've replaced the
django-pagination
function with the in-built Django pagination function, plus some styling from a gist I came across.What do you think? We need to stop using django-pagination to move onto newer versions of Django and Python. And it isn't required anymore anyway!
Also, David, the charts on that page are blank for me - am I doing something wrong?
-
reporter I think I'll probably reduce the number of 'neighbours' down from the current 10 to about 5.
-
reporter Added doc strings to satisfy Codacy. Also reduced neighbours to 5 each side. Refs
#404→ <<cset 295a9be5cf93>>
-
@edmcdonagh That looks fine for me!
-
reporter @dplatten - Both displaynameview.html and rfalertnotificationsview.html have
{% paginate %}
tags in them, but they don't have the{% autopaginate object_list %}
tags in them, so I don't think the pagination has ever functioned. I can't see how it would function for the display names page!Question - do I just remove the tags (I think functionality stays as is), or do I fix them up, or maybe just the RF Alert Notifications page so that they paginate using the new method?
-
reporter Added paginate to filteredbase template, removed old paginate from templates, added to views for dx, rf, mg. Reformatted filteredbase template.. Refs
#404→ <<cset 48840a72ac1e>>
-
reporter Forgot to change the list name. Refs
#404→ <<cset ce63e7253ac1>>
-
reporter Broke the home page as AnonymousUser has no user profile attribute. Elsewhere the user will be logged in, so should be ok... I think! Refs
#404→ <<cset c50ace87ed72>>
-
reporter @dplatten I have found that if 'plot a series per system' is ticked, the charts are empty. They are fine otherwise.
Have I broken something?
-
@edmcdonagh, I've been looking at the same thing (in the PHE CT export branch). I have fixed the problem by changing a couple of lines of code in the charting functions. I'm not sure what has caused the break.
-
reporter Removing paginate tags that didn't work anyway. Refs
#404→ <<cset 7dc3f4379428>>
-
reporter Removing django-pagination from settings.py. Refs
#404→ <<cset 54045e020f02>>
-
reporter Removed django-pagination from requirements. Hoorah! One fewer Python 2 only dependency :-) Refs
#404→ <<cset 11e12d6a5b18>>
-
reporter Merged in issue404python3 (pull request #301)
Refs
#404Issue remains open for further changes.
→ <<cset a929141eecc8>>
-
reporter - changed milestone to 1.0.0
Setting milestone to 1.0.0. Need to crack on with this now for the next release after 0.10
-
reporter - edited description
- changed title to Port to Python 3
Updated Description to reflect new status of https://caniusepython3.com/project/OpenREM
-
reporter - edited description
Updated Description to indicate that we can’t support Python 2 and 3 simultaneously as we’ll be targeting Django 2.2.
-
reporter Changing imports to work with Python 3. Refs
#404[skip ci] as known to fail→ <<cset 536645a38b9b>>
-
reporter Imports for local_settings in Python3. Refs
#404[skip ci] not ready for tests→ <<cset f8b7536c4993>>
-
reporter Filter views now display, f.queryset instead of f in paginator, but filter doesn't display. MethodFilter replaced with CharFilter(method=. Refs
#404,#437[skip ci] not ready for tests→ <<cset debb9f7bb725>>
-
reporter Basic working implementation of the DX filter. Refs
#404,#437[skip ci] not ready for tests→ <<cset bd6d2abe6edd>>
-
reporter Starting to reinstate and update DXSummaryListFilter. Age gt not currently working. Might continue upgrade to later Django and version 2 of django_filter before attempting to fix. Refs
#404,#437[skip ci] not ready for tests→ <<cset 8bc5408c2776>>
-
reporter Global replace of lookup_type with lookup_expr to ease updating filters. Refs
#437,#404[skip ci] not ready for testing→ <<cset f895a07a0357>>
-
reporter Minor change to template to get number of studies. Refs
#437,#404[skip ci] not ready for testing→ <<cset edcdc6b8b358>>
-
reporter DX summary filtered page now working with all filters except age with django_filters 1.1, Python 3.6, Django 1.8. Need to repeat for other modalities, then move onto Django 1.9 I think. Refs
#437,#404[skip ci] not ready for testing→ <<cset 05dc823484a9>>
-
reporter Fixing patient name matching refs
#404,#777[skip ci] not for testing yet→ <<cset d7a5da425e1c>>
-
reporter Starting to fix up the CT filters. Refs
#404,#437[skip ci] not for testing yet→ <<cset 092117015d0f>>
-
reporter max_events is Decimal, Python 3 can't treat this as an int... Refs
#404[skip ci] - not ready for testing→ <<cset 8cb05b977569>>
-
reporter Commented out requirements so OpenREM could be 'installed' in this env without old list of packages. Refs
#404[skip ci] - not ready for testing→ <<cset ab8a179c68f5>>
-
reporter Code meaning now needs to be explicit for some reason, plus other Python 2/3 string related changes. mammo csv export tests now work. Refs
#404[skip ci] - not ready for testing→ <<cset e7b442b522f5>>
-
reporter Got test export rf xlsx working. Issue was needing to add
.code_meaning
. Refs#404[skip ci] - not ready for testing→ <<cset 70faa85ea2b8>>
-
reporter Enables PersonName3 values to be listed in a string as per P2. Refs
#404[skip ci] - not ready for testing→ <<cset 3d79d01eeebd>>
-
reporter 'UN' VRs are now read in as byte strings, so need decoding before conversion to Decimal. Must be better method with newer pydicom. Refs
#404[skip ci] - not ready for testing→ <<cset 54cc4ca7594e>>
-
reporter Fixed mistake in mod_filters for CT, updated tests with new filter names. Refs
#404,#437[skip ci] - not ready for testing→ <<cset 48368f33f9d6>>
-
reporter Fixing display_name filtered links from homepage, code_meaning changes to rfdetail. Refs
#404,#437[skip ci] - not ready for testing→ <<cset 96b66d099bc9>>
-
reporter CodeMeaning changes, this time for mgdetail. Refs
#404[skip ci] - not ready for testing→ <<cset afc354ea3011>>
-
reporter Corrected filter arg, switched from reverse_lazy to reverse due to https://code.djangoproject.com/ticket/18776. Refs
#404,#437[skip ci] - not ready for testing→ <<cset 0b6571067cf9>>
-
reporter Added decode for byte reading of name, changed rdsr to use pydicom to be consistent with DX. Refs
#404[skip ci] - not ready for testing→ <<cset 118f51ba84af>>
-
reporter Convert to int for range. Refs
#404[skip ci] - not ready for testing→ <<cset d43e4d2b8ed7>>
-
reporter Not sure why some mam image values are bytes that need decoding before casting to Decimal, others are float or int. Hence try:except:. Also corrected mod_filters test and reverse_lazy. refs
#404,#437[skip ci] - not ready for testing→ <<cset cdf71f122dc2>>
-
reporter Change to reflect rounding of filter thickness. Second test currently failing. refs
#404,#437[skip ci] - not ready for testing→ <<cset 565ee038c1a5>>
-
reporter Now deals with Kodak comma thicknesses with pydicom 1+. Could be neater, old _fix_kodak_filters probably now redundant. Refs
#404,#777[skip ci] docs only.→ <<cset c0eb6aed36b8>>
-
reporter Fixing filter name and another reverse/lazy. Refs
#404,#437[skip ci] docs only.→ <<cset c4e64a0670db>>
-
reporter More reverse/lazy. Refs
#404[skip ci] docs only.→ <<cset 0cecf2c6da9b>>
-
reporter Appears that names read from DICOM are byte strings, so reflecting that in test. Need to investigate more thoroughly with pydicom. Refs
#404,#777[skip ci] docs only.→ <<cset 2f8c35cd6eda>>
-
reporter Improving name handling. No more byte strings. Attempt to replicate original_string in unicode. Refs
#404,#777[skip ci] docs only.→ <<cset fcebef195389>>
-
reporter Changed method of handling Kodak comma multival thicknesses. fix_kodak still redundant probably. Refs
#404,#777[skip ci] docs only.→ <<cset e33790720df4>>
-
reporter Need to encode unicode strings before using hashlib, but fixed as hash strings from Python 2 so we know pre/post upgrade hashes will match. Refs
#404[skip ci] docs only.→ <<cset 21a7340f9f9d>>
-
reporter Fix call to rdsr.rdsr, another reverse/lazy. Down to 2 failures 3 errors... Refs
#404[skip ci] Not ready for testing (not just docs!)→ <<cset 9e9ee000c37e>>
-
reporter pydicom doesn't raise ValueError, get TypeError instead as list. Refs
#404,#777[skip ci] Not ready for testing→ <<cset 51f62be01187>>
-
reporter Tests find the root by going up until no init.py is found. There shouldn't be an init.py at the same level as manage.py. Refs
#404[skip ci] Not ready for testing→ <<cset fbcd0f28566e>>
-
reporter Specified ordering, now works. Refs
#404[skip ci] Not ready for testing→ <<cset 8d72a84f94d8>>
-
reporter Disabled pynetdicom testing for now. All other tests pass. Need to work out Python 3 testing rig on bitbucket. Refs
#404,#777,#457,#530[skip ci] Not ready for testing. Next task - move to Django 1.9...→ <<cset e13fda4c134e>>
-
reporter Attempt to run tests on bitbucket with Python 3.6, Django 1.8. Refs
#404,#457→ <<cset 42b14ccd9830>>
-
reporter Hadn't copied changes to local_settings to the example. Refs
#404,#457→ <<cset 068a4e43c735>>
-
reporter Pipeline failed during coverage due to 025 that looked like an invalid (for Py3) octal. Sourcecode suggests it should be 25 int. Also stopped imports from complaining. Refs
#404→ <<cset df0a0a3fe8ba>>
-
reporter Django 1.9, added new --parallel switch to test. Refs
#404,#457→ <<cset 8d917f24870f>>
-
reporter Attempt to use postgres in pipeline. Refs
#404→ <<cset a881e28f8baf>>
-
reporter Correcting syntax to allow for colon in text. Refs
#404→ <<cset d22c053a04f3>>
-
reporter Missed the input file. Refs
#404→ <<cset 6239e89e7ba0>>
-
reporter Search was too broad, caught ALLOWED_HOSTS. Refs
#404→ <<cset be67740a90e0>>
-
reporter Wrongly set hostname to test_user_password! Refs
#404→ <<cset 513655fc36bd>>
-
reporter See if setting host and port explicitly fixes it Refs
#404→ <<cset 9397d6f1928b>>
-
reporter Attempting to allow access to postgres - not convinced this is the right thing to do. Refs
#404→ <<cset d7e2d27d47d4>>
-
reporter Adding explicit user/pass/db instead. Refs
#404→ <<cset a6313d04a63f>>
-
reporter Want to check if makemigrations completes. Refs
#404→ <<cset e6c8e14de357>>
-
reporter Issue is Django 1.9 evaluating urls.py before doing the migrations. Refs
#404→ <<cset b188145fb062>>
-
reporter See if this moves the pipeline on further... Refs
#404,#457→ <<cset 6236b8c99966>>
-
reporter SkinDOseCalcSettings not required, so removed. Need to sort out default ordering for filtered pages next. Refs
#404,#457→ <<cset 4c7398796724>>
-
reporter Changed everything from dicom to pydicom. Attempted to remove all byte warnings - elements with VR UN are imported as bytes. Existing db data might be bytes too. Refs
#457,#404,#777→ <<cset 6bd11d6314da>>
-
reporter Correcting error in urls, attempting to ignore importing from local_settings without using them. Refs
#404,#457→ <<cset d9ff394bf127>>
-
reporter - changed status to resolved
Merged in p3django2.2 (pull request #337)
Update develop to Python 3, Django 2.2
Refs
#530, fixes#404,#437,#457,#777→ <<cset 1fc70f28f05e>>
-
reporter Adding changes that should have been made in pull request #337 / commit 1fc70f2. Refs
#404,#437,#457,#777. Also ref#787added to CHANGES. [skip ci] docs only→ <<cset 6fea154d0fe2>>
-
Great work @Ed McDonagh ! I’ll try to get it running in my test (pre-production) environment.
Just a remark to have it noted somewhere.
Python 3.7 introduces the reserved word async (https://docs.python.org/3/whatsnew/3.7.html). This is a breaking change and will break celery 3 as the underlying kombu library uses the word “async” as a package. This is fixed in newer versions used by celery 4, but celery 4 is not supporting Windows anymore. So we need to rethink eventually: or to keep using celery or to support Windows (both at the same time will eventually become impossible). For now: stick to Python 3.6
-
reporter Thanks Luuk. That’s really frustrating! Are there any alternatives for Windows?
Would you mind creating an issue to track how we handle this?
-
reporter Actually Luuk, don’t worry, I’ll do it. There are a couple of things I want to note!
- Log in to comment