Skip to content

Commit 95c79cc

Browse files
committed
Migrate setup.py to pyproject.toml
1 parent 7f75921 commit 95c79cc

File tree

14 files changed

+118
-106
lines changed

14 files changed

+118
-106
lines changed

.github/workflows/test-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Lint with flake8
2626
if: matrix.python-version == '3.11'
2727
run: |
28-
flake8 webware setup.py --count --exit-zero --statistics
28+
flake8 webware --count --exit-zero --statistics
2929
- name: Lint with pylint
3030
if: matrix.python-version == '3.11'
3131
run: |

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
author = 'Christoph Zwerschke et al.'
2727

2828
# The short X.Y version
29-
version = '3.0'
29+
version = '3.1'
3030
# The full version, including alpha/beta/rc tags
31-
release = '3.0.10'
31+
release = '3.1.0'
3232

3333

3434
# -- General configuration ---------------------------------------------------

docs/install.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,24 @@ When installing Webware for Python 3, the following "extras" can optionally be i
5353

5454
* "dev": extras for developing Webware applications
5555
* "examples": extras for running all Webware examples
56-
* "test": extras needed to test all functions of Webware
56+
* "tests": extras needed to test all functions of Webware
5757
* "docs": extras needed to build this documentation
5858

59-
On your development machine, we recommend installing the full "test" environment which also includes the other two environments. To do that, you need to specify the "Extras" name in square brackets when installing Webware for Python 3::
59+
On your development machine, we recommend installing the full "tests" environment which also includes the other two environments. To do that, you need to specify the "Extras" name in square brackets when installing Webware for Python 3::
6060

61-
pip install "Webware-for-Python[dev]>=3"
61+
pip install "Webware-for-Python[tests]>=3"
6262

6363

6464
Installation from Source
6565
------------------------
6666

67-
Alternatively, you can also download_ Webware for Python 3 from PyPI, and run the ``setup.py`` command in the tar.gz archive like this::
67+
Alternatively, you can also download_ Webware for Python 3 from PyPI, and run::
6868

69-
setup.py install
69+
python -m pip install .
7070

71-
You will then have to also install the "extra" requirements manually, though. Have a look at the setup.py file to see the list of required packages.
71+
Or, to create an editable installation with the extras for testing::
72+
73+
python -m pip install -e .[tests]
7274

7375
.. _download: https://pypi.org/project/Webware-for-Python/
7476

docs/overview.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Design Points and Changes
3232

3333
Another key goal of the original project was to provide a "Pythonic" API, instead of simply copying Java APIs. However, the project was created when Python 2 was still in its infancy, lacking many modern features and conventions such as PEP-8. Therefore, the Webware for Python API is a bit different from what is considered "Pythonic" nowadays. Particularly, it uses getters and setters instead of properties (but without the "get" prefix for getters), and camelCase method names instead of snake_case. In order to facilitate migration of existing projects, Webware for Python 3 kept this old API, even though it is not in line with PEP-8 and could be simplified by using properties. Modernizing the API will be a goal for a possible third edition of Webware for Python, as well as using the Python logging facility which did not yet exist when Webware for Python was created and is still done via printing to the standard output.
3434

35-
The plug-in architecture has also been kept in Webware for Python 3, but now implemented in a more modern way using entry points for discovering plug-ins. Old plug-ins are not compatible, but can be adapted quite easily. The old Webware for Python installer has been replaced by a standard setup.py based installation.
35+
The plug-in architecture has also been kept in Webware for Python 3, but now implemented in a more modern way using entry points for discovering plug-ins. Old plug-ins are not compatible, but can be adapted quite easily. The old Webware for Python installer has been replaced by a standard setup.py and later pyproject.toml based installation.
3636

3737
The most incisive change in Webware for Python 3 is the discontinuation of the threaded application server that was part of the built-in "WebKit" plug-in and actually one of the strong-points of Webware for Python. However, a threaded application based architecture may not be the best option anymore for Python in the age of multi-core processors due to the global interpreter lock (`GIL`_), and maintaining the application server based architecture would have also meant to maintain the various adapters such as ``mod_webkit`` and the start scripts for the application server for various operating systems. This did not appear to be feasible. At the same time, Python nowadays already provides a standardized way for web frameworks to deploy web applications with the Python Web Server Gateway Interface (`WSGI`_). By making the already existing Application class of Webware for Python usable as a WSGI application object, Webware applications can now be deployed in a standardized way using any WSGI compliant web server, and the necessity for operating as an application server itself has been removed. Webware for Python 3 applications deployed using ``mod_wsgi`` are even performing better and can be scaled in more ways than applications for the original Webware for Python that have been deployed using ``mod_webkit`` which used to be the deployment option with the best performance. During development, the waitress_ WSGI server is used to serve the application, replacing the old built-in HTTP server. As a structural simplification that goes along with the removal of the WebKit application server, the contents of the WebKit plug-in are now available at the top level of Webware for Python 3, and WebKit ceased to exist as a separate plug-in.
3838

docs/plugins.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ In Webware for Python 3, plug-ins are implemented as packages with metadata ("en
99

1010
Every Webware plug-in is a Python package, i.e. a directory that contains a ``__init__.py`` file and optionally other files. As a Webware plugin, it must also contain a special ``Properties.py`` file. You can disable a specific plug-in by placing a ``dontload`` file in its package directory.
1111

12-
If you want to distribute a Webware plug-in, you should advertize it as an entry point using the ``webware.plugins`` identifier in the ``setup.py`` file used to install the plug-in.
12+
If you want to distribute a Webware plug-in, you should advertize it as an entry point using the ``webware.plugins`` identifier in the ``pyproject.toml`` file used to install the plug-in.
1313

1414
The ``__init.py__`` file of the plug-in must contain at least a function like this::
1515

docs/testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Testing Webware itself
1111

1212
The unit tests and end to end tests for Webware for Python can be found in the ``Tests`` subdirectories of the root ``webware`` package and its plug-ins. Webware also has a built-in context ``Testing`` that contains some special servlets for testing various functionality of Webware, which can be invoked manually, but will also be tested automatically as part of the end-to-end tests.
1313

14-
Before running the test suite, install Webware for Python into a virtual environment and activate that environment. While developing and testing Webware, it is recommended to install Webware in editable mode. To do this, unpack the source installation package of Webware for Python 3, and run this command in the directory containing the ``setup.py`` file::
14+
Before running the test suite, install Webware for Python into a virtual environment and activate that environment. While developing and testing Webware, it is recommended to install Webware in editable mode. To do this, unpack the source installation package of Webware for Python 3, and run this command in the directory containing the ``pyproject.toml`` file::
1515

1616
pip install -e .[tests]
1717

pyproject.toml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "Webware-for-Python"
7+
# must match webware.Properties.version and docs.conf.release
8+
version = "3.1.0"
9+
description = "Webware for Python is a time-tested modular, object-oriented web framework."
10+
authors = [
11+
{name = "Christoph Zwerschke et al.", email = "cito@online.de"},
12+
]
13+
readme = "README.md"
14+
keywords = ["web", "framework", "servlets"]
15+
license = {text = "MIT"}
16+
# must match properties.requiredPyVersion
17+
requires-python = ">=3.6"
18+
classifiers = [
19+
"Development Status :: 5 - Production/Stable",
20+
"Environment :: Web Environment",
21+
"Intended Audience :: Developers",
22+
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
23+
"Topic :: Software Development :: Libraries :: Application Frameworks",
24+
"Topic :: Software Development :: Libraries :: Python Modules",
25+
"License :: OSI Approved :: MIT License",
26+
"Programming Language :: Python",
27+
"Programming Language :: Python :: 3",
28+
"Programming Language :: Python :: 3.6",
29+
"Programming Language :: Python :: 3.7",
30+
"Programming Language :: Python :: 3.8",
31+
"Programming Language :: Python :: 3.9",
32+
"Programming Language :: Python :: 3.10",
33+
"Programming Language :: Python :: 3.11",
34+
"Programming Language :: Python :: 3.12",
35+
"Programming Language :: Python :: Implementation :: CPython",
36+
"Programming Language :: Python :: Implementation :: PyPy",
37+
"Operating System :: OS Independent",
38+
]
39+
40+
[project.urls]
41+
Homepage = "https://webwareforpython.github.io/w4py3/"
42+
Source = "https://github.com/WebwareForPython/w4py3"
43+
Issues = "https://github.com/WebwareForPython/w4py3/issues"
44+
Documentation = "https://webwareforpython.github.io/w4py3/"
45+
46+
[project.optional-dependencies]
47+
dev = [
48+
"Pygments>=2.14,<3",
49+
"WebTest>=3,<4",
50+
"waitress>=2,<3",
51+
"hupper>=1.10,<2",
52+
]
53+
docs = [
54+
"Sphinx>=5,<7",
55+
"sphinx_rtd_theme>=1.1",
56+
]
57+
examples = [
58+
"DBUtils>=3,<4",
59+
"dominate>=2.7,<3",
60+
"yattag>=1.15,<2",
61+
"Pygments>=2.14,<3",
62+
"Pillow>=8,<12",
63+
]
64+
tests = [
65+
"psutil>=5.9,<7",
66+
"flake8>=5,<7",
67+
"pylint>=2.13,<3",
68+
"tox>=3.28,<5",
69+
"pywin32>=300,<400; sys_platform=='win32' and implementation_name=='cpython'",
70+
# include dev dependencies
71+
"Pygments>=2.14,<3",
72+
"WebTest>=3,<4",
73+
"waitress>=2,<3",
74+
"hupper>=1.10,<2",
75+
# include example dependencies
76+
"DBUtils>=3,<4",
77+
"dominate>=2.7,<3",
78+
"yattag>=1.15,<2",
79+
"Pillow>=8,<12",
80+
]
81+
82+
[project.scripts]
83+
webware = "webware.Scripts.WebwareCLI:main"
84+
85+
[project.entry-points."webware.plugins"]
86+
MiscUtils = "webware.MiscUtils"
87+
PSP = "webware.PSP"
88+
TaskKit = "webware.TaskKit"
89+
UserKit = "webware.UserKit"
90+
WebUtils = "webware.WebUtils"
91+
92+
[tool.setuptools]
93+
include-package-data = true

setup.py

Lines changed: 0 additions & 87 deletions
This file was deleted.

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ envlist = py{36,37,38,39,310,311,312}, pypy3, flake8, pylint, docs, manifest
55
basepython = python3.11
66
deps = flake8>=6,<7
77
commands =
8-
flake8 webware setup.py
8+
flake8 webware
99

1010
[testenv:pylint]
1111
basepython = python3.11

webware/PlugInLoader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pkg_resources
1+
from importlib.metadata import entry_points
22

33
from PlugIn import PlugIn
44

@@ -46,7 +46,7 @@ def loadPlugIns(self, plugInNames=None, verbose=None):
4646

4747
entryPoints = {
4848
entry_point.name: entry_point for entry_point
49-
in pkg_resources.iter_entry_points('webware.plugins')}
49+
in entry_points(group='webware.plugins')}
5050

5151
plugIns = {}
5252
for name in plugInNames:

0 commit comments

Comments
 (0)