diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 9099c8de..0d4fad34 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -1,15 +1,7 @@ name: Python package - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - workflow_dispatch: - +on: [push] jobs: build: - runs-on: ubuntu-latest strategy: matrix: @@ -23,19 +15,15 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip setuptools - pip install -e .[pywavefront,trimesh] - pip install -r tests/requirements.txt - # pip install -r requirements.txt + python -m pip install --upgrade pip + pip install -e .[tests] - name: Lint with flake8 run: | - # pip install flake8 # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest run: | - pip install pytest # TODO: Figure out if we can run headless tests pytest tests/test_docs.py diff --git a/.readthedocs.yml b/.readthedocs.yml index 47d1b0c1..3929f5f7 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,8 +1,10 @@ -build: - image: latest - -python: - version: 3.8 - setup_py_install: true - install: - - requirements: docs/requirements.txt +build: + image: latest + +python: + version: 3.8 + install: + - method: pip + path: . + extra_requirements: + - docs diff --git a/README.md b/README.md index ae344128..6c16f8d8 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ you provide us your `moderngl.Context`. ## Install ```bash -pip install moderngl-window +$ pip install moderngl-window ``` ## Supported Platforms @@ -67,13 +67,13 @@ Test.run() Run the example with different window backends: ```bash -python test.py --window pyglet -python test.py --window pygame2 -python test.py --window glfw -python test.py --window sdl2 -python test.py --window pyside2 -python test.py --window pyqt5 -python test.py --window tk +$ python test.py --window pyglet +$ python test.py --window pygame2 +$ python test.py --window glfw +$ python test.py --window sdl2 +$ python test.py --window pyside2 +$ python test.py --window pyqt5 +$ python test.py --window tk ``` `WindowConfig` classes are the simplest way to get started without knowing @@ -88,9 +88,8 @@ We assume the user knows how to handle virtualenvs. # Install the package in editable mode $ pip install -e . -# Set up and dev requirements -pip install -r requirements.txt -pip install -r tests/requirements.txt +# Install test and development requirements +$ pip install -e .[tests] ``` ## Running Tests @@ -98,19 +97,19 @@ pip install -r tests/requirements.txt Tests are set up with `tox` running pytest with coverage and flake8. ```bash -pip install -r tests/requirements.txt -tox -e py36 -tox -e py37 -tox -e py38 -tox -e py39 -tox -e pep8 +$ pip install -e .[tests] +$ tox -e py36 +$ tox -e py37 +$ tox -e py38 +$ tox -e py39 +$ tox -e pep8 ``` ## Building Docs ```bash -pip install -r docs/requirements.txt -python setup.py build_sphinx +$ pip install -e .[docs] +$ sphinx-build -b html docs docs/_build ``` ## Contributing diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 0dddbb45..00000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -Sphinx==2.2.0 -sphinx-rtd-theme==0.4.3 -sphinxcontrib-napoleon==0.7 -doc8 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..2987d193 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,70 @@ +[project] +name = "moderngl-window" +version = "2.4.4" +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"} +classifiers = [ + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Topic :: Games/Entertainment", + "Topic :: Multimedia :: Graphics", + "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", +] +# zip-safe = false +dependencies = [ + "moderngl<6", + "pyglet~=2.0.0", + "numpy>=1.16,<2", + "pyrr>=0.10.3,<1", + "Pillow>=9,<10", +] + +[tool.setuptools.packages.find] +include = ["moderngl_window", "moderngl_window.*"] + +[project.optional-dependencies] +dev = [ + "pytest", + "mypy", + "flake8", + "coverage", +] +docs = [ + "Sphinx==2.2.0", + "sphinx-rtd-theme==0.4.3", + "sphinxcontrib-napoleon==0.7", + "doc8", +] +pygame = ["pygame>=2.0.1"] +pygame-ce = ["pygame-ce>=2.0.1"] +tk = ["pyopengltk>=0.0.3"] +trimesh = ["trimesh>=3.2.6,<4"] +pywavefront = ["pywavefront>=1.2.0,<2"] +PySDL2 = ["PySDL2"] +glfw = ["glfw"] +pyqt5 = ["PyQt5"] +PySide2 = ["PySide2<6"] +pdf = ["ReportLab>=1.2"] + +[project.urls] +Source = "https://github.com/moderngl/moderngl_window" +Documentation = "https://moderngl-window.readthedocs.io" +ModernGL = "https://github.com/moderngl/moderngl" + +[tool.coverage.run] +source = ["moderngl_window"] + +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 5ad43e9c..00000000 --- a/requirements.txt +++ /dev/null @@ -1,27 +0,0 @@ -# For quick install of optional requirements in development -# Get the main requirements by installing the package in editable mode: -# pip install -e . - -moderngl<6 - -# Optional -pyglet<2 -PySide2<6 -PyQt5<6 -glfw<2 -PySDL2<1 -pygame>=2.0.1 -pyrr>=0.10 -pywavefront>=1.2.0,<2.0 -numpy>=1.16 -imgui<2 - -# trimesh -trimesh>=3.2.6 -scipy>=1.3.2 - -# tkinter window -pyopengl>=3.1.0 -pyopengltk>=0.0.3 - -flake8 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b88034e4..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -description-file = README.md diff --git a/setup.py b/setup.py deleted file mode 100644 index 12a0000a..00000000 --- a/setup.py +++ /dev/null @@ -1,52 +0,0 @@ -from setuptools import setup, find_namespace_packages - -setup( - name="moderngl-window", - version="2.4.4", - description="A cross platform helper library for ModernGL making window creation and resource loading simple", - long_description=open('README.md').read(), - long_description_content_type='text/markdown', - url="https://github.com/moderngl/moderngl_window", - author="Einar Forselv", - author_email="eforselv@gmail.com", - packages=find_namespace_packages(include=['moderngl_window', 'moderngl_window.*']), - include_package_data=True, - keywords=['moderngl', 'window', 'context'], - license='MIT', - platforms=['any'], - python_requires='>=3.7', - classifiers=[ - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Topic :: Games/Entertainment', - 'Topic :: Multimedia :: Graphics', - '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', - ], - install_requires=[ - 'moderngl<6', - 'pyglet>=2.0dev23', - 'numpy>=1.16,<2', - 'pyrr>=0.10.3,<1', - 'Pillow>=9,<10', - ], - extras_require={ - "PySide2": ['PySide2<6'], - "pyqt5": ['PyQt5'], - "glfw": ['glfw'], - "PySDL2": ['PySDL2'], - "pywavefront": ["pywavefront>=1.3.3,<2"], - "trimesh": ["trimesh>=3.2.6,<4", "scipy>=1.3.2"], - "tk": ["pyopengltk>=0.0.3"], - "pygame": ["pygame>=2.1.2"], - }, - project_urls={ - 'Documentation': 'https://moderngl-window.readthedocs.io', - 'ModernGL': 'https://github.com/moderngl/moderngl', - }, -) diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index fad52503..00000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -pytest -tox -flake8 -coverage diff --git a/tox.ini b/tox.ini index 14c044bf..a315cf1a 100644 --- a/tox.ini +++ b/tox.ini @@ -2,15 +2,21 @@ # as flake8 can fail to parse the file on OS X and Windows [tox] -skipsdist = False +skipsdist = True envlist = py36 py37 py38 py39 - py310 pep8 +[gh-actions] +python = + 3.6: py36 + 3.7: py37 + 3.8: py38 + 3.9: py39 + [testenv] usedevelop = True basepython = @@ -18,13 +24,9 @@ basepython = py37: python3.7 py38: python3.8 py39: python3.9 - py310: python3.10 - -deps = - -r{toxinidir}/requirements.txt - -r{toxinidir}/tests/requirements.txt +extras = tests commands = - coverage run --source=moderngl_window -m pytest tests/ + coverage run -m pytest tests/ coverage report [testenv:pep8]