mapeditor / mapeditor/tiled

Modernize Python bindings

Open
#2,190 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
C++
Stars
12.9k
Forks
2k
Avg merge
4h 27m
Merged PRs (30d)
8

Description

The current Python plugin relies on a [large amount of generated code](https://github.com/bjorn/tiled/blob/master/src/plugins/python/pythonbind.cpp) based on the somewhat hard to maintain and always incomplete [`tiledbinding.py`](https://github.com/bjorn/tiled/blob/master/src/plugins/python/tiledbinding.py) and [`qtbinding.py`](https://github.com/bjorn/tiled/blob/master/src/plugins/python/qtbinding.py).

I've recently learned about [pybind11](https://github.com/pybind/pybind11) (see also [this blog post](https://skebanga.github.io/embedded-python-pybind11/)), which seems like a much nicer way of binding the classes to Python. The bindings are defined with similar verbosity, but directly in C++ which makes it easier to keep up-to-date.

In addition, pybind11 provides a more convenient way of interfacing with an embedded Python interpreter than using the Python API directly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/plugins/python/pythonbind.cpp and the generated tiledbinding.py and qtbinding.py files to understand the current bindings. Evaluate replacing that generated layer with pybind11-based C++ bindings and its embedded-interpreter interface; done means the Python plugin remains usable without the incomplete generated bindings.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
devtools
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.