Skip to content

Commit

Permalink
Python3.13 support (#241)
Browse files Browse the repository at this point in the history
* Update GitHub Actions workflows

* Remove Python 3.8 tests

* Updated Readme and added 3.13 to setup.py

+ Updated Readme, removed mentions to Python 3.5
+ Updated setup.py: Removed Python 3.8 and added Python 3.13
  • Loading branch information
Zuzu-Typ authored Oct 8, 2024
1 parent 5da78c8 commit b87c610
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 86 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/deploy-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: workflow_dispatch

env:
CIBW_BUILD: cp3*
CIBW_SKIP: cp36-* cp37-*
CIBW_SKIP: cp36-* cp37-* cp38-*
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest {project}/test/PyGLM_test.py -v

Expand All @@ -24,13 +24,13 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand All @@ -54,13 +54,13 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand Down Expand Up @@ -97,13 +97,13 @@ jobs:
if: ${{ matrix.arch != 'x86_64' && matrix.arch != 'i686' }}
uses: docker/setup-qemu-action@v3

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand Down Expand Up @@ -136,13 +136,13 @@ jobs:
if: ${{ matrix.arch != 'x86_64' && matrix.arch != 'i686' }}
uses: docker/setup-qemu-action@v3

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand All @@ -159,10 +159,10 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install build
run: pip install build
Expand Down
30 changes: 15 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

env:
CIBW_BUILD: cp3*
CIBW_SKIP: cp36-* cp37-*
CIBW_SKIP: cp36-* cp37-* cp38-*
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest {project}/test/PyGLM_test.py -v

Expand All @@ -27,13 +27,13 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand All @@ -57,13 +57,13 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand Down Expand Up @@ -100,13 +100,13 @@ jobs:
if: ${{ matrix.arch != 'x86_64' && matrix.arch != 'i686' }}
uses: docker/setup-qemu-action@v3

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand Down Expand Up @@ -139,13 +139,13 @@ jobs:
if: ${{ matrix.arch != 'x86_64' && matrix.arch != 'i686' }}
uses: docker/setup-qemu-action@v3

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
run: python -m pip install cibuildwheel==2.21.2

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
Expand All @@ -162,10 +162,10 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'
python-version: '3.13'

- name: Install build
run: pip install build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-rc.2"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
46 changes: 20 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ It has a lot of possible use cases, including **3D\-Graphics** \(OpenGL, DirectX
At the same time, it has **great performance**, usually being **a lot faster than numpy\!** \(see [end of page](#speed-comparison-to-numpy)\)
\(*depending on the individual function*\)
### Installation
**PyGLM** supports **Windows**, **Linux**, **MacOS** and other operating systems with either x86 \(**32\-bit**\) or x64 \(**64\-bit**\) architecture,
running **Python 3**\.5 or higher\. \(Prior versions of Python \- such as Python 2 \- were supported up to PyGLM version 0\.4\.8b1\)
**PyGLM** supports **Windows**, **Linux**, **MacOS** and other operating systems\.

It can be installed from the [PyPI](https://pypi.python.org/pypi/PyGLM) using [pip](https://pip.pypa.io/en/stable/):
``` batch
Expand Down Expand Up @@ -89,10 +88,10 @@ Supplying an id of 0 will silence all warnings\.
#### How to pass the matrices generated by PyGLM to OpenGL functions?
You will find an overview on the \[[Passing data to external libs](https://github.com/Zuzu-Typ/PyGLM/wiki/Passing-data-to-external-libs/)\] page\.

#### Types and functions are not available after installing from the PyPI using ``` pip install glm ```
Most likely you've installed [glm](https://pypi.org/project/glm/), a JSON parser and not [PyGLM](https://pypi.org/project/PyGLM/) \(or a very early version of PyGLM\)\.  
#### Types and functions are not available after installing from the PyPI using ``` pip install glm ```
Most likely you've installed [glm](https://pypi.org/project/glm/), a JSON parser and not [PyGLM](https://pypi.org/project/PyGLM/) \(or a very early version of PyGLM\)\.
The correct install command is:
```
``` batch
pip install PyGLM
```

Expand All @@ -101,11 +100,6 @@ I prefer not to add too many experimental extensions to PyGLM, especially as the
If you **need a specific experimental extension**, feel free to **submit a feature request** on the [issue tracker](https://github.com/Zuzu-Typ/PyGLM/issues)\.  
I try adding them on a one\-by\-one basis\.

#### Why are Python versions prior to 3\.5 no longer supported?
Starting with version [0\.5\.0b1](https://github.com/Zuzu-Typ/PyGLM/releases/tag/0.5.0b1) I decided to use C\+\+ to build PyGLM, using [glm](https://glm.g-truc.net/) under the hood \- which requires C\+\+ 11 or upwards\.  
Only Python versions 3\.5\+ support C\+\+ 11, thus I was forced to stop supporting older versions\.  
The last version to support Python 2 and <3\.5 is [0\.4\.8b1](https://github.com/Zuzu-Typ/PyGLM/releases/tag/0.4.8b1)\.

### Short example
``` Python
>>> import glm
Expand Down Expand Up @@ -139,12 +133,12 @@ Evaluating performance of PyGLM compared to NumPy.
Running on platform 'win32'.
Python version:
3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit (AMD64)]
3.13.0 (tags/v3.13.0:60403a5, Oct 7 2024, 09:38:07) [MSC v.1941 64 bit (AMD64)]
Comparing the following module versions:
PyGLM (DEFAULT) version 2.5.2
PyGLM (DEFAULT) version 2.7.2
vs
NumPy version 1.21.3
NumPy version 2.1.2
________________________________________________________________________________
The following table shows information about a task to be achieved and the time
Expand All @@ -157,42 +151,42 @@ value.
| Description | PyGLM time | NumPy time | ratio |
+----------------------------------------+------------+------------+-----------+
| 3 component vector creation | | | |
| (100,000 times) | 8ms | 21ms | 2.69x |
| (100,000 times) | 8ms | 30ms | 3.78x |
+----------------------------------------+------------+------------+-----------+
| 3 component vector creation with | | | |
| custom components | | | |
| (50,000 times) | 8ms | 34ms | 4.32x |
| (50,000 times) | 8ms | 33ms | 4.05x |
+----------------------------------------+------------+------------+-----------+
| dot product | | | |
| (50,000 times) | 4ms | 49ms | 10.93x |
| (50,000 times) | 3ms | 46ms | 13.53x |
+----------------------------------------+------------+------------+-----------+
| cross product | | | |
| (25,000 times) | 2ms | 548ms | 234.34x |
| (25,000 times) | 2ms | 523ms | 288.77x |
+----------------------------------------+------------+------------+-----------+
| L2-Norm of 3 component vector | | | |
| (100,000 times) | 7ms | 310ms | 44.49x |
| (100,000 times) | 5ms | 249ms | 49.05x |
+----------------------------------------+------------+------------+-----------+
| 4x4 matrix creation | | | |
| (50,000 times) | 5ms | 11ms | 2.32x |
| (50,000 times) | 5ms | 15ms | 3.03x |
+----------------------------------------+------------+------------+-----------+
| 4x4 identity matrix creation | | | |
| (100,000 times) | 7ms | 176ms | 24.05x |
| (100,000 times) | 6ms | 222ms | 36.61x |
+----------------------------------------+------------+------------+-----------+
| 4x4 matrix transposition | | | |
| (50,000 times) | 5ms | 32ms | 6.19x |
| (50,000 times) | 3ms | 23ms | 6.73x |
+----------------------------------------+------------+------------+-----------+
| 4x4 multiplicative inverse | | | |
| (50,000 times) | 4ms | 1925ms | 470.77x |
| (50,000 times) | 4ms | 336ms | 90.30x |
+----------------------------------------+------------+------------+-----------+
| 3 component vector addition | | | |
| (100,000 times) | 5ms | 38ms | 7.17x |
| (100,000 times) | 5ms | 52ms | 10.11x |
+----------------------------------------+------------+------------+-----------+
| 4x4 matrix multiplication | | | |
| (100,000 times) | 7ms | 39ms | 5.36x |
| (100,000 times) | 8ms | 55ms | 6.85x |
+----------------------------------------+------------+------------+-----------+
| 4x4 matrix x vector multiplication | | | |
| (100,000 times) | 6ms | 116ms | 20.01x |
| (100,000 times) | 6ms | 152ms | 23.39x |
+----------------------------------------+------------+------------+-----------+
| TOTAL | 0.07s | 3.30s | 47.78x |
| TOTAL | 0.06s | 1.74s | 26.97x |
+----------------------------------------+------------+------------+-----------+
```
Loading

0 comments on commit b87c610

Please sign in to comment.