Skip to content

Commit 4d3038c

Browse files
committed
update
1 parent 6462a33 commit 4d3038c

7 files changed

Lines changed: 48 additions & 189 deletions

File tree

.gitignore

Lines changed: 5 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -1,174 +1,5 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
share/python-wheels/
24-
*.egg-info/
25-
.installed.cfg
26-
*.egg
27-
MANIFEST
28-
29-
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32-
*.manifest
33-
*.spec
34-
35-
# Installer logs
36-
pip-log.txt
37-
pip-delete-this-directory.txt
38-
39-
# Unit test / coverage reports
40-
htmlcov/
41-
.tox/
42-
.nox/
43-
.coverage
44-
.coverage.*
45-
.cache
46-
nosetests.xml
47-
coverage.xml
48-
*.cover
49-
*.py,cover
50-
.hypothesis/
51-
.pytest_cache/
52-
cover/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
.pybuilder/
76-
target/
77-
78-
# Jupyter Notebook
79-
.ipynb_checkpoints
80-
81-
# IPython
82-
profile_default/
83-
ipython_config.py
84-
85-
# pyenv
86-
# For a library or package, you might want to ignore these files since the code is
87-
# intended to run in multiple environments; otherwise, check them in:
88-
# .python-version
89-
90-
# pipenv
91-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94-
# install all needed dependencies.
95-
#Pipfile.lock
96-
97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
102-
103-
# poetry
104-
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105-
# This is especially recommended for binary packages to ensure reproducibility, and is more
106-
# commonly ignored for libraries.
107-
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108-
#poetry.lock
109-
110-
# pdm
111-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112-
#pdm.lock
113-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114-
# in version control.
115-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116-
.pdm.toml
117-
.pdm-python
118-
.pdm-build/
119-
120-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121-
__pypackages__/
122-
123-
# Celery stuff
124-
celerybeat-schedule
125-
celerybeat.pid
126-
127-
# SageMath parsed files
128-
*.sage.py
129-
130-
# Environments
131-
.env
132-
.venv
133-
env/
134-
venv/
135-
ENV/
136-
env.bak/
137-
venv.bak/
138-
139-
# Spyder project settings
140-
.spyderproject
141-
.spyproject
142-
143-
# Rope project settings
144-
.ropeproject
145-
146-
# mkdocs documentation
147-
/site
148-
149-
# mypy
150-
.mypy_cache/
151-
.dmypy.json
152-
dmypy.json
153-
154-
# Pyre type checker
155-
.pyre/
156-
157-
# pytype static type analyzer
158-
.pytype/
159-
160-
# Cython debug symbols
161-
cython_debug/
162-
163-
# PyCharm
164-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166-
# and can be added to the global gitignore or merged into this file. For a more nuclear
167-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
168-
#.idea/
169-
170-
# Ruff stuff:
171-
.ruff_cache/
172-
173-
# PyPI configuration file
174-
.pypirc
1+
.DS_Store
2+
Thumbs.db
3+
.vscode/
4+
.idea/
5+
*.swp

Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
FROM python:3.13-alpine AS base
2-
ENV PYTHONUNBUFFERED=1
3-
RUN mkdir /.cache && \
2+
ENV PYTHONUNBUFFERED=1 \
3+
TALKOPS_SOCKET=/tmp/talkops.sock \
4+
TALKOPS_STDERR=/tmp/talkops.stderr.log \
5+
TALKOPS_STDOUT=/tmp/talkops.stdout.log
6+
RUN apk add --no-cache nodejs npm && \
7+
npm install -g pm2@6.0.6 talkops-client@1.0.0 && \
8+
mkdir /.cache && \
49
mkdir /.local && \
10+
mkdir /.pm2 && \
511
mkdir /app && \
612
mkdir /data && \
7-
chown -R 1000:1000 /.cache /.local /app /data
13+
chown -R 1000:1000 /.cache /.local /.pm2 /app /data
814
WORKDIR /app
915

1016
FROM base AS dev
11-
ENV ENV=development
12-
RUN pip install --no-cache-dir watchdog
1317
USER 1000:1000
1418
VOLUME [ "/app" ]
1519
ENTRYPOINT [ "./entrypoint.sh" ]
16-
CMD ["watchmedo", "auto-restart", "--directory=.", "--pattern=*.py", "--recursive", "--", "python", "main.py" ]
20+
CMD ["pm2-runtime", "ecosystem.config.cjs"]
1721

1822
FROM base
19-
ENV ENV=production
2023
COPY requirements.txt .
2124
RUN pip install --no-cache-dir -r requirements.txt
22-
COPY main.py .
2325
COPY src src
2426
USER 1000:1000
25-
CMD ["python", "main.py"]
27+
CMD ["pm2-runtime", "ecosystem.config.cjs"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# TalkOps Extension: Playground Python
1+
# TalkOps Extension: Python Playground
22

33
A TalkOps Extension made to work with [TalkOps](https://talkops.app).
44

@@ -17,5 +17,5 @@ A TalkOps Extension made to work with [TalkOps](https://talkops.app).
1717
## Installation
1818

1919
1. Sign in to [TalkOps](https://talkops.app).
20-
2. Search for the `Playground Python` extension.
20+
2. Search for the `Python Playground` extension.
2121
3. Add the extension and follow the instructions.

ecosystem.config.cjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
apps: [
3+
{
4+
cmd: 'talkops',
5+
name: 'client',
6+
},
7+
{
8+
autorestart: true,
9+
error_file: process.env.TALKOPS_STDERR,
10+
ignore_watch: [
11+
'.git',
12+
'.github',
13+
'.gitignore',
14+
'Dockerfile',
15+
'ecosystem.config.cjs',
16+
'LICENSE',
17+
'manifest.json',
18+
'README.md',
19+
],
20+
name: 'extension',
21+
out_file: process.env.TALKOPS_STDOUT,
22+
script: 'src/main.py',
23+
watch: true,
24+
},
25+
],
26+
}

manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"Receive a random video"
1212
],
1313
"icon": "https://talkops.app/images/extensions/playground-python.png",
14-
"name": "Playground Python",
14+
"name": "Python Playground",
1515
"sdk": {
1616
"name": "python",
17-
"version": "1.3.1"
17+
"version": "1.3.3"
1818
},
1919
"softwareVersion": null,
2020
"website": null

src/.gitkeep

Whitespace-only changes.

main.py renamed to src/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
extension = (
66
Extension()
7-
.set_name('Playground Python')
7+
.set_name('Python Playground')
88
.set_icon('https://talkops.app/images/extensions/playground-python.png')
99
.set_category('utility')
1010
.set_demo(True)
@@ -42,7 +42,7 @@ def receive_random_dice():
4242
return str(random.randint(1, 6))
4343

4444
async def receive_random_dice_asynchronously():
45-
await asyncio.sleep(2)
45+
await asyncio.sleep(10)
4646
return str(random.randint(1, 6))
4747

4848
def receive_random_dice_message():

0 commit comments

Comments
 (0)