diff --git a/docs/conf.py b/docs/conf.py index 5c0dd03..a4a13e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -14,6 +14,7 @@ # # import os import sys + # sys.path.insert(0, os.path.abspath('.')) from unittest.mock import MagicMock @@ -26,34 +27,34 @@ def __getattr__(cls, name): MOCK_MODULES = [ - 'glfw', - 'sdl2', - 'sdl2.ext', - 'sdl2.video', - 'pyglet', - 'pyglet.window', - 'PyQt5', - 'PyQt5.QtCore', - 'QtCore', - 'QtOpenGL', - 'QtWidgets', - 'PySide2', - 'PySide2.QtCore', - 'pywavefront', - 'pywavefront.obj', - 'trimesh', + "glfw", + "sdl2", + "sdl2.ext", + "sdl2.video", + "pyglet", + "pyglet.window", + "PyQt5", + "PyQt5.QtCore", + "QtCore", + "QtOpenGL", + "QtWidgets", + "PySide2", + "PySide2.QtCore", + "pywavefront", + "pywavefront.obj", + "trimesh", ] sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) # -- Project information ----------------------------------------------------- -project = 'moderngl-window' -copyright = '2023, Einar Forselv' -author = 'Einar Forselv' +project = "moderngl-window" +copyright = "2024, Einar Forselv" +author = "Einar Forselv" # The short X.Y version -version = '2.4.6' +version = "3.0.0" # The full version, including alpha/beta/rc tags release = version @@ -68,24 +69,24 @@ def __getattr__(cls, name): # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', - 'sphinx.ext.doctest', - 'sphinx.ext.coverage', - 'sphinx.ext.viewcode', - 'sphinx.ext.napoleon', + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.coverage", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The master toctree document. -master_doc = 'index' +master_doc = "index" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -97,7 +98,7 @@ def __getattr__(cls, name): # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The name of the Pygments (syntax highlighting) style to use. pygments_style = None @@ -108,7 +109,7 @@ def __getattr__(cls, name): # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -135,7 +136,7 @@ def __getattr__(cls, name): # -- Options for HTMLHelp output --------------------------------------------- # Output file base name for HTML help builder. -htmlhelp_basename = 'moderngl-windowdoc' +htmlhelp_basename = "moderngl-windowdoc" # -- Options for LaTeX output ------------------------------------------------ @@ -144,15 +145,12 @@ def __getattr__(cls, name): # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # 'preamble': '', - # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -162,8 +160,13 @@ def __getattr__(cls, name): # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'moderngl-window.tex', 'moderngl\\_window Documentation', - 'Einar Forselv', 'manual'), + ( + master_doc, + "moderngl-window.tex", + "moderngl\\_window Documentation", + "Einar Forselv", + "manual", + ), ] @@ -172,8 +175,7 @@ def __getattr__(cls, name): # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'moderngl-window', 'moderngl-window Documentation', - [author], 1) + (master_doc, "moderngl-window", "moderngl-window Documentation", [author], 1) ] @@ -183,9 +185,15 @@ def __getattr__(cls, name): # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'moderngl-window', 'moderngl-window Documentation', - author, 'moderngl-window', 'A cross platform helper library for ModernGL making window creation and resource loading simple', - 'Miscellaneous'), + ( + master_doc, + "moderngl-window", + "moderngl-window Documentation", + author, + "moderngl-window", + "A cross platform helper library for ModernGL making window creation and resource loading simple", + "Miscellaneous", + ), ] @@ -204,7 +212,7 @@ def __getattr__(cls, name): # epub_uid = '' # A list of files that should not be packed into the epub file. -epub_exclude_files = ['search.html'] +epub_exclude_files = ["search.html"] # -- Extension configuration ------------------------------------------------- diff --git a/moderngl_window/__init__.py b/moderngl_window/__init__.py index 7487dc7..393f576 100644 --- a/moderngl_window/__init__.py +++ b/moderngl_window/__init__.py @@ -1,6 +1,7 @@ """ General helper functions aiding in the boostrapping of this library. """ + # pylint: disable = redefined-outer-name, too-few-public-methods import argparse import logging @@ -18,7 +19,7 @@ from moderngl_window.utils.module_loading import import_string from moderngl_window.utils.keymaps import KeyMapFactory, KeyMap, QWERTY, AZERTY # noqa -__version__ = "2.4.6" +__version__ = "3.0.0" IGNORE_DIRS = [ "__pycache__", @@ -26,7 +27,16 @@ ] # Add new windows classes here to be recognized by the command line option --window -WINDOW_CLASSES = ["glfw", "headless", "pygame2", "pyglet", "pyqt5", "pyside2", "sdl2", "tk"] +WINDOW_CLASSES = [ + "glfw", + "headless", + "pygame2", + "pyglet", + "pyqt5", + "pyside2", + "sdl2", + "tk", +] OPTIONS_TRUE = ["yes", "on", "true", "t", "y", "1"] OPTIONS_FALSE = ["no", "off", "false", "f", "n", "0"] @@ -60,6 +70,7 @@ def setup_basic_logging(level: int): class ContextRefs: """Namespace for window/context references""" + WINDOW: Optional[BaseWindow] = None CONTEXT: Optional[moderngl.Context] = None @@ -195,9 +206,9 @@ def run_window_config(config_cls: WindowConfig, timer=None, args=None) -> None: title=config_cls.title, size=size, fullscreen=config_cls.fullscreen or values.fullscreen, - resizable=values.resizable - if values.resizable is not None - else config_cls.resizable, + resizable=( + values.resizable if values.resizable is not None else config_cls.resizable + ), visible=config_cls.visible, gl_version=config_cls.gl_version, aspect_ratio=config_cls.aspect_ratio, @@ -263,7 +274,10 @@ def create_parser(): help="Open the window in fullscreen mode", ) parser.add_argument( - "-vs", "--vsync", type=valid_bool, help="Enable or disable vsync", + "-vs", + "--vsync", + type=valid_bool, + help="Enable or disable vsync", ) parser.add_argument( "-r", @@ -292,7 +306,9 @@ def create_parser(): help="Enable or disable displaying the mouse cursor", ) parser.add_argument( - "--size", type=valid_window_size, help="Window size", + "--size", + type=valid_window_size, + help="Window size", ) parser.add_argument( "--size_mult", @@ -369,4 +385,6 @@ def valid_window_size_multiplier(value): except ValueError: pass - raise argparse.ArgumentTypeError("Must be a positive int or float",) + raise argparse.ArgumentTypeError( + "Must be a positive int or float", + ) diff --git a/pyproject.toml b/pyproject.toml index d1e0d7d..9dcd7bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,11 @@ [project] name = "moderngl-window" -version = "2.4.6" +version = "3.0.0" description = "A cross platform helper library for ModernGL making window creation and resource loading simple" readme = "README.md" -authors = [ - {name="Einar Forselv", email="eforselv@gmail.com"} -] -requires-python = ">=3.8" -license = {file = "license.rst"} +authors = [{ name = "Einar Forselv", email = "eforselv@gmail.com" }] +requires-python = ">=3.9" +license = { file = "license.rst" } classifiers = [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", @@ -16,11 +14,11 @@ classifiers = [ "Topic :: Multimedia :: Graphics :: 3D Rendering", "Topic :: Scientific/Engineering :: Visualization", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "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", ] # zip-safe = false dependencies = [ @@ -35,21 +33,9 @@ dependencies = [ include = ["moderngl_window", "moderngl_window.*"] [project.optional-dependencies] -dev = [ - "pytest", - "mypy", - "flake8", - "coverage", - "pywavefront", - "trimesh", - "scipy", - "build", -] -docs = [ - "Sphinx~=7.2.6 ", - "sphinx-rtd-theme~=1.3.0 ", - "doc8", -] +dev = ["pytest", "mypy", "coverage", "pywavefront", "trimesh", "scipy", "build"] +docs = ["Sphinx~=7.2.6 ", "sphinx-rtd-theme~=1.3.0 ", "doc8"] +imgui = ["imgui-bundle"] # 1.6.0 originally pygame = ["pygame>=2.0.1"] pygame-ce = ["pygame-ce>=2.0.1"] tk = ["pyopengltk>=0.0.3"] @@ -74,17 +60,17 @@ requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [tool.flake8] -ignore = [ - "W503", - "C901", -] +ignore = ["W503", "C901"] max-line-length = 120 max-complexity = 10 -exclude = [ - "tests/", - "docs/", - "temp/", -] +exclude = ["tests/", "docs/", "temp/"] + +[tool.ruff] +line-length = 100 +output-format = "full" + +[tool.black] +line-length = 100 [tool.mypy] disable_error_code = "annotation-unchecked"