Skip to content

Commit

Permalink
Merge pull request #147 from anderslindho/deprecate_setup_py
Browse files Browse the repository at this point in the history
Stop invoking setup.py directly
  • Loading branch information
einarf authored Oct 13, 2023
2 parents 200f2b9 + 598481e commit b2b3150
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 139 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
18 changes: 10 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -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
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ you provide us your `moderngl.Context`.
## Install

```bash
pip install moderngl-window
$ pip install moderngl-window
```

## Supported Platforms
Expand Down Expand Up @@ -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
Expand All @@ -88,29 +88,28 @@ 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

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
Expand Down
4 changes: 0 additions & 4 deletions docs/requirements.txt

This file was deleted.

70 changes: 70 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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="[email protected]"}
]
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"
27 changes: 0 additions & 27 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

52 changes: 0 additions & 52 deletions setup.py

This file was deleted.

4 changes: 0 additions & 4 deletions tests/requirements.txt

This file was deleted.

18 changes: 10 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,31 @@
# 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 =
py36: python3.6
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]
Expand Down

0 comments on commit b2b3150

Please sign in to comment.