Skip to content

auto codegen for UCDN #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,7 @@ venv.bak/
# Debug
*.stackdump
examples/debug
bdd/
.version

scripts/gen-apis.sh
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ install: pip install -e .[ci]
script:
- make lint
- make test-cov
- make release-check

after_success:
- bash <(curl -s https://codecov.io/bash)
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ clean-test:
rm -f .coverage
rm -fr htmlcov/

gen:
ucloud-model sdk apis \
--lang python3 \
--type=public \
--template ${UCLOUD_TEMPLATE_PATH}/scripts-api.tpl \
--output ./scripts/gen-services.sh
ucloud-model sdk tests \
--lang python3 \
--template ${UCLOUD_TEMPLATE_PATH}/scripts-test.tpl \
--output ./scripts/gen-tests.sh
version:
@python -c 'from ucloud.version import version; print(version)'

codegen:
@bash ./scripts/codegen.sh

release-check:
@python scripts/release.py --dry-run

release:
@python scripts/release.py
20 changes: 10 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

# -- Project information -----------------------------------------------------

project = 'ucloud-sdk-python3'
copyright = '2019, ucloud'
author = 'ucloud'
project = "ucloud-sdk-python3"
copyright = "2019, ucloud"
author = "ucloud"


# -- General configuration ---------------------------------------------------
Expand All @@ -28,14 +28,14 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -48,9 +48,9 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = "alabaster"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
18 changes: 9 additions & 9 deletions docs/services.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
UCloud SDK Services
===================

PathX
-----

.. autoclass:: ucloud.services.pathx.client.PathXClient
:members:

StepFlow
--------

Expand All @@ -19,6 +13,12 @@ UAccount
.. autoclass:: ucloud.services.uaccount.client.UAccountClient
:members:

UCDN
----

.. autoclass:: ucloud.services.ucdn.client.UCDNClient
:members:

UDB
---

Expand Down Expand Up @@ -67,9 +67,9 @@ UPHost
.. autoclass:: ucloud.services.uphost.client.UPHostClient
:members:

VPC
---
USMS
----

.. autoclass:: ucloud.services.vpc.client.VPCClient
.. autoclass:: ucloud.services.usms.client.USMSClient
:members:

17 changes: 17 additions & 0 deletions scripts/codegen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

#set -u
set -e

if [ -n "$PRODUCT" ]; then
ucloud-model sync --lang python --product "$PRODUCT"
ucloud-model sdk apis --type public --product "$PRODUCT" --lang python --template "$U_MODEL_HOME"/providers/python/templates/scripts-api.tpl --output scripts/gen-apis.sh
bash ./scripts/gen-apis.sh
fi

if [ -n "$TEST" ]; then
IFS=',' read -ra TL <<< "$TEST"
for i in "${TL[@]}"; do
ucloud-model sdk test --name "$i" --lang python --template "$U_MODEL_HOME"/providers/python/templates/testing.tpl --output tests/test_services/test_set_"$i".py
done
fi
116 changes: 0 additions & 116 deletions scripts/gen-services.sh

This file was deleted.

Loading