Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated PyGLM packaging structure #203

Merged
merged 5 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "glm"]
path = glm
path = PyGLM_lib/glm
url = https://github.com/Zuzu-Typ/glm
branch = PyGLM
11 changes: 6 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ include COPYING
include README.md
include setup.py
include setup.cfg
include build_options.h
include version.h
include license.h
recursive-include PyGLM *
recursive-include glm *
include VERSION
include glm/py.typed
recursive-include PyGLM-stubs *
recursive-include PyGLM_lib *
recursive-exclude PyGLM_lib/glm/test *
recursive-exclude PyGLM_lib/glm/doc *
File renamed without changes.
File renamed without changes.
Empty file added PyGLM-stubs/glm/__init__.py
Empty file.
19,284 changes: 19,284 additions & 0 deletions PyGLM-stubs/glm/__init__.pyi

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions PyGLM/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import glm
from . import glm_typing
typing = glm_typing
File renamed without changes.
2 changes: 1 addition & 1 deletion glm-stubs/glm_typing.py → PyGLM/glm_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import SupportsFloat, SupportsInt, Tuple, Union

import glm
from . import glm

Number = Union[SupportsFloat, SupportsInt]
B8Vector1 = Union[glm.bvec1, Tuple[Number]]
Expand Down
2 changes: 2 additions & 0 deletions PyGLM.cpp → PyGLM_lib/PyGLM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,8 @@ extern "C" {
PyGLM_LICENSE_STRING = PyUnicode_FromString(PyGLM_LICENSE);
Py_INCREF(PyGLM_LICENSE_STRING);
PyModule_AddObject(module_glm, "license", PyGLM_LICENSE_STRING);

PyModule_AddStringConstant(module_glm, "__version__", PyGLM_VERSION);

return module_glm;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions PyGLM_lib/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#define _TO_STRING(x) #x
#define TO_STRING(x) _TO_STRING(x)

#define PyGLM_VERSION TO_STRING(VERSION)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ pip install PyGLM
```
And finally imported and used:
``` python
import glm
from PyGLM import glm
```
### Using PyGLM
PyGLM's syntax is very similar to the original GLM's syntax\.
There is no need to import anything but **glm**, as it already contains the entire package\.

For more information, take a look at the [wiki](https://github.com/Zuzu-Typ/PyGLM/wiki)\.
#### License requirements
Please make sure to **include the license for GLM** in your project when you use PyGLM\!
Please make sure to **include COPYING** in your project when you use PyGLM\!
\(this is especially relevant for **binary distributions**, e\.g\. \*\.exe\)

You can do so by copying the ``` COPYING ``` file \(or it's contents\) to your project\.
Expand Down Expand Up @@ -102,7 +102,7 @@ I try adding them on a one\-by\-one basis\.

### Short example
``` Python
>>> import glm
>>> from PyGLM import glm
>>> v = glm.vec3()
>>> v.x = 7
>>> print(v.xxy)
Expand Down
6 changes: 3 additions & 3 deletions README.sb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ pip install PyGLM
\ code\
And finally imported and used:
\code python \
import glm
from PyGLM import glm
\ code\
\h3 \Using PyGLM\ h3\
PyGLM's syntax is very similar to the original GLM's syntax.
There is no need to import anything but \b\glm\b\, as it already contains the entire package.

For more information, take a look at the \url https://github.com/Zuzu-Typ/PyGLM/wiki \wiki\ url\.
\h4 \License requirements\ h4\
Please make sure to \b \include the license for GLM\ b\ in your project when you use PyGLM!
Please make sure to \b \include COPYING\ b\ in your project when you use PyGLM!
(this is especially relevant for \b \binary distributions\ b\, e.g. *.exe)

You can do so by copying the \code \COPYING\ code\ file (or it's contents) to your project.
Expand Down Expand Up @@ -100,7 +100,7 @@ I try adding them on a one-by-one basis.

\h3 \Short example\ h3\
\code Python \
>>> import glm
>>> from PyGLM import glm
>>> v = glm.vec3()
>>> v.x = 7
>>> print(v.xxy)
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.3
6 changes: 6 additions & 0 deletions glm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from PyGLM.glm import *
from PyGLM import glm_typing, typing

import warnings as __warnings

__warnings.warn("Importing PyGLM via \"import glm\" is going to be deprecated in the future.\nUse \"from PyGLM import glm\" instead", PendingDeprecationWarning)
Empty file added glm/py.typed
Empty file.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
38 changes: 33 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
[bdist_wheel]
# This flag says that the code is written to work on both Python 2 and Python
# 3. If at all possible, it is good practice to do this. If you cannot, you
# will need to generate wheels for each Python version that you support.
#universal=0
[metadata]
name = PyGLM
version = file: VERSION
author = Zuzu_Typ
author_email = [email protected]
description = OpenGL Mathematics library for Python
long_description = file: README.md
long_description_content_type = text/markdown
keywords = GLM, OpenGL, matrix, vector, vec, mat, Mathematics, 3D, python, python3, 3, library, python-c-api, c-api, math-library, numpy, pyrr, pip, pypi, matrix-manipulation, matrix-multiplication, matrix-functions, quaternion, c, glsl
python_requires = >=3.7
license = zlib/libpng license
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: zlib/libpng License
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Operating System :: Microsoft :: Windows
Operating System :: POSIX :: Linux
Operating System :: MacOS
Topic :: Multimedia :: Graphics
Topic :: Software Development :: Libraries
Topic :: Scientific/Engineering :: Physics
Typing :: Typed

[options]
include_package_data = True
packages = find:
133 changes: 12 additions & 121 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,130 +1,21 @@
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import Extension, setup

import sys
if sys.version_info.major < 3 or sys.version_info.minor < 5:
raise Exception("PyGLM (0.5.0b1+) requires Python 3.5 or higher. Please install PyGLM==0.4.8b1")

# Always prefer setuptools over distutils
from setuptools import setup, find_packages, Extension
# To use a consistent encoding
from codecs import open
from os import path

import re

module1 = Extension('glm',
sources = ['PyGLM.cpp'], include_dirs=["glm/"], extra_compile_args=['-std=c++11'])
from os import path

here = path.abspath(path.dirname(__file__))

with open(path.join(here, "version.h")) as f:
__version__ = re.search('"(.*?)"', f.read()).group().strip('"')

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
long_description = long_description.replace("\r", "")

with open(path.join(here, "VERSION")) as file_:
VERSION = file_.read().strip()

setup(
name='PyGLM',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version=__version__,

description='OpenGL Mathematics library for Python',
long_description=long_description,
long_description_content_type='text/markdown',

# The project's main homepage.
url='https://github.com/Zuzu-Typ/PyGLM',

# Author details
author='Zuzu_Typ',
author_email="[email protected]",

# Choose your license
license='zlib/libpng license',

## install_requires=[],

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 5 - Production/Stable',

# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Multimedia :: Graphics',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: zlib/libpng License',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
"Operating System :: MacOS",
'Topic :: Software Development :: Libraries',
'Topic :: Scientific/Engineering :: Physics'

],

# What does your project relate to?
keywords='GLM OpenGL matrix vector vec mat Mathematics 3D python python3 3 library python-c-api c-api math-library numpy pyrr pip pypi matrix-manipulation matrix-multiplication matrix-functions quaternion c glsl',

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().

platforms = ["Windows", "Linux", "MacOS"],

package_data={'glm-stubs': ['__init__.pyi']},
packages=['glm-stubs'],

include_package_data=True,

# Alternatively, if you want to distribute just a my_module.py, uncomment
# this:
#py_modules=["glm"],

ext_modules = [module1],

# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html

# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# for example:
# $ pip install -e .[dev,test]

# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.

# Although 'package_data' is the preferred approach, in some case you may
# need to place data files outside of your packages. See:
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'

# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
ext_modules=[
Extension(
name="PyGLM.glm",
sources=["PyGLM_lib/PyGLM.cpp"],
include_dirs=["PyGLM_lib/glm/"],
extra_compile_args=['-std=c++11', f'-DVERSION={VERSION}']
),
]
)
1 change: 0 additions & 1 deletion version.h

This file was deleted.