Skip to main content

Python bindings for the crate twmap

Project description

TwMap Python Module

Safely parse, edit and save Teeworlds and DDNet maps - in Python!

See the Rust library twmap for details on the wrapped library.

Installation

Simply do pip install twmap!

Usage

The help function is your friend! Once you imported twmap, do help(twmap.Map) to access the documentation of the Map struct. It also contains important general knowledge about the module.

To load your first map, do map = twmap.Map(path-to-map). To see the attributes and documentation about an object... help helps you!

For example, have a look into help(map.groups) and help(map.groups[0]). The first one will give you methods on the group collection and the second one attributes and methods on group objects. If you are confused about something in the module, the general information in help(twmap.Map) might help you.

Manual Building (on Linux)

You need Rust installed on your system. To compile twmap in release mode, execute the following command in the source root:

cargo build --release

Locate the file target/release/libtwmap.so. This file is only importable under twmap.so. Symlink or copy it to your desired location.

Publishing Steps

These steps are the ones I use to upload new versions of twmap-py to pypi.

Linux:

  1. podman pull ghcr.io/pyo3/maturin
  2. podman run --rm -v $(pwd):/io ghcr.io/pyo3/maturin publish -f --username 'USER' --password 'PASS'

Cross-compiling to Windows:

  1. Cargo.toml: switch the pyo3 dependency line
  2. Download the latest Python 3.7 "Windows x86-64 embeddable zip file" from https://www.python.org/downloads/windows/. Last used: https://www.python.org/ftp/python/3.7.9/python-3.7.9-embed-amd64.zip
  3. Unzip in project root
  4. RUSTFLAGS='-C target-feature=+crt-static' PYO3_CROSS_LIB_DIR='./python-3.7.9-embed-amd64' maturin publish --target x86_64-pc-windows-gnu (replace the dir path if another version is used)
  5. Enter pypi credentials interactively

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

twmap-0.4.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

twmap-0.4.3-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

twmap-0.4.3-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

twmap-0.4.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

twmap-0.4.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

twmap-0.4.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

twmap-0.4.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

twmap-0.4.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

twmap-0.4.3-cp37-abi3-win_amd64.whl (5.0 MB view hashes)

Uploaded CPython 3.7+ Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page