Skip to content

Commit 7575fbd

Browse files
authored
Merge pull request #109 from djhoese/free-threading
2 parents 138b716 + e56d14b commit 7575fbd

4 files changed

Lines changed: 48 additions & 15 deletions

File tree

README.rst

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,38 @@ Build instructions (all platforms)
3131
To enable freetype, you need to build the library somewhere and
3232
make sure the `freetype-config` command is available on your PATH. The
3333
setup.py file will call `freetype-config --prefix` to locate
34-
all of the necessary libraries and headers.
34+
all of the necessary libraries and headers as part of installation.
3535

36-
3. Build.
36+
3. Build and Install
3737

38-
The library uses a standard setup.py file, and you can use all
39-
standard setup.py commands. I recommend the following steps::
38+
The library uses a standard setup.py file. Install the library
39+
using ``pip`` from the root of the aggdraw repository::
4040

41-
$ python setup.py build_ext -i
42-
$ python selftest.py
41+
$ python -m pip3 install .
42+
43+
Alternatively, it is possible to install the library in an "editable"
44+
manner where the python environment will point to the local development
45+
aggdraw directory.
46+
47+
::
4348

44-
(if you're lazy, you can skip the above and just install the
45-
library; setup.py will make sure the right stuff is built before
46-
it's installed).
49+
$ python -m pip3 install -e .
4750

48-
4. Install.
51+
However, since aggdraw depends on compiling extension code, it must be
52+
re-installed to re-build the extension.
4953

50-
If the selftest succeeds, you can install the library::
54+
4. Once aggdraw is installed run the tests::
5155

52-
$ python setup.py install
56+
$ python selftest.py
5357

5458
5. Enjoy!
5559

60+
Free-threading support
61+
----------------------
62+
63+
See the documentation site for current information for free-threading
64+
support: https://aggdraw.readthedocs.io/en/stable/
65+
5666
AGG2 License
5767
------------
5868

aggdraw.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,11 @@ aggdraw_init(void)
26942694
);
26952695

26962696
aggdraw_getcolor_obj = PyDict_GetItemString(g, "getcolor");
2697+
2698+
#ifdef Py_GIL_DISABLED
2699+
PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED);
2700+
#endif
2701+
26972702
return module;
26982703
}
26992704

doc/source/index.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ of date with the current version of the library. Original examples will be
1515
migrated as time is available (pull requests welcome).
1616

1717
Installation
18-
============
18+
------------
1919

2020
Aggdraw is available on Linux, OSX, and Windows. It can be installed from PyPI
2121
with pip:
@@ -30,8 +30,25 @@ Or from conda with the conda-forge channel:
3030
3131
conda install -c conda-forge aggdraw
3232
33+
Free-threading support
34+
----------------------
35+
36+
Basic free-threading compatibility has been enabled starting with the Python
37+
3.14 wheels of aggdraw 1.4.0. However, only the minimum steps have been taken
38+
to let Python 3.14's free-threaded build know that aggdraw could be used
39+
without the GIL. No additional locking or redesign of the library has been
40+
done.
41+
42+
Aggdraw itself should have no global state, but each individual object is free
43+
to have internal state. It is up to the user to limit interactions for an
44+
aggdraw object to a single thread or to protect against concurrent access
45+
using locks. Even with this in mind, free-threading support in aggdraw is
46+
extremely unstable and experimental. If you have a use case for aggdraw
47+
in a free-threading environment please file an issue on GitHub to describe
48+
your use case and how it is going.
49+
3350
API
34-
===
51+
---
3552

3653
.. automodule:: aggdraw
3754
:members:
@@ -40,7 +57,7 @@ API
4057

4158

4259
Indices and tables
43-
==================
60+
------------------
4461

4562
* :ref:`genindex`
4663
* :ref:`modindex`

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def _get_freetype_with_pkgconfig():
156156
"Development Status :: 4 - Beta",
157157
# "Development Status :: 5 - Production/Stable",
158158
"Topic :: Multimedia :: Graphics",
159+
"Programming Language :: Python :: Free Threading :: 1 - Unstable",
159160
],
160161
description=SUMMARY,
161162
download_url="http://www.effbot.org/downloads#aggdraw",

0 commit comments

Comments
 (0)