Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.

psdl is a package that wraps the excellent SDL2 module in an easy to use python interface.

Note that this project is still in its super early stages, theres lots of stuff still left to be wrapped.

Why PSDL?

You may be already knowing that there are many SDL wrappers out there, from stuff like PySDL2 to pygame. What makes PSDL different? Well, PSDL aims to be a wrapper “of right thickness”. There are some SDL wrappers that are too thin, and they expose the C-level details to python, which is not that elegant. Also, they directly copy the SDL API, which is un-pythonic. And there are SDL wrappers that are too thick, and they dont export the SDL API at all, they have their own API.

PSDL aims to export the SDL API as directly as possible, while also “pythonifying” it. Let us consider a typical SDL function that looks like SDL_SomeFunctionForSomething. PSDL will export it, by stripping the inital SDL_ (because python has namespaces, unlike C) and changing the style of the function name to something that looks more pythonic. The function will look like psdl.some_function_for_something from the PSDL side. Similarly, SDL constants are exported by just stripping the initial SDL_ part of it, SDL_SOME_CONSTANT becomes psdl.SOME_CONSTANT. While SDL provided enums, PSDL does not export the enums directly, it just exports the constants within it.

Coming to structures, PSDL does different stuff based on the context. Since C is not object oriented, you will find this style of coding commonly used in SDL.

SDL_someobj *obj;
SDL_CreateSomeObj(obj, someargs);
SDL_SomeMethod(obj, moreargs);
SDL_AnotherMethod(obj, args, moreargs);
SDL_DestroyObj(obj);

We can take advantage of python OOP, and psdl will export the samething like

::

obj = psdl.SomeObj(args) obj.some_method(moreargs) obj.another_method(args, moreargs)

Notice the naming convention adopted here. Also notice that in python, we need not explicitly deallocate objects, python being a high-level language, does that automatically for us.

Installation

psdl can be installed via pip, using the following command, pip3 install psdl. Note that currently, psdl does not provide binary “wheels” on PyPI, so the pip command will build psdl from source. For that, check out the section below

Building from source

Windows

The build process is pretty straight forward on windows. You just need to have the MSVC C compiler set up correctly. psdl is automatically going to get all its dependencies (ie, its gonna download SDL from the official website) and automatically build psdl.

Mac/Linux

On Mac/linux too, the build process aint complicated. All you need to have is a C compiler (which is usually present on most systems) and SDL installed via your package manager. Then psdl will easily install from source.

Advanced Build Options

You can set two environment variables, PSDL_INCLUDE_DIR and PSDL_LIB_DIR to optionally specify paths to SDL include and library directories, respectively. This will be used by PSDL when it attempts to build from source.

TODO

Theres still lot left to do, like I said earlier, this project is still in its super early stages. There needs to be docs, tests, and examples written, apart from the code that needs to be written.

Release files for psdl 0.0.1a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psdl 0.0.1a1
File Size Uploaded
psdl-0.0.1a1.tar.gz 15.1 kB Details

Release files / psdl-0.0.1a1.tar.gz

Download URL psdl-0.0.1a1.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7af63017de90672101c55cf87096432544c776cc9089f684d8160ae863d71abd
BLAKE2b-256 checksum
How to use checksums
f21f53f4f46f55e8a7bde6184ae43a5669da089ea756be7ac0be00f282c4792b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.0.1a1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page