Skip to content

Commit 4672591

Browse files
author
Wauplin
committed
initial commit
0 parents  commit 4672591

23 files changed

+3387
-0
lines changed

.flake8

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[flake8]
2+
exclude =
3+
.git,
4+
__pycache__,
5+
.venv
6+
ignore=E203, W503, G200 # incompatible with black
7+
per-file-ignores =
8+
streamlit_sync/__init__.py:F401
9+
streamlit_sync/st_hack.py:F401
10+
max-line-length = 88

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Taken from https://github.com/whitphx/streamlit-server-state/blob/main/.github/workflows/publish.yml
2+
name: Upload Python Package
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/[email protected]
14+
15+
- name: Set up Python
16+
uses: actions/[email protected]
17+
with:
18+
python-version: "3.10"
19+
20+
- name: Install poetry
21+
run: |
22+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
23+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
24+
25+
- name: Install Python dependencies
26+
run: poetry install
27+
28+
- name: Build and publish
29+
env:
30+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
31+
run: |
32+
poetry publish --build -u __token__ -p ${PYPI_TOKEN}

.github/workflows/tests.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Taken from https://github.com/whitphx/streamlit-server-state/blob/main/.github/workflows/tests.yml
2+
name: Tests
3+
4+
on:
5+
push:
6+
branches: [main]
7+
pull_request:
8+
branches: [main]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: [3.7, 3.8, 3.9]
16+
streamlit-version: [null]
17+
include:
18+
- python-version: 3.9
19+
streamlit-version: 1.0.0
20+
- python-version: 3.9
21+
streamlit-version: 1.7.0
22+
- python-version: 3.9
23+
streamlit-version: 1.8.0
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- name: Install poetry
34+
run: |
35+
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
36+
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
37+
38+
# Ref: https://github.com/python-poetry/poetry/blob/de0b32c245c72568cf546090600d4626917cd3a4/.github/workflows/main.yml#L46-L60
39+
- name: Configure poetry
40+
run: poetry config virtualenvs.in-project true
41+
- name: Set up cache
42+
uses: actions/[email protected]
43+
id: cache
44+
with:
45+
path: .venv
46+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
47+
- name: Ensure cache is healthy
48+
if: steps.cache.outputs.cache-hit == 'true'
49+
shell: bash
50+
run: timeout 10s poetry run pip --version || rm -rf .venv
51+
52+
- name: Install a specific version of Streamlit
53+
if: ${{ matrix.streamlit-version }}
54+
run: poetry add -D streamlit=="${STREAMLIT_VERSION}"
55+
env:
56+
STREAMLIT_VERSION: ${{ matrix.streamlit-version }}
57+
58+
- name: Install dependencies
59+
run: poetry install
60+
61+
- name: Lint with black, isort, and flake8
62+
run: |
63+
poetry run black . --check
64+
poetry run isort . --check
65+
poetry run flake8
66+
67+
# Mypy checks currently not working on all versions of streamlit
68+
# - name: Type checking with mypy
69+
# run: |
70+
# poetry run mypy streamlit_sync
71+
72+
- name: Test with pytest
73+
run: |
74+
poetry run pytest streamlit_sync_tests

.gitignore

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
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+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.venv
106+
env/
107+
venv/
108+
ENV/
109+
env.bak/
110+
venv.bak/
111+
112+
# Spyder project settings
113+
.spyderproject
114+
.spyproject
115+
116+
# Rope project settings
117+
.ropeproject
118+
119+
# mkdocs documentation
120+
/site
121+
122+
# mypy
123+
.mypy_cache/
124+
.dmypy.json
125+
dmypy.json
126+
127+
# Pyre type checker
128+
.pyre/
129+
130+
131+
# Created by https://www.toptal.com/developers/gitignore/api/macos
132+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos
133+
134+
### macOS ###
135+
# General
136+
.DS_Store
137+
.AppleDouble
138+
.LSOverride
139+
140+
# Icon must end with two \r
141+
Icon
142+
143+
144+
# Thumbnails
145+
._*
146+
147+
# Files that might appear in the root of a volume
148+
.DocumentRevisions-V100
149+
.fseventsd
150+
.Spotlight-V100
151+
.TemporaryItems
152+
.Trashes
153+
.VolumeIcon.icns
154+
.com.apple.timemachine.donotpresent
155+
156+
# Directories potentially created on remote AFP share
157+
.AppleDB
158+
.AppleDesktop
159+
Network Trash Folder
160+
Temporary Items
161+
.apdisk
162+
163+
# End of https://www.toptal.com/developers/gitignore/api/macos

.vscode/settings.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.rulers": [
4+
88
5+
],
6+
"python.formatting.provider": "black",
7+
"python.linting.enabled": true,
8+
"python.linting.flake8Enabled": true,
9+
"python.linting.mypyEnabled": true,
10+
"python.linting.pylintEnabled": false,
11+
"python.pythonPath": ".venv/bin/python",
12+
"[python]": {
13+
"editor.codeActionsOnSave": {
14+
"source.organizeImports": true
15+
}
16+
},
17+
"python.testing.unittestEnabled": false,
18+
"python.testing.nosetestsEnabled": false,
19+
"python.testing.pytestEnabled": true,
20+
"cSpell.words": [
21+
"streamlit"
22+
],
23+
}

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2022 Wauplin
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19+
OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)