Skip to content

Commit b1fc599

Browse files
authored
feat: Hidden command to show project version (#16)
1 parent f960f9f commit b1fc599

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ jobs:
4444

4545
- name: Install copier
4646
run: |
47-
pip install copier
47+
pip install copier==7.1.0
4848
pip install copier-templates-extensions
49+
# hardcode pydantic version to avoid dependency conflict with copier
50+
pip install pydantic==1.10.2
4951
5052
- name: Test image
5153
env:
@@ -90,8 +92,10 @@ jobs:
9092

9193
- name: Install copier
9294
run: |
93-
pip install copier
95+
pip install copier==7.1.0
9496
pip install copier-templates-extensions
97+
# hardcode pydantic version to avoid dependency conflict with copier
98+
pip install pydantic==1.10.2
9599
python -m copier --defaults . async-box-bot
96100
97101
- name: Set up Python ${{ matrix.python-version }}
@@ -142,8 +146,10 @@ jobs:
142146

143147
- name: Install copier
144148
run: |
145-
pip install copier
149+
pip install copier==7.1.0
146150
pip install copier-templates-extensions
151+
# hardcode pydantic version to avoid dependency conflict with copier
152+
pip install pydantic==1.10.2
147153
python -m copier --defaults . async-box-bot
148154
149155
- name: Set up Python ${{ matrix.python-version }}

app/smartapp/rpc_methods/common.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Handlers for default smartapp rpc methods."""
22
from os import environ
3+
from subprocess import PIPE, STDOUT, run
34

45
from pybotx_smart_logger import smart_log
56
from pybotx_smartapp_rpc import RPCArgsBaseModel, RPCResultResponse, RPCRouter, SmartApp
@@ -63,3 +64,11 @@ async def test_db(smartapp: SmartApp) -> RPCResultResponse[str]:
6364
@rpc.method("debug:git-commit-sha")
6465
async def test_redis_callback_repo(smartapp: SmartApp) -> RPCResultResponse[str]:
6566
return RPCResultResponse(environ.get("GIT_COMMIT_SHA", "<undefined>"))
67+
68+
69+
@rpc.method("debug:version")
70+
async def build_version(smartapp: SmartApp) -> RPCResultResponse[str]:
71+
"""Show app version."""
72+
cmd = "poetry version --short"
73+
output = run(cmd.split(), stdout=PIPE, stderr=STDOUT, text=True).stdout
74+
return RPCResultResponse(output)

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ per-file-ignores =
7070
# line too long
7171
app/resources/strings.py:E501
7272
tests/*:D100,WPS110,WPS116,WPS118,WPS201,WPS204,WPS235,WPS430,WPS442,WPS432
73-
# too many imported names
74-
app/bot/commands/common.py:WPS235
73+
# too many imported names, subprocess usage
74+
app/smartapp/rpc_methods/common.py:WPS235,S404,S603
7575
# names shadowing
7676
# `%` string formatting
7777
app/db/sqlalchemy.py:WPS442,WPS323

0 commit comments

Comments
 (0)