Add support for pyproject.toml and wsgi module paths
pip 23.1 removed the "setup.py install" fallback for projects that do not have pyproject.toml and now uses a pyproject.toml which is vendored in pip [1][2]. pip 24.2 has now deprecated a similar fallback to "setup.py develop" and plans to fully remove this in pip 25.0 [3][4][5]. pbr supports editable installs since 6.0.0 pip 25.1 has now been released and the removal is complete. by adding our own minimal pyproject.toml to ensure we are using the correct build system. This change also requires that we adapt how we generate our wsgi entry point. when pyproject.toml is used the wsgi console script is not generated in an editbale install such as is used in devstck To adress this we need to refactor our usage of our wsgi applciation to use a module path instead. This change does not remove the declaration of our wsgi_script entry point but it shoudl be considered deprecated and it will be removed in the future. To unblock the gate the devstack plugin is modifed to to deploy using the wsgi module instead of the console script. [1] https://pip.pypa.io/en/stable/news/#v23-1 [2] pypa/pip#8368 [3] https://pip.pypa.io/en/stable/news/#v24-2 [4] pypa/pip#11457 [5] https://ichard26.github.io/blog/2024/08/whats-new-in-pip-24.2/ Closes-Bug: #2109583 Change-Id: I31fb6bff75ce27aedd94f7f73b7bfdd706127fc2
This commit is contained in:
0
cyborg/wsgi/__init__.py
Normal file
0
cyborg/wsgi/__init__.py
Normal file
22
cyborg/wsgi/api.py
Normal file
22
cyborg/wsgi/api.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""WSGI application entry-point for Cyborg API."""
|
||||
|
||||
import threading
|
||||
|
||||
from cyborg.api import wsgi_app
|
||||
|
||||
application = None
|
||||
lock = threading.Lock()
|
||||
with lock:
|
||||
if application is None:
|
||||
application = wsgi_app.init_application()
|
@@ -149,7 +149,7 @@ function configure_cyborg_api {
|
||||
iniset $CYBORG_CONF_FILE conductor automated_clean $CYBORG_AUTOMATED_CLEAN_ENABLED
|
||||
|
||||
if [ "$CYBORG_USE_UWSGI" == "True" ]; then
|
||||
write_uwsgi_config "$CYBORG_UWSGI_CONF" "$CYBORG_UWSGI" "/accelerator"
|
||||
write_uwsgi_config "$CYBORG_UWSGI_CONF" "$CYBORG_UWSGI" "/accelerator" "" "cyborg-api"
|
||||
fi
|
||||
sudo cp -p $CYBORG_DIR/etc/cyborg/api-paste.ini $CYBORG_API_PASTE_INI
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ fi
|
||||
# Toggle for deploying Cyborg-API under a wsgi server
|
||||
CYBORG_USE_UWSGI=${CYBORG_USE_UWSGI:-True}
|
||||
|
||||
CYBORG_UWSGI=$CYBORG_BIN_DIR/cyborg-wsgi-api
|
||||
CYBORG_UWSGI=cyborg.wsgi.api:application
|
||||
CYBORG_UWSGI_CONF=$CYBORG_CONF_DIR/cyborg-api-uwsgi.ini
|
||||
|
||||
if [[ "$CYBORG_USE_UWSGI" == "True" ]]; then
|
||||
|
3
pyproject.toml
Normal file
3
pyproject.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["pbr>=6.0.0", "setuptools>=64.0.0"]
|
||||
build-backend = "pbr.build"
|
@@ -0,0 +1,30 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
A new module, ``cyborg.wsgi``, has been added as a place to gather WSGI
|
||||
``application`` objects. This is intended to ease deployment by providing
|
||||
a consistent location for these objects. For example, if using uWSGI then
|
||||
instead of:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[uwsgi]
|
||||
wsgi-file = /bin/cyborg-api-wsgi
|
||||
|
||||
You can now use:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
[uwsgi]
|
||||
module = cyborg.wsgi.api:application
|
||||
|
||||
This also simplifies deployment with other WSGI servers that expect module
|
||||
paths such as gunicorn.
|
||||
deprecations:
|
||||
- |
|
||||
The cyborg-api-wsgi console script is deprecated for removal
|
||||
in a future release. This artifact is generated using a setup-tools
|
||||
extension that is provide by PBR which is also deprecated.
|
||||
Due to the changes in python packaging this custom extensions
|
||||
is planned to be removed form all OpenStack projects in a future
|
||||
PBR release in favor of module based wsgi applications entry points.
|
@@ -6,7 +6,7 @@ description_file =
|
||||
author = OpenStack
|
||||
author_email = openstack-discuss@lists.openstack.org
|
||||
home_page = https://docs.openstack.org/cyborg/latest/
|
||||
python_requires = >=3.8
|
||||
python_requires = >=3.10
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
@@ -17,8 +17,6 @@ classifier =
|
||||
Programming Language :: Python :: Implementation :: CPython
|
||||
Programming Language :: Python :: 3 :: Only
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
Programming Language :: Python :: 3.11
|
||||
|
||||
@@ -40,6 +38,9 @@ console_scripts =
|
||||
cyborg-dbsync = cyborg.cmd.dbsync:main
|
||||
cyborg-agent = cyborg.cmd.agent:main
|
||||
cyborg-status = cyborg.cmd.status:main
|
||||
|
||||
# NOTE(sean-k-mooney): this should be removed in 2026.1
|
||||
# as this will eventually stop working entirely.
|
||||
wsgi_scripts =
|
||||
cyborg-wsgi-api = cyborg.api.wsgi_app:init_application
|
||||
|
||||
|
Reference in New Issue
Block a user