chore: Remove poetry
1. remove poetry dependency 2. add requirements.tx, test-requirements.txt, setup.py and setup.cfg 3. add more env into tox.ini 4. remove some command from Makefile 5. cleanup the dependencies 6. change some commands of README 7. update the devstack Depends-On: https://review.opendev.org/c/openstack/skyline-console/+/843257 Change-Id: I4cefc4cfdaadf7b3ba03ffe8441e9ae760772349
This commit is contained in:
parent
60144767cd
commit
1a050ec2c4
@ -70,6 +70,8 @@ docs/_build/
|
|||||||
.vscode/
|
.vscode/
|
||||||
/log/
|
/log/
|
||||||
tmp/
|
tmp/
|
||||||
|
test_results.html
|
||||||
|
nginx.conf
|
||||||
|
|
||||||
# MAC OS
|
# MAC OS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
5
.flake8
5
.flake8
@ -1,5 +0,0 @@
|
|||||||
[flake8]
|
|
||||||
max-line-length = 99
|
|
||||||
max-doc-length = 99
|
|
||||||
show-source = True
|
|
||||||
extend-ignore = E203
|
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -26,6 +26,8 @@ wheels/
|
|||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
AUTHORS
|
||||||
|
ChangeLog
|
||||||
|
|
||||||
# Installer logs
|
# Installer logs
|
||||||
pip-log.txt
|
pip-log.txt
|
||||||
@ -72,8 +74,8 @@ venv.bak/
|
|||||||
tmp/
|
tmp/
|
||||||
test_results.html
|
test_results.html
|
||||||
skyline-console-*
|
skyline-console-*
|
||||||
|
nginx.conf
|
||||||
|
|
||||||
# MAC OS
|
# MAC OS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
requirements.txt
|
|
||||||
|
9
.isort.cfg
Normal file
9
.isort.cfg
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[settings]
|
||||||
|
multi_line_output = 3
|
||||||
|
include_trailing_comma = True
|
||||||
|
force_grid_wrap = 0
|
||||||
|
use_parentheses = True
|
||||||
|
ensure_newline_before_comments = True
|
||||||
|
line_length = 98
|
||||||
|
reverse_relative = true
|
||||||
|
combine_as_imports = true
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -11,7 +11,7 @@
|
|||||||
"module": "uvicorn",
|
"module": "uvicorn",
|
||||||
"args": [
|
"args": [
|
||||||
"--reload",
|
"--reload",
|
||||||
"--reload-dir", "libs/skyline-apiserver/skyline_apiserver",
|
"--reload-dir", "skyline_apiserver",
|
||||||
"--port", "28000",
|
"--port", "28000",
|
||||||
"--log-level", "debug",
|
"--log-level", "debug",
|
||||||
"skyline_apiserver.main:app"
|
"skyline_apiserver.main:app"
|
||||||
|
30
.zuul.yaml
30
.zuul.yaml
@ -12,6 +12,7 @@
|
|||||||
- playbooks/devstack/post.yaml
|
- playbooks/devstack/post.yaml
|
||||||
required-projects:
|
required-projects:
|
||||||
- openstack/skyline-apiserver
|
- openstack/skyline-apiserver
|
||||||
|
- openstack/skyline-console
|
||||||
vars:
|
vars:
|
||||||
devstack_plugins:
|
devstack_plugins:
|
||||||
skyline-apiserver: https://opendev.org/openstack/skyline-apiserver
|
skyline-apiserver: https://opendev.org/openstack/skyline-apiserver
|
||||||
@ -25,38 +26,27 @@
|
|||||||
tox_envlist: functional
|
tox_envlist: functional
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: skyline-tox-unittest-py38
|
name: skyline-tox-py38
|
||||||
parent: openstack-tox-py38
|
parent: openstack-tox-py38
|
||||||
description: |
|
description: |
|
||||||
Skyline py38 unittest tests
|
Skyline py38 unittest tests
|
||||||
vars:
|
vars:
|
||||||
python_version: 3.8
|
python_version: 3.8
|
||||||
tox_envlist: unittest-py38
|
tox_envlist: py38
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: skyline-tox-lint-py38
|
name: skyline-tox-pep8-py38
|
||||||
parent: openstack-tox-py38
|
parent: openstack-tox-py38
|
||||||
description: |
|
description: |
|
||||||
Skyline code static analysis
|
Skyline code static analysis
|
||||||
vars:
|
vars:
|
||||||
python_version: 3.8
|
python_version: 3.8
|
||||||
tox_envlist: lint
|
tox_envlist: pep8
|
||||||
|
|
||||||
- job:
|
|
||||||
name: publish-skyline-python-branch-tarball
|
|
||||||
parent: publish-openstack-artifacts
|
|
||||||
description: |
|
|
||||||
Publish the results tar.gz and whl packages to tarballs.openstack.org.
|
|
||||||
pre-run: playbooks/python-tarball/pre.yaml
|
|
||||||
run: playbooks/python-tarball/run.yaml
|
|
||||||
post-run: playbooks/python-tarball/post.yaml
|
|
||||||
vars:
|
|
||||||
release_python: python3
|
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- skyline-tox-unittest-py38:
|
- skyline-tox-py38:
|
||||||
irrelevant-files:
|
irrelevant-files:
|
||||||
- ^container/.*$
|
- ^container/.*$
|
||||||
- ^devstack/.*$
|
- ^devstack/.*$
|
||||||
@ -65,7 +55,7 @@
|
|||||||
- ^.*\.rst$
|
- ^.*\.rst$
|
||||||
- ^.*\.md$
|
- ^.*\.md$
|
||||||
- ^kolla/.*$
|
- ^kolla/.*$
|
||||||
- skyline-tox-lint-py38
|
- skyline-tox-pep8-py38
|
||||||
- skyline-functional-devstack:
|
- skyline-functional-devstack:
|
||||||
irrelevant-files:
|
irrelevant-files:
|
||||||
- ^container/.*$
|
- ^container/.*$
|
||||||
@ -78,7 +68,7 @@
|
|||||||
- ^releasenotes/.*$
|
- ^releasenotes/.*$
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- skyline-tox-unittest-py38:
|
- skyline-tox-py38:
|
||||||
irrelevant-files:
|
irrelevant-files:
|
||||||
- ^container/.*$
|
- ^container/.*$
|
||||||
- ^devstack/.*$
|
- ^devstack/.*$
|
||||||
@ -87,7 +77,7 @@
|
|||||||
- ^.*\.rst$
|
- ^.*\.rst$
|
||||||
- ^.*\.md$
|
- ^.*\.md$
|
||||||
- ^kolla/.*$
|
- ^kolla/.*$
|
||||||
- skyline-tox-lint-py38
|
- skyline-tox-pep8-py38
|
||||||
- skyline-functional-devstack:
|
- skyline-functional-devstack:
|
||||||
irrelevant-files:
|
irrelevant-files:
|
||||||
- ^container/.*$
|
- ^container/.*$
|
||||||
@ -100,4 +90,4 @@
|
|||||||
- ^releasenotes/.*$
|
- ^releasenotes/.*$
|
||||||
post:
|
post:
|
||||||
jobs:
|
jobs:
|
||||||
- publish-skyline-python-branch-tarball
|
- publish-openstack-python-tarball
|
||||||
|
1
MANIFEST.in
Normal file
1
MANIFEST.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
include skyline_apiserver/templates/nginx.conf.j2
|
71
Makefile
71
Makefile
@ -1,5 +1,3 @@
|
|||||||
PYTHON ?= python3
|
|
||||||
PY_FILES := $(shell git ls-files -- *.py | xargs)
|
|
||||||
ROOT_DIR ?= $(shell git rev-parse --show-toplevel)
|
ROOT_DIR ?= $(shell git rev-parse --show-toplevel)
|
||||||
|
|
||||||
# Color
|
# Color
|
||||||
@ -21,9 +19,6 @@ GIT_COMMIT ?= $(shell git rev-parse --verify HEAD)
|
|||||||
# URL for skyline-console packages
|
# URL for skyline-console packages
|
||||||
SKYLINE_CONSOLE_PACKAGE_URL ?= "https://tarballs.opendev.org/openstack/skyline-console/skyline-console-master.tar.gz"
|
SKYLINE_CONSOLE_PACKAGE_URL ?= "https://tarballs.opendev.org/openstack/skyline-console/skyline-console-master.tar.gz"
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
all: install fmt lint test package
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
help:
|
help:
|
||||||
@ -33,17 +28,10 @@ help:
|
|||||||
@echo
|
@echo
|
||||||
@echo "Target:"
|
@echo "Target:"
|
||||||
@echo " git_config Initialize git configuration."
|
@echo " git_config Initialize git configuration."
|
||||||
@echo " venv Create virtualenvs."
|
@echo " clean Clean up."
|
||||||
@echo " install Installs the project dependencies."
|
@echo " build Build docker image."
|
||||||
@echo " package Build package from source code."
|
|
||||||
@echo " build Build container image."
|
|
||||||
@echo " lint Check python code."
|
|
||||||
@echo " fmt Format python code style."
|
|
||||||
@echo " test Run unit tests."
|
|
||||||
@echo " db_revision Generate database alembic version revision with model."
|
@echo " db_revision Generate database alembic version revision with model."
|
||||||
@echo " db_sync Sync database from alembic version revision."
|
@echo " db_sync Sync database from alembic version revision."
|
||||||
@echo " swagger Generate swagger json file."
|
|
||||||
@echo " genconfig Generate sample config file."
|
|
||||||
@echo " future_check Find python files without 'type annotations'.(Alpha)"
|
@echo " future_check Find python files without 'type annotations'.(Alpha)"
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
@ -72,46 +60,9 @@ endif
|
|||||||
@printf "${yellow}You may need to run 'pip install git-review' install git review tools.\n\n${no_color}"
|
@printf "${yellow}You may need to run 'pip install git-review' install git review tools.\n\n${no_color}"
|
||||||
|
|
||||||
|
|
||||||
.PHONY: venv
|
|
||||||
venv:
|
|
||||||
poetry env use $(PYTHON)
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: venv
|
|
||||||
poetry run pip install -U pip setuptools'<58.0.0'
|
|
||||||
poetry install -vvv
|
|
||||||
tools/post_install.sh
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: package
|
|
||||||
package:
|
|
||||||
poetry build
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: fmt
|
|
||||||
fmt:
|
|
||||||
poetry run isort $(PY_FILES)
|
|
||||||
poetry run black --config pyproject.toml $(PY_FILES)
|
|
||||||
poetry run add-trailing-comma --py36-plus --exit-zero-even-if-changed $(PY_FILES)
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: lint
|
|
||||||
lint:
|
|
||||||
# poetry run mypy --strict --config-file=mypy.ini $(PY_FILES)
|
|
||||||
poetry run isort --check-only --diff $(PY_FILES)
|
|
||||||
poetry run black --check --diff --color --config pyproject.toml $(PY_FILES)
|
|
||||||
poetry run flake8 --config .flake8 $(PY_FILES)
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: test
|
|
||||||
test:
|
|
||||||
poetry run pytest
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf .venv dist htmlcov .coverage log test_results.html
|
rm -rf .venv dist htmlcov .coverage log test_results.html build .tox skyline_apiserver.egg-info AUTHORS ChangeLog
|
||||||
|
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
@ -133,28 +84,18 @@ build:
|
|||||||
rm -rf skyline-console-*
|
rm -rf skyline-console-*
|
||||||
|
|
||||||
|
|
||||||
.PHONY: swagger
|
|
||||||
swagger:
|
|
||||||
poetry run swagger-generator -o $(ROOT_DIR)/docs/api/swagger.json
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: genconfig
|
|
||||||
genconfig:
|
|
||||||
poetry run config-sample-generator -o $(ROOT_DIR)/etc/skyline.yaml.sample
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: db_revision
|
.PHONY: db_revision
|
||||||
HEAD_REV ?= $(shell poetry run alembic -c skyline_apiserver/db/alembic/alembic.ini heads | awk '{print $$1}')
|
HEAD_REV ?= $(shell alembic -c skyline_apiserver/db/alembic/alembic.ini heads | awk '{print $$1}')
|
||||||
NEW_REV ?= $(shell python3 -c 'import sys; print(f"{int(sys.argv[1])+1:03}")' $(HEAD_REV))
|
NEW_REV ?= $(shell python3 -c 'import sys; print(f"{int(sys.argv[1])+1:03}")' $(HEAD_REV))
|
||||||
REV_MEG ?=
|
REV_MEG ?=
|
||||||
db_revision:
|
db_revision:
|
||||||
$(shell [ -z "$(REV_MEG)" ] && printf '$(red)Missing required message, use "make db_revision REV_MEG=<some message>"$(no_color)')
|
$(shell [ -z "$(REV_MEG)" ] && printf '$(red)Missing required message, use "make db_revision REV_MEG=<some message>"$(no_color)')
|
||||||
poetry run alembic -c skyline_apiserver/db/alembic/alembic.ini revision --autogenerate --rev-id $(NEW_REV) -m '$(REV_MEG)'
|
alembic -c skyline_apiserver/db/alembic/alembic.ini revision --autogenerate --rev-id $(NEW_REV) -m '$(REV_MEG)'
|
||||||
|
|
||||||
|
|
||||||
.PHONY: db_sync
|
.PHONY: db_sync
|
||||||
db_sync:
|
db_sync:
|
||||||
poetry run alembic -c skyline_apiserver/db/alembic/alembic.ini upgrade head
|
alembic -c skyline_apiserver/db/alembic/alembic.ini upgrade head
|
||||||
|
|
||||||
|
|
||||||
# Find python files without "type annotations"
|
# Find python files without "type annotations"
|
||||||
|
@ -151,7 +151,6 @@ Skyline 的吉祥物是九色鹿。九色鹿源自于敦煌壁画《九色鹿本
|
|||||||
|
|
||||||
- make >= 3.82
|
- make >= 3.82
|
||||||
- python >= 3.8
|
- python >= 3.8
|
||||||
- poetry >= 1.1.0 ([安装指南](https://python-poetry.org/docs/#installation))
|
|
||||||
- node >= 10.22.0 (可选,只开发 API 就用不到)
|
- node >= 10.22.0 (可选,只开发 API 就用不到)
|
||||||
- yarn >= 1.22.4 (可选,只开发 API 就用不到)
|
- yarn >= 1.22.4 (可选,只开发 API 就用不到)
|
||||||
|
|
||||||
@ -160,7 +159,7 @@ Skyline 的吉祥物是九色鹿。九色鹿源自于敦煌壁画《九色鹿本
|
|||||||
1. 安装依赖包
|
1. 安装依赖包
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make install
|
tox -e venv
|
||||||
```
|
```
|
||||||
|
|
||||||
2. 配置 `skyline.yaml` 文件
|
2. 配置 `skyline.yaml` 文件
|
||||||
@ -190,13 +189,16 @@ Skyline 的吉祥物是九色鹿。九色鹿源自于敦煌壁画《九色鹿本
|
|||||||
3. 初始化 skyline 数据库
|
3. 初始化 skyline 数据库
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
source .tox/venv/bin/activate
|
||||||
make db_sync
|
make db_sync
|
||||||
|
deactivate
|
||||||
```
|
```
|
||||||
|
|
||||||
4. 运行 skyline-apiserver
|
4. 运行 skyline-apiserver
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ poetry run uvicorn --reload --reload-dir skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app
|
$ source .tox/venv/bin/activate
|
||||||
|
$ uvicorn --reload --reload-dir skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app
|
||||||
|
|
||||||
INFO: Uvicorn running on http://127.0.0.1:28000 (Press CTRL+C to quit)
|
INFO: Uvicorn running on http://127.0.0.1:28000 (Press CTRL+C to quit)
|
||||||
INFO: Started reloader process [154033] using statreload
|
INFO: Started reloader process [154033] using statreload
|
||||||
|
10
README.md
10
README.md
@ -151,7 +151,6 @@ You can now access the dashboard: `https://<ip_address>:9999`
|
|||||||
|
|
||||||
- make >= 3.82
|
- make >= 3.82
|
||||||
- python >= 3.8
|
- python >= 3.8
|
||||||
- poetry >= 1.1.0 ([Installation Guide](https://python-poetry.org/docs/#installation))
|
|
||||||
- node >= 10.22.0 (Optional if you only develop with apiserver)
|
- node >= 10.22.0 (Optional if you only develop with apiserver)
|
||||||
- yarn >= 1.22.4 (Optional if you only develop with apiserver)
|
- yarn >= 1.22.4 (Optional if you only develop with apiserver)
|
||||||
|
|
||||||
@ -160,7 +159,7 @@ You can now access the dashboard: `https://<ip_address>:9999`
|
|||||||
1. Installing dependency packages
|
1. Installing dependency packages
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make install
|
tox -e venv
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Set skyline.yaml config file
|
2. Set skyline.yaml config file
|
||||||
@ -190,13 +189,16 @@ You can now access the dashboard: `https://<ip_address>:9999`
|
|||||||
3. Init skyline database
|
3. Init skyline database
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
source .tox/venv/bin/activate
|
||||||
make db_sync
|
make db_sync
|
||||||
|
deactivate
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Run skyline-apiserver
|
4. Run skyline-apiserver
|
||||||
|
|
||||||
```bash
|
```console
|
||||||
$ poetry run uvicorn --reload --reload-dir skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app
|
$ source .tox/venv/bin/activate
|
||||||
|
$ uvicorn --reload --reload-dir skyline_apiserver --port 28000 --log-level debug skyline_apiserver.main:app
|
||||||
|
|
||||||
INFO: Uvicorn running on http://127.0.0.1:28000 (Press CTRL+C to quit)
|
INFO: Uvicorn running on http://127.0.0.1:28000 (Press CTRL+C to quit)
|
||||||
INFO: Started reloader process [154033] using statreload
|
INFO: Started reloader process [154033] using statreload
|
||||||
|
@ -27,12 +27,11 @@ RUN export LANG=C.UTF-8 \
|
|||||||
&& rm -rf /usr/bin/python /usr/bin/pip \
|
&& rm -rf /usr/bin/python /usr/bin/pip \
|
||||||
&& ln -s /usr/bin/python3 /usr/bin/python \
|
&& ln -s /usr/bin/python3 /usr/bin/python \
|
||||||
&& ln -s /usr/bin/pip3 /usr/bin/pip \
|
&& ln -s /usr/bin/pip3 /usr/bin/pip \
|
||||||
&& pip install -U pip setuptools'<58.0.0' \
|
|
||||||
&& pip install poetry!=1.1.8 \
|
|
||||||
&& poetry config virtualenvs.create false \
|
|
||||||
&& mkdir -p /etc/skyline /var/log/skyline /var/lib/skyline \
|
&& mkdir -p /etc/skyline /var/log/skyline /var/lib/skyline \
|
||||||
&& cd /skyline-apiserver \
|
&& cd /skyline-apiserver \
|
||||||
&& poetry install \
|
&& git init \
|
||||||
|
&& cd / \
|
||||||
|
&& pip install skyline-apiserver/ \
|
||||||
&& pip install -U ${SKYLINE_CONSOLE_PACKAGE_URL} \
|
&& pip install -U ${SKYLINE_CONSOLE_PACKAGE_URL} \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf ~/.cache/pip
|
&& rm -rf ~/.cache/pip
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Save trace setting
|
|
||||||
INC_PY_TRACE=$(set +o | grep xtrace)
|
|
||||||
set +o xtrace
|
|
||||||
|
|
||||||
# Wrapper for ``pip install`` to set cache and proxy environment variables
|
|
||||||
# Uses globals ``OFFLINE``, ``PIP_VIRTUAL_ENV``,
|
|
||||||
# ``PIP_UPGRADE``, ``*_proxy``,
|
|
||||||
# Usage:
|
|
||||||
# pip_install pip_arguments
|
|
||||||
function contrib_pip_install {
|
|
||||||
local xtrace result
|
|
||||||
xtrace=$(set +o | grep xtrace)
|
|
||||||
set +o xtrace
|
|
||||||
local upgrade=""
|
|
||||||
local offline=${OFFLINE:-False}
|
|
||||||
if [[ "$offline" == "True" || -z "$@" ]]; then
|
|
||||||
$xtrace
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
time_start "pip_install"
|
|
||||||
|
|
||||||
PIP_UPGRADE=$(trueorfalse False PIP_UPGRADE)
|
|
||||||
if [[ "$PIP_UPGRADE" = "True" ]] ; then
|
|
||||||
upgrade="--upgrade"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$os_PACKAGE" ]]; then
|
|
||||||
GetOSVersion
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Try to extract the path of the package we are installing into
|
|
||||||
# package_dir. We need this to check for test-requirements.txt,
|
|
||||||
# at least.
|
|
||||||
#
|
|
||||||
# ${!#} expands to the last positional argument to this function.
|
|
||||||
# With "extras" syntax included, our arguments might be something
|
|
||||||
# like:
|
|
||||||
# -e /path/to/fooproject[extra]
|
|
||||||
# Thus this magic line grabs just the path without extras
|
|
||||||
#
|
|
||||||
# Note that this makes no sense if this is a pypi (rather than
|
|
||||||
# local path) install; ergo you must check this path exists before
|
|
||||||
# use. Also, if we had multiple or mixed installs, we would also
|
|
||||||
# likely break. But for historical reasons, it's basically only
|
|
||||||
# the other wrapper functions in here calling this to install
|
|
||||||
# local packages, and they do so with single call per install. So
|
|
||||||
# this works (for now...)
|
|
||||||
local package_dir=${!#%\[*\]}
|
|
||||||
|
|
||||||
if [[ -n ${PIP_VIRTUAL_ENV:=} && -d ${PIP_VIRTUAL_ENV} ]]; then
|
|
||||||
local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip
|
|
||||||
local sudo_pip="env"
|
|
||||||
else
|
|
||||||
local cmd_pip="python$PYTHON3_VERSION -m pip"
|
|
||||||
# See
|
|
||||||
# https://github.com/pypa/setuptools/issues/2232
|
|
||||||
# http://lists.openstack.org/pipermail/openstack-discuss/2020-August/016905.html
|
|
||||||
# this makes setuptools >=50 use the platform distutils.
|
|
||||||
# We only want to do this on global pip installs, not if
|
|
||||||
# installing in a virtualenv
|
|
||||||
local sudo_pip="sudo -H LC_ALL=en_US.UTF-8 SETUPTOOLS_USE_DISTUTILS=stdlib "
|
|
||||||
echo "Using python $PYTHON3_VERSION to install $package_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cmd_pip="$cmd_pip install"
|
|
||||||
|
|
||||||
$xtrace
|
|
||||||
|
|
||||||
# adding SETUPTOOLS_SYS_PATH_TECHNIQUE is a workaround to keep
|
|
||||||
# the same behaviour of setuptools before version 25.0.0.
|
|
||||||
# related issue: https://github.com/pypa/pip/issues/3874
|
|
||||||
$sudo_pip \
|
|
||||||
http_proxy="${http_proxy:-}" \
|
|
||||||
https_proxy="${https_proxy:-}" \
|
|
||||||
no_proxy="${no_proxy:-}" \
|
|
||||||
PIP_FIND_LINKS=$PIP_FIND_LINKS \
|
|
||||||
SETUPTOOLS_SYS_PATH_TECHNIQUE=rewrite \
|
|
||||||
$cmd_pip $upgrade \
|
|
||||||
$@
|
|
||||||
result=$?
|
|
||||||
|
|
||||||
time_stop "pip_install"
|
|
||||||
return $result
|
|
||||||
}
|
|
||||||
|
|
||||||
# Restore xtrace
|
|
||||||
$INC_PY_TRACE
|
|
@ -13,8 +13,6 @@
|
|||||||
_XTRACE=$(set +o | grep xtrace)
|
_XTRACE=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
|
|
||||||
source $SKYLINE_APISERVER_DIR/devstack/inc/*
|
|
||||||
|
|
||||||
function _mkdir_chown_stack {
|
function _mkdir_chown_stack {
|
||||||
if [[ ! -d "$1" ]]; then
|
if [[ ! -d "$1" ]]; then
|
||||||
sudo mkdir -p "$1"
|
sudo mkdir -p "$1"
|
||||||
@ -30,9 +28,7 @@ function _skyline_config_set {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _install_skyline_apiserver {
|
function _install_skyline_apiserver {
|
||||||
pushd $SKYLINE_APISERVER_DIR
|
setup_develop $SKYLINE_APISERVER_DIR
|
||||||
make install
|
|
||||||
popd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _install_skyline_console {
|
function _install_skyline_console {
|
||||||
@ -47,9 +43,7 @@ function _install_skyline_console {
|
|||||||
fi
|
fi
|
||||||
pushd $DEST/skyline-console
|
pushd $DEST/skyline-console
|
||||||
make package
|
make package
|
||||||
source $DEST/skyline-apiserver/.venv/bin/activate
|
sudo pip3 install --force-reinstall dist/skyline_console-*.whl
|
||||||
pip install --force-reinstall dist/skyline_console-*.whl
|
|
||||||
deactivate
|
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,9 +68,6 @@ function _install_dependent_tools {
|
|||||||
install_package python3.8 python-is-python3 # make sure python exists
|
install_package python3.8 python-is-python3 # make sure python exists
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# poetry
|
|
||||||
contrib_pip_install poetry!=1.1.8
|
|
||||||
|
|
||||||
# nvm
|
# nvm
|
||||||
NVM_INSTALL_FILE_NAME=nvm-install.sh
|
NVM_INSTALL_FILE_NAME=nvm-install.sh
|
||||||
if [[ ! -f "$HOME/$NVM_INSTALL_FILE_NAME" ]]; then
|
if [[ ! -f "$HOME/$NVM_INSTALL_FILE_NAME" ]]; then
|
||||||
@ -168,12 +159,12 @@ function start_skyline {
|
|||||||
# skyline-apiserver Start
|
# skyline-apiserver Start
|
||||||
#-------------------------
|
#-------------------------
|
||||||
|
|
||||||
run_process "skyline" "$SKYLINE_APISERVER_DIR/.venv/bin/gunicorn -c /etc/skyline/gunicorn.py skyline_apiserver.main:app"
|
run_process "skyline" "/usr/local/bin/gunicorn -c /etc/skyline/gunicorn.py skyline_apiserver.main:app"
|
||||||
|
|
||||||
# skyline-console Configuration
|
# skyline-console Configuration
|
||||||
#-------------------------
|
#-------------------------
|
||||||
|
|
||||||
sudo $SKYLINE_APISERVER_DIR/.venv/bin/skyline-nginx-generator -o /etc/nginx/nginx.conf
|
sudo skyline-nginx-generator -o /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# skyline-console Start
|
# skyline-console Start
|
||||||
#-------------------------
|
#-------------------------
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- name: Find tarballs and wheels in dist folder
|
|
||||||
find:
|
|
||||||
file_type: file
|
|
||||||
paths: "src/{{ zuul.project.canonical_name }}/dist"
|
|
||||||
patterns: "*.tar.gz,*.whl"
|
|
||||||
register: result
|
|
||||||
|
|
||||||
- name: Display stat for tarballs and wheels
|
|
||||||
stat:
|
|
||||||
path: "{{ zj_tarball_wheel.path }}"
|
|
||||||
with_items: "{{ result.files }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: zj_tarball_wheel
|
|
||||||
|
|
||||||
- name: Ensure artifacts directory exists
|
|
||||||
file:
|
|
||||||
path: "{{ zuul.executor.work_root }}/artifacts"
|
|
||||||
state: directory
|
|
||||||
mode: 0755
|
|
||||||
delegate_to: localhost
|
|
||||||
|
|
||||||
- name: Collect artifacts
|
|
||||||
synchronize:
|
|
||||||
dest: "{{ zuul.executor.work_root }}/artifacts/"
|
|
||||||
mode: pull
|
|
||||||
src: "{{ zj_artifact.path }}"
|
|
||||||
verify_host: true
|
|
||||||
owner: no
|
|
||||||
group: no
|
|
||||||
with_items: "{{ result.files }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: zj_artifact
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
|||||||
- hosts: all
|
|
||||||
roles:
|
|
||||||
# We use ensure-pip to make sure the wheel module is installed
|
|
||||||
- ensure-pip
|
|
||||||
- revoke-sudo
|
|
@ -1,31 +0,0 @@
|
|||||||
- hosts: all
|
|
||||||
tasks:
|
|
||||||
- name: Install tox
|
|
||||||
shell:
|
|
||||||
executable: /bin/bash
|
|
||||||
cmd: |
|
|
||||||
# tox
|
|
||||||
pip3 install tox
|
|
||||||
|
|
||||||
- name: Build tarball and wheel
|
|
||||||
shell:
|
|
||||||
executable: /bin/bash
|
|
||||||
cmd: |
|
|
||||||
$HOME/.local/bin/tox -e package
|
|
||||||
args:
|
|
||||||
chdir: "src/{{ zuul.project.canonical_name }}"
|
|
||||||
|
|
||||||
- name: Rename whl files to branch specific name
|
|
||||||
shell: "mv {{ item }}*.whl {{ item }}-{{ zuul.branch | replace('/', '-') }}.whl"
|
|
||||||
args:
|
|
||||||
chdir: "src/{{ zuul.project.canonical_name }}/dist"
|
|
||||||
with_items:
|
|
||||||
- "skyline_apiserver"
|
|
||||||
|
|
||||||
- name: Rename tar.gz files to branch specific name
|
|
||||||
shell: "mv {{ item }}*.tar.gz {{ item }}-{{ zuul.branch | replace('/', '-') }}.tar.gz"
|
|
||||||
args:
|
|
||||||
chdir: "src/{{ zuul.project.canonical_name }}/dist"
|
|
||||||
with_items:
|
|
||||||
- "skyline-apiserver"
|
|
||||||
|
|
4431
poetry.lock
generated
4431
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,2 +0,0 @@
|
|||||||
[virtualenvs]
|
|
||||||
in-project = true
|
|
113
pyproject.toml
113
pyproject.toml
@ -1,113 +0,0 @@
|
|||||||
[tool.poetry]
|
|
||||||
name = "skyline-apiserver"
|
|
||||||
version = "0.1.0"
|
|
||||||
description = ""
|
|
||||||
license = "Apache-2.0"
|
|
||||||
authors = ["OpenStack <openstack-discuss@lists.openstack.org>"]
|
|
||||||
include = ["skyline_apiserver/db/alembic/alembic.ini"]
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = "^3.8"
|
|
||||||
fastapi = {extras = ["all"], version = "0.58.1"}
|
|
||||||
pydantic = "1.8.2"
|
|
||||||
PyYAML = "5.4.1"
|
|
||||||
immutables = "0.16"
|
|
||||||
uvicorn = {extras = ["standard"], version = "0.12.3"}
|
|
||||||
gunicorn = "20.1.0"
|
|
||||||
python-jose = "3.3.0"
|
|
||||||
alembic = "1.7.5"
|
|
||||||
httpx = "0.16.1"
|
|
||||||
sqlalchemy = "1.3.24"
|
|
||||||
databases = "0.4.3"
|
|
||||||
aiomysql = "0.0.21"
|
|
||||||
pymysql = "0.9.3"
|
|
||||||
aiosqlite = "0.17.0"
|
|
||||||
dnspython = "2.1.0"
|
|
||||||
loguru = "0.5.3"
|
|
||||||
click = "7.1.2"
|
|
||||||
jinja2 = "2.11.3"
|
|
||||||
markupsafe = "2.0.1"
|
|
||||||
python-keystoneclient = "3.21.0"
|
|
||||||
python-cinderclient = "5.0.2"
|
|
||||||
python-glanceclient = "2.17.1"
|
|
||||||
python-heatclient = "1.18.1"
|
|
||||||
python-neutronclient = "6.14.1"
|
|
||||||
python-novaclient = "15.1.1"
|
|
||||||
python-octaviaclient = "1.10.1"
|
|
||||||
osc-placement = "1.7.0"
|
|
||||||
keystoneauth1 = "3.17.4"
|
|
||||||
"oslo.policy" = "3.8.2"
|
|
||||||
skyline-console = "*"
|
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
|
||||||
reno = {extras = ["sphinx"], version = "^3.5.0"}
|
|
||||||
openstackdocstheme = "^2.4.0"
|
|
||||||
Sphinx = "4.5.0"
|
|
||||||
isort = "5.9.3"
|
|
||||||
black = "21.9b0"
|
|
||||||
add-trailing-comma = "2.1.0"
|
|
||||||
flake8 = "3.9.2"
|
|
||||||
mypy = "0.910"
|
|
||||||
pytest = "6.2.5"
|
|
||||||
pytest-xdist = "2.4.0"
|
|
||||||
pytest-asyncio = "0.15.1"
|
|
||||||
pytest-cov = "2.12.1"
|
|
||||||
pytest-html = "3.1.1"
|
|
||||||
mimesis = "4.1.3"
|
|
||||||
asgi-lifespan = "1.0.1"
|
|
||||||
types-PyYAML = "5.4.10"
|
|
||||||
"oslo.log" = "4.8.0"
|
|
||||||
neutron-lib = "2.15.0"
|
|
||||||
skyline-console = "*"
|
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
|
||||||
swagger-generator = 'skyline_apiserver.cmd.generate_swagger:main'
|
|
||||||
config-sample-generator = 'skyline_apiserver.cmd.generate_sample_config:main'
|
|
||||||
skyline-nginx-generator = 'skyline_apiserver.cmd.generate_nginx:main'
|
|
||||||
skyline-policy-manager = "skyline_apiserver.cmd.policy_manager:main"
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
|
||||||
minversion = "6.0"
|
|
||||||
addopts = "-v -s -p no:cacheprovider -n auto --cov=skyline_apiserver --cov-append --cov-report=term-missing --cov-report=html --html=test_results.html --self-contained-html"
|
|
||||||
testpaths = [
|
|
||||||
"skyline_apiserver/tests",
|
|
||||||
]
|
|
||||||
markers = [
|
|
||||||
"ddt(*args: TestData): Mark the test as a data-driven test."
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.black]
|
|
||||||
line-length = 98
|
|
||||||
target-version = ['py38']
|
|
||||||
include = '\.pyi?$'
|
|
||||||
exclude = '''
|
|
||||||
(
|
|
||||||
/(
|
|
||||||
\.eggs
|
|
||||||
| \.git
|
|
||||||
| \.hg
|
|
||||||
| \.mypy_cache
|
|
||||||
| \.tox
|
|
||||||
| \.venv
|
|
||||||
| _build
|
|
||||||
| buck-out
|
|
||||||
| build
|
|
||||||
| dist
|
|
||||||
)/
|
|
||||||
| exclude.py
|
|
||||||
)
|
|
||||||
'''
|
|
||||||
verbos = true
|
|
||||||
|
|
||||||
[tool.isort]
|
|
||||||
multi_line_output = 3
|
|
||||||
include_trailing_comma = true
|
|
||||||
force_grid_wrap = 0
|
|
||||||
use_parentheses = true
|
|
||||||
line_length = 98
|
|
||||||
reverse_relative = true
|
|
||||||
combine_as_imports = true
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry-core>=1.0.0"]
|
|
||||||
build-backend = "poetry.core.masonry.api"
|
|
7
pytest.ini
Normal file
7
pytest.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[pytest]
|
||||||
|
addopts =
|
||||||
|
-v -s -p no:cacheprovider -n auto --cov=skyline_apiserver --cov-append --cov-report=term-missing --cov-report=html --html=test_results.html --self-contained-html
|
||||||
|
testpaths =
|
||||||
|
skyline_apiserver/tests
|
||||||
|
markers =
|
||||||
|
ddt(*args: TestData): Mark the test as a data-driven test.
|
32
requirements.txt
Normal file
32
requirements.txt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
pbr>=5.8.0 # Apache-2.0
|
||||||
|
fastapi<=0.58.1 # MIT
|
||||||
|
pydantic<=1.8.2 # MIT
|
||||||
|
uvicorn<=0.17.6 # BSD License (3 clause)
|
||||||
|
gunicorn<=20.1.0 # MIT
|
||||||
|
python-jose<=3.3.0 # MIT
|
||||||
|
databases<=0.5.5 # BSD License (3 clause)
|
||||||
|
aiomysql<=0.1.1 # MIT
|
||||||
|
aiosqlite<=0.17.0 # MIT
|
||||||
|
loguru<=0.5.3 # MIT
|
||||||
|
PyYAML>=5.4.1,<=6.0 # MIT
|
||||||
|
immutables>=0.16,<=0.17 # Apache-2.0
|
||||||
|
alembic>=1.7.5,<=1.7.7 # MIT
|
||||||
|
httpx>=0.16.1,<=0.22.0 # BSD License (3 clause)
|
||||||
|
SQLAlchemy>=1.3.24,<=1.4.36 # MIT
|
||||||
|
PyMySQL>=0.9.3,<=1.0.2 # MIT
|
||||||
|
dnspython>=2.1.0,<=2.2.1 # ISC
|
||||||
|
click>=7.1.2,<=8.1.3 # BSD License (3 clause)
|
||||||
|
jinja2>=2.11.3,<=3.1.2 # BSD License (3 clause)
|
||||||
|
h11<0.13,>=0.11 # MIT
|
||||||
|
MarkupSafe>=2.0.1,<=2.1.1 # BSD License (3 clause)
|
||||||
|
python-keystoneclient>=3.21.0,<=4.5.0 # Apache-2.0
|
||||||
|
python-cinderclient>=5.0.2,<=8.3.0 # Apache-2.0
|
||||||
|
python-glanceclient>=2.17.1,<=4.0.0 # Apache-2.0
|
||||||
|
python-neutronclient>=6.14.1,<=7.8.0 # Apache-2.0
|
||||||
|
python-novaclient>=15.1.1,<=18.0.0 # Apache-2.0
|
||||||
|
keystoneauth1>=3.17.4,<=4.6.0 # Apache-2.0
|
||||||
|
oslo.policy>=2.3.4,<=3.12.1 # Apache-2.0
|
47
setup.cfg
Normal file
47
setup.cfg
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
[metadata]
|
||||||
|
name = skyline-apiserver
|
||||||
|
summary = OpenStack Skyline APIServer
|
||||||
|
description_file =
|
||||||
|
author = OpenStack
|
||||||
|
author_email = openstack-discuss@lists.openstack.org
|
||||||
|
home_page = https://docs.openstack.org/skyline-apiserver/latest/
|
||||||
|
python_requires = >=3.8
|
||||||
|
classifier =
|
||||||
|
Environment :: OpenStack
|
||||||
|
Intended Audience :: Information Technology
|
||||||
|
Intended Audience :: System Administrators
|
||||||
|
License :: OSI Approved :: Apache Software License
|
||||||
|
Operating System :: POSIX :: Linux
|
||||||
|
Programming Language :: Python
|
||||||
|
Programming Language :: Python :: Implementation :: CPython
|
||||||
|
Programming Language :: Python :: 3 :: Only
|
||||||
|
Programming Language :: Python :: 3
|
||||||
|
Programming Language :: Python :: 3.8
|
||||||
|
Programming Language :: Python :: 3.9
|
||||||
|
project_urls:
|
||||||
|
Source=https://opendev.org/openstack/skyline-apiserver
|
||||||
|
Tracker=https://bugs.launchpad.net/skyline-apiserver
|
||||||
|
|
||||||
|
[files]
|
||||||
|
packages =
|
||||||
|
skyline_apiserver
|
||||||
|
|
||||||
|
[entry_points]
|
||||||
|
console_scripts =
|
||||||
|
skyline-swagger-generator = skyline_apiserver.cmd.generate_swagger:main
|
||||||
|
skyline-sample-config-generator = skyline_apiserver.cmd.generate_sample_config:main
|
||||||
|
skyline-nginx-generator = skyline_apiserver.cmd.generate_nginx:main
|
||||||
|
skyline-policy-manager = skyline_apiserver.cmd.policy_manager:main
|
||||||
|
|
||||||
|
[mypy]
|
||||||
|
show_column_numbers = true
|
||||||
|
show_error_context = true
|
||||||
|
ignore_missing_imports = true
|
||||||
|
follow_imports = skip
|
||||||
|
incremental = true
|
||||||
|
check_untyped_defs = true
|
||||||
|
warn_unused_ignores = true
|
||||||
|
show_error_codes = true
|
||||||
|
pretty = true
|
||||||
|
html_report = mypy-report
|
||||||
|
no_implicit_optional = true
|
19
setup.py
Normal file
19
setup.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Copyright 2022 99cloud
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['pbr>=2.0.0'],
|
||||||
|
pbr=True)
|
@ -25,7 +25,6 @@ from keystoneclient.client import Client as KeystoneClient
|
|||||||
from keystoneclient.httpclient import HTTPClient
|
from keystoneclient.httpclient import HTTPClient
|
||||||
from neutronclient.v2_0.client import Client as NeutronClient
|
from neutronclient.v2_0.client import Client as NeutronClient
|
||||||
from novaclient.client import Client as NovaClient
|
from novaclient.client import Client as NovaClient
|
||||||
from osc_placement.http import SessionClient as PlacementClient
|
|
||||||
from starlette.concurrency import run_in_threadpool
|
from starlette.concurrency import run_in_threadpool
|
||||||
|
|
||||||
from skyline_apiserver import schemas
|
from skyline_apiserver import schemas
|
||||||
@ -169,14 +168,3 @@ async def neutron_client(
|
|||||||
global_request_id=global_request_id,
|
global_request_id=global_request_id,
|
||||||
)
|
)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
||||||
async def placement_client(
|
|
||||||
session: Session,
|
|
||||||
region: str,
|
|
||||||
version: str = constants.PLACEMENT_API_VERSION,
|
|
||||||
) -> HTTPClient:
|
|
||||||
endpoint = await get_endpoint(region, "placement", session=session)
|
|
||||||
ks_filter = {"service_type": "placement", "endpoint_override": endpoint}
|
|
||||||
client = PlacementClient(api_version=version, session=session, ks_filter=ks_filter)
|
|
||||||
return client
|
|
||||||
|
@ -19,7 +19,6 @@ NOVA_API_VERSION = "2.79"
|
|||||||
GLANCE_API_VERSION = "2"
|
GLANCE_API_VERSION = "2"
|
||||||
CINDER_API_VERSION = "3.59"
|
CINDER_API_VERSION = "3.59"
|
||||||
NEUTRON_API_VERSION = "2.0"
|
NEUTRON_API_VERSION = "2.0"
|
||||||
PLACEMENT_API_VERSION = "1.36"
|
|
||||||
|
|
||||||
# request_id middleware will set this into openstack.global_request_id environ
|
# request_id middleware will set this into openstack.global_request_id environ
|
||||||
INBOUND_HEADER = "X-Openstack-Request-Id"
|
INBOUND_HEADER = "X-Openstack-Request-Id"
|
||||||
|
21
test-requirements.txt
Normal file
21
test-requirements.txt
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# The order of packages is significant, because pip processes them in the order
|
||||||
|
# of appearance. Changing the order has an impact on the overall integration
|
||||||
|
# process, which may cause wedges in the gate later.
|
||||||
|
|
||||||
|
reno<=3.5.0 # Apache-2.0
|
||||||
|
openstackdocstheme<=2.4.0 # Apache-2.0
|
||||||
|
Sphinx<=4.5.0 # BSD
|
||||||
|
isort<=5.9.3 # MIT
|
||||||
|
black<=22.3.0 # MIT
|
||||||
|
flake8<=3.9.2 # MIT
|
||||||
|
mypy>=0.910,<=0.950 # MIT
|
||||||
|
pytest>=6.2.5,<=7.1.2 # MIT
|
||||||
|
pytest-xdist>=2.4.0,<=2.5.0 # MIT
|
||||||
|
pytest-asyncio<=0.15.1 # Apache-2.0
|
||||||
|
pytest-cov<=2.12.1 # MIT
|
||||||
|
pytest-html<=3.1.1 # MPL 2.0
|
||||||
|
mimesis<=4.1.3 # MIT
|
||||||
|
asgi-lifespan<=1.0.1 # MIT
|
||||||
|
types-PyYAML<=5.4.10 # Apache-2.0
|
||||||
|
oslo.log<=5.0.0 # Apache-2.0
|
||||||
|
neutron-lib>=2.15.0,<=2.21.0 # Apache-2.0
|
19
tools/mypywrap.sh
Normal file
19
tools/mypywrap.sh
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# A wrapper around mypy that allows us to specify what files to run 'mypy' type
|
||||||
|
# checks on. Intended to be invoked via tox:
|
||||||
|
#
|
||||||
|
# tox -e mypy
|
||||||
|
#
|
||||||
|
# Eventually this should go away once we have either converted everything or
|
||||||
|
# converted enough and ignored [1] the rest.
|
||||||
|
#
|
||||||
|
# [1] http://mypy.readthedocs.io/en/latest/config_file.html#per-module-flags
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
# if no arguments provided, use the standard converted lists
|
||||||
|
python -m mypy skyline_apiserver
|
||||||
|
else
|
||||||
|
# else test what the user asked us to
|
||||||
|
python -m mypy $@
|
||||||
|
fi
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Install openstack service package
|
# Install openstack service package
|
||||||
poetry run pip install --no-deps \
|
pip install --no-deps \
|
||||||
keystone \
|
keystone \
|
||||||
openstack-placement \
|
openstack-placement \
|
||||||
nova \
|
nova \
|
||||||
@ -17,17 +17,17 @@ poetry run pip install --no-deps \
|
|||||||
magnum
|
magnum
|
||||||
|
|
||||||
# Patch cinder
|
# Patch cinder
|
||||||
patch_path="$(poetry run python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/cinder/__init__.py"
|
patch_path="$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/cinder/__init__.py"
|
||||||
sed -i 's/\(.*eventlet.*\)/# \1/g' $patch_path
|
sed -i 's/\(.*eventlet.*\)/# \1/g' $patch_path
|
||||||
|
|
||||||
# Patch neutron
|
# Patch neutron
|
||||||
patch_path="$(poetry run python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/neutron/conf/policies/floatingip_pools.py"
|
patch_path="$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/neutron/conf/policies/floatingip_pools.py"
|
||||||
sed -i 's/admin/system/g' $patch_path
|
sed -i 's/admin/system/g' $patch_path
|
||||||
|
|
||||||
# Patch ironic
|
# Patch ironic
|
||||||
patch_path="$(poetry run python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/ironic/common/policy.py"
|
patch_path="$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/ironic/common/policy.py"
|
||||||
sed -i 's/\(.*lockutils.*\)/# \1/g' $patch_path
|
sed -i 's/\(.*lockutils.*\)/# \1/g' $patch_path
|
||||||
|
|
||||||
# Patch ironic_inspector
|
# Patch ironic_inspector
|
||||||
patch_path="$(poetry run python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/ironic_inspector/policy.py"
|
patch_path="$(python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')/ironic_inspector/policy.py"
|
||||||
sed -i 's/\(.*lockutils.*\)/# \1/g' $patch_path
|
sed -i 's/\(.*lockutils.*\)/# \1/g' $patch_path
|
||||||
|
137
tox.ini
137
tox.ini
@ -1,46 +1,127 @@
|
|||||||
[tox]
|
[tox]
|
||||||
minversion = 3.18.0
|
minversion = 3.18.0
|
||||||
# python runtimes: https://governance.openstack.org/tc/reference/runtimes/ussuri.html
|
requires = virtualenv>=20.4.2
|
||||||
envlist = unittest-py38,lint,functional,package
|
skipsdist = True
|
||||||
skipsdist=true
|
# python runtimes: https://governance.openstack.org/tc/reference/project-testing-interface.html#tested-runtimes
|
||||||
|
envlist = pep8,py38,functional
|
||||||
# this allows tox to infer the base python from the environment name
|
# this allows tox to infer the base python from the environment name
|
||||||
# and override any basepython configured in this file
|
# and override any basepython configured in this file
|
||||||
ignore_basepython_conflict=true
|
ignore_basepython_conflict=true
|
||||||
isolated_build=true
|
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
# Set default python version
|
|
||||||
basepython = python3
|
basepython = python3
|
||||||
whitelist_externals =
|
setenv = VIRTUAL_ENV={envdir}
|
||||||
make
|
PYTHONWARNINGS=default::DeprecationWarning
|
||||||
poetry
|
OS_STDOUT_CAPTURE=1
|
||||||
rm
|
OS_STDERR_CAPTURE=1
|
||||||
deps = poetry != 1.1.8
|
usedevelop = True
|
||||||
|
|
||||||
[testenv:unittest-py38]
|
deps =
|
||||||
commands =
|
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
|
||||||
make install
|
-r{toxinidir}/requirements.txt
|
||||||
make test
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
[testenv:lint]
|
allowlist_externals =
|
||||||
commands =
|
find
|
||||||
make install
|
bash
|
||||||
make lint
|
isort
|
||||||
|
|
||||||
[testenv:functional]
|
|
||||||
whitelist_externals =
|
|
||||||
echo
|
echo
|
||||||
commands =
|
passenv = *_proxy *_PROXY
|
||||||
echo "TODO: Add functional test for skyline-apiserver"
|
|
||||||
|
|
||||||
[testenv:package]
|
[testenv:venv]
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
extras =
|
||||||
commands =
|
commands =
|
||||||
make package
|
{posargs}
|
||||||
|
|
||||||
|
[testenv:policyenv]
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
description =
|
||||||
|
Policy Env.
|
||||||
|
extras =
|
||||||
|
commands =
|
||||||
|
bash tools/post_install.sh
|
||||||
|
{posargs}
|
||||||
|
|
||||||
|
[testenv:mypy]
|
||||||
|
description =
|
||||||
|
Run type checks.
|
||||||
|
envdir = {toxworkdir}/shared
|
||||||
|
extras =
|
||||||
|
commands =
|
||||||
|
bash tools/mypywrap.sh {posargs}
|
||||||
|
|
||||||
|
[testenv:pep8]
|
||||||
|
description =
|
||||||
|
Run style checks.
|
||||||
|
envdir = {toxworkdir}/shared
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
extras =
|
||||||
|
commands =
|
||||||
|
; {[testenv:mypy]commands}
|
||||||
|
isort --check-only --diff skyline_apiserver
|
||||||
|
black --check --diff --color skyline_apiserver --line-length 98
|
||||||
|
flake8 {posargs} .
|
||||||
|
|
||||||
|
[testenv:py38]
|
||||||
|
description =
|
||||||
|
Run pytest.
|
||||||
|
envdir = {toxworkdir}/shared
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
extras =
|
||||||
|
commands =
|
||||||
|
pytest
|
||||||
|
|
||||||
[testenv:releasenotes]
|
[testenv:releasenotes]
|
||||||
description =
|
description =
|
||||||
Generate release notes.
|
Generate release notes.
|
||||||
commands =
|
commands =
|
||||||
poetry install -vvv
|
sphinx-build -W --keep-going -b html -j auto releasenotes/source releasenotes/build/html
|
||||||
rm -rf releasenotes/build
|
|
||||||
poetry run sphinx-build -W --keep-going -b html -j auto releasenotes/source releasenotes/build/html
|
[testenv:genswagger]
|
||||||
|
description =
|
||||||
|
Generate swagger files.
|
||||||
|
commands =
|
||||||
|
skyline-swagger-generator -o docs/api/swagger.json
|
||||||
|
|
||||||
|
[testenv:genconfig]
|
||||||
|
description =
|
||||||
|
Generate config files.
|
||||||
|
commands =
|
||||||
|
skyline-sample-config-generator -o etc/skyline.yaml.sample
|
||||||
|
|
||||||
|
[testenv:gennginx]
|
||||||
|
description =
|
||||||
|
Generate nginx config files.
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
skyline-console
|
||||||
|
commands =
|
||||||
|
skyline-nginx-generator -o etc/nginx.conf
|
||||||
|
|
||||||
|
[testenv:functional]
|
||||||
|
commands =
|
||||||
|
echo "TODO: Add functional test for skyline-apiserver"
|
||||||
|
|
||||||
|
[testenv:pep8-format]
|
||||||
|
description =
|
||||||
|
Run code format.
|
||||||
|
envdir = {toxworkdir}/shared
|
||||||
|
deps =
|
||||||
|
{[testenv]deps}
|
||||||
|
extras =
|
||||||
|
commands =
|
||||||
|
isort skyline_apiserver
|
||||||
|
black skyline_apiserver --line-length 98
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
# E203 whitespace before ':'
|
||||||
|
extend-ignore = E203
|
||||||
|
max-line-length = 99
|
||||||
|
max-doc-length = 99
|
||||||
|
show-source = True
|
||||||
|
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes
|
||||||
|
Loading…
Reference in New Issue
Block a user