Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
N neoppod
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1
    • Issues 1
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • nexedi
  • neoppod
  • Merge requests
  • !24

Open
Created Jun 12, 2024 by Carlos Ramos Carreño@vnmabusDeveloper
  • Report abuse
Report abuse

Allow importing from Python 3.

  • Overview 0
  • Commits 1
  • Changes 17

Do the necessary changes so that the main module can be imported inside a Python 3 project without errors. Note that the project will still not work in Python 3, but a project that imports NEO unconditionally and does not use it in Python 3, such as wendelin.core, won't have problems.

The changes here are mostly:

  • Replacing old-style excepts (except Exception, e:) with the new syntax (except Exception as e:), compatible with both Python 2 and
  • Removing calls to @apply and replacing them by an explicit call to the class/method.
  • Using six for some modules that were renamed (e.g. thread is now _thread), as well as some renamed methods iteritems is now items.
  • Replacing raise with a tuple of two elements with the appropriate call to the exception constructor.
  • Using six for achieving a reraise with an existing traceback, as the old system (raising a tuple of three elements) cannot be used in Python 3.
  • I also changed the requires_extra for tests to include all other extras as intended, because the way it was being done did not work for me.

The changes are intended to be as surgical and non-controversial as possible, in order to facilitate review and acceptance. I can try to achieve full compatibility with Python 3 in future MRs, if that is desired.

I ran the unittests locally in Python 2 and they seemed to work.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: feature/python3_import
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7