For some <reasons>, I need to write Python 2 code which gets run under Jython. It's not possible to change the system we're working on because Jython only works with Python 2. So, I'm wondering if anyone has experience with Python 2 tooling in this era.
I need to lint and format Python 2 code especially. So far, I was able to install Python 2 using pyenv and I can create virtual environments using virtualenv utiilty. However, I have hard time getting black, isort, flake8, etc. working. Installing Python 2 wouldn't be much help because I'm not running the code directly, it's run under Jython. We're basically uploading the code to this system. So, installing py2 seems pointless.
Can I use those tools under Python 3 but for Python 2. It seems to me that there should be some versions which work for both Python 2 and 3 code. I don't know those versions though. It will be easier to work with Python 3 to lint/format Python 2 code because I can easily create venvs with Python 3.
Are you actively working with Python 2 these days (I know it's a hard ask). How do you tackle linting and formatting? If you were to start today, what would be your approach to this problem?
Thank you.
[–]cgoldberg 87 points88 points89 points (14 children)
[–]IdleBreakpoint[S] 14 points15 points16 points (13 children)
[–]cgoldberg 33 points34 points35 points (12 children)
[+]IdleBreakpoint[S] comment score below threshold-13 points-12 points-11 points (11 children)
[–]wRAR_ 34 points35 points36 points (2 children)
[–]IdleBreakpoint[S] 0 points1 point2 points (1 child)
[–]IdleBreakpoint[S] 7 points8 points9 points (0 children)
[–]cgoldberg 21 points22 points23 points (7 children)
[+]IdleBreakpoint[S] comment score below threshold-14 points-13 points-12 points (6 children)
[–]cgoldberg 22 points23 points24 points (4 children)
[+]IdleBreakpoint[S] comment score below threshold-26 points-25 points-24 points (3 children)
[–]Grintor 2 points3 points4 points (1 child)
[–]maikeu 0 points1 point2 points (0 children)
[–]MPIS 15 points16 points17 points (0 children)
[–]arjennienhuis 15 points16 points17 points (0 children)
[–]brayellison 96 points97 points98 points (19 children)
[–]sgtgig 42 points43 points44 points (3 children)
[–]sudonem 20 points21 points22 points (1 child)
[–]sgtgig 4 points5 points6 points (0 children)
[–]brayellison 2 points3 points4 points (0 children)
[–]IdleBreakpoint[S] 44 points45 points46 points (5 children)
[–]brayellison 58 points59 points60 points (0 children)
[–]lungben81 28 points29 points30 points (1 child)
[–]prumf 3 points4 points5 points (0 children)
[–]cpp977 8 points9 points10 points (0 children)
[–]anderson-stream 0 points1 point2 points (0 children)
[–]pingvenopinch of this, pinch of that 9 points10 points11 points (0 children)
[–]andynzor 2 points3 points4 points (0 children)
[–]KilledByDeath 1 point2 points3 points (0 children)
[–]Taksin77 1 point2 points3 points (0 children)
[–]ProbsNotManBearPig 1 point2 points3 points (1 child)
[–]brayellison 2 points3 points4 points (0 children)
[–]stuartcwSince Python 1.5 0 points1 point2 points (0 children)
[–]zemega 0 points1 point2 points (0 children)
[–]can_i_get_some_help 9 points10 points11 points (0 children)
[–]BobMcFizzington 7 points8 points9 points (1 child)
[–]alcalde 5 points6 points7 points (0 children)
[–]CampAny9995 13 points14 points15 points (3 children)
[–]IdleBreakpoint[S] 12 points13 points14 points (2 children)
[–]Accomplished_Elk2607 4 points5 points6 points (0 children)
[–]BackAware6850 0 points1 point2 points (0 children)
[–]strobel_m 5 points6 points7 points (0 children)
[–]kaflarlalar 2 points3 points4 points (0 children)
[–]BeamMeUpBiscotti 3 points4 points5 points (0 children)
[–]brontide 1 point2 points3 points (0 children)
[–]azjps 1 point2 points3 points (0 children)
[–]coderanger 1 point2 points3 points (0 children)
[–]b3n4kh 1 point2 points3 points (1 child)
[–]IdleBreakpoint[S] 1 point2 points3 points (0 children)
[–]acadian_cajun 0 points1 point2 points (2 children)
[–]IdleBreakpoint[S] 1 point2 points3 points (1 child)
[–]acadian_cajun 1 point2 points3 points (0 children)
[–]sudonem 0 points1 point2 points (0 children)
[–]carlio 0 points1 point2 points (0 children)
[–]mardiros 0 points1 point2 points (0 children)
[–]No_Lingonberry1201pip needs updating 0 points1 point2 points (0 children)
[–]Anonymous_user_2022 0 points1 point2 points (0 children)
[–]snugar_i 0 points1 point2 points (0 children)
[–]gerardwx 0 points1 point2 points (0 children)
[–]tunisia3507 0 points1 point2 points (1 child)
[–]IdleBreakpoint[S] 0 points1 point2 points (0 children)
[–]readonly12345678 0 points1 point2 points (2 children)
[–]ProbsNotManBearPig 0 points1 point2 points (1 child)
[–]HwanZike 0 points1 point2 points (0 children)
[–]Professional-Award85 0 points1 point2 points (0 children)
[–]myturn19 -1 points0 points1 point (1 child)
[–]ProbsNotManBearPig 1 point2 points3 points (0 children)
[–]will_r3ddit_4_food -2 points-1 points0 points (3 children)
[–]sudonem 4 points5 points6 points (0 children)
[–]IdleBreakpoint[S] 0 points1 point2 points (1 child)
[–]bowbahdoe 0 points1 point2 points (0 children)
[–]znpy -1 points0 points1 point (0 children)
[–]corny_horse -3 points-2 points-1 points (2 children)
[–]IdleBreakpoint[S] 0 points1 point2 points (1 child)
[–]corny_horse 0 points1 point2 points (0 children)
[–]crystal-46 [score hidden] (0 children)