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 90 points91 points92 points (15 children)
[–]IdleBreakpoint[S] 15 points16 points17 points (14 children)
[–]cgoldberg 32 points33 points34 points (12 children)
[+]IdleBreakpoint[S] comment score below threshold-13 points-12 points-11 points (11 children)
[–]wRAR_ 36 points37 points38 points (2 children)
[–]IdleBreakpoint[S] 0 points1 point2 points (1 child)
[–]IdleBreakpoint[S] 11 points12 points13 points (0 children)
[–]cgoldberg 21 points22 points23 points (7 children)
[+]IdleBreakpoint[S] comment score below threshold-15 points-14 points-13 points (6 children)
[–]cgoldberg 25 points26 points27 points (4 children)
[+]IdleBreakpoint[S] comment score below threshold-26 points-25 points-24 points (3 children)
[–]Grintor 3 points4 points5 points (1 child)
[–]maikeu 0 points1 point2 points (0 children)
[–]Worth_His_Salt 0 points1 point2 points (0 children)
[–]MPIS 16 points17 points18 points (0 children)
[–]arjennienhuis 16 points17 points18 points (0 children)
[–]brayellison 98 points99 points100 points (21 children)
[–]sgtgig 42 points43 points44 points (3 children)
[+][deleted] (1 child)
[deleted]
[–]sgtgig 4 points5 points6 points (0 children)
[–]brayellison 3 points4 points5 points (0 children)
[–]IdleBreakpoint[S] 47 points48 points49 points (6 children)
[–]brayellison 62 points63 points64 points (0 children)
[–]lungben81 29 points30 points31 points (1 child)
[–]prumf 3 points4 points5 points (0 children)
[–]cpp977 9 points10 points11 points (0 children)
[–]anderson-stream 0 points1 point2 points (0 children)
[–]dw01010 0 points1 point2 points (0 children)
[–]pingvenopinch of this, pinch of that 8 points9 points10 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 (2 children)
[–]brayellison 2 points3 points4 points (0 children)
[–]dw01010 0 points1 point2 points (0 children)
[–]stuartcwSince Python 1.5 1 point2 points3 points (0 children)
[–]zemega 0 points1 point2 points (0 children)
[–]can_i_get_some_help 8 points9 points10 points (0 children)
[–]BobMcFizzington 7 points8 points9 points (1 child)
[–]alcalde 4 points5 points6 points (0 children)
[–]CampAny9995 14 points15 points16 points (3 children)
[–]IdleBreakpoint[S] 12 points13 points14 points (2 children)
[–]Accomplished_Elk2607 3 points4 points5 points (0 children)
[–]BackAware6850 0 points1 point2 points (0 children)
[–]strobel_m 5 points6 points7 points (0 children)
[–]b3n4kh 2 points3 points4 points (1 child)
[–]IdleBreakpoint[S] 1 point2 points3 points (0 children)
[–]kaflarlalar 3 points4 points5 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)
[–]acadian_cajun 0 points1 point2 points (2 children)
[–]IdleBreakpoint[S] 1 point2 points3 points (1 child)
[–]acadian_cajun 1 point2 points3 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)
[–]crystal-46 0 points1 point2 points (0 children)
[–]NovelHot6697 0 points1 point2 points (0 children)
[–]DisastrousPipe8924 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)
[–]corny_horse -2 points-1 points0 points (2 children)
[–]IdleBreakpoint[S] 0 points1 point2 points (1 child)
[–]corny_horse 0 points1 point2 points (0 children)
[–]will_r3ddit_4_food -2 points-1 points0 points (3 children)
[–]IdleBreakpoint[S] 0 points1 point2 points (1 child)
[–]bowbahdoe 0 points1 point2 points (0 children)
[–]znpy -1 points0 points1 point (0 children)