Skip to content

Commit e1de006

Browse files
committed
Initial commit
0 parents  commit e1de006

File tree

17 files changed

+1686
-0
lines changed

17 files changed

+1686
-0
lines changed

.github/workflows/ci_cd.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Push commit
2+
on:
3+
release:
4+
types: [ created ]
5+
push:
6+
branches:
7+
- '*'
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-22.04
17+
env:
18+
UV_PYTHON: 3.9
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: astral-sh/setup-uv@v5
22+
with:
23+
python-version: 3.9
24+
25+
- name: Install dependencies
26+
run: uv sync --dev
27+
28+
- name: Check formatting with Ruff
29+
run: ruff check
30+
31+
- name: Build
32+
run: |
33+
if [[ '${{ github.event_name }}' = 'release' ]]; then
34+
sed -i -e "s/0.dev.0/$GITHUB_REF_NAME/g" pyproject.toml
35+
fi
36+
uv build
37+
mkdir thedus_build
38+
mv ./dist ./thedus_build
39+
- name: Upload thedus package
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: dist
43+
path: thedus_build
44+
retention-days: 90
45+
46+
tests:
47+
runs-on: ubuntu-22.04
48+
permissions: write-all
49+
needs: [ build ]
50+
services:
51+
clickhouse:
52+
image: clickhouse/clickhouse-server:latest
53+
ports:
54+
- 9000:9000
55+
options: >-
56+
--health-cmd "wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1"
57+
--health-interval 10s
58+
--health-timeout 5s
59+
--health-retries 5
60+
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
65+
env:
66+
UV_PYTHON: ${{ matrix.python-version }}
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
- uses: astral-sh/setup-uv@v5
71+
with:
72+
python-version: ${{ matrix.python-version }}
73+
74+
- name: Download thedus package
75+
uses: actions/download-artifact@v4
76+
with:
77+
name: dist
78+
79+
- name: Install dependencies
80+
run: uv sync --dev
81+
82+
- name: Install thedus
83+
run: uv pip install dist/$(ls ./dist/ | grep ".tar.gz")
84+
85+
- name: Run tests
86+
run: |
87+
mkdir -p ./tests/migrations
88+
pytest tests
89+
90+
publish_to_PyPi:
91+
runs-on: ubuntu-22.04
92+
needs: [ tests ]
93+
if: github.event_name == 'release' && github.event.action == 'created'
94+
environment:
95+
name: pypi
96+
url: https://pypi.org/p/thedus
97+
permissions:
98+
id-token: write
99+
steps:
100+
- name: Download thedus package
101+
uses: actions/download-artifact@v4
102+
with:
103+
name: dist
104+
- name: Publish to PyPI
105+
uses: pypa/gh-action-pypi-publish@release/v1
106+
with:
107+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
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+
# PyPI configuration file
171+
.pypirc

LICENSE

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

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Thedus
2+
3+
[Thedus](https://github.com/d-ganchar/thedus) is a lightweight migration tool for [Clickhouse](https://clickhouse.com/)
4+
5+
```bash
6+
$ pip install thedus
7+
```
8+
9+
<hr/>
10+
11+
<a href="https://pypi.org/project/thedus/" target="_blank">
12+
<img src="https://img.shields.io/pypi/v/thedus.svg?logo=pypi&logoColor=FFE200" alt="pypi"/>
13+
</a>
14+
15+
[//]: # (<a href="https://www.pepy.tech/projects/thedus" target="_blank">)
16+
17+
[//]: # ( <img src="https://static.pepy.tech/badge/thedus" alt="total downloads"/>)
18+
19+
[//]: # (</a>)
20+
21+
[//]: # (<a href="https://www.pepy.tech/projects/thedus" target="_blank">)
22+
23+
[//]: # ( <img src="https://img.shields.io/pypi/dm/thedus.svg?logo=docusign&logoColor=FFE200" alt="monthly downloads"/>)
24+
25+
[//]: # (</a>)
26+
27+
[//]: # (<a href="https://github.com/d-ganchar/thedus/tree/main/thedus" target="_blank">)
28+
29+
[//]: # ( <img src="https://img.shields.io/github/languages/code-size/d-ganchar/thedus.svg?logo=Dropbox&logoColor=ACD2F6" alt="pkg size"/>)
30+
31+
[//]: # (</a>)
32+
<a href="https://github.com/d-ganchar/thedus/wiki" target="_blank">
33+
<img alt="Static Badge" src="https://img.shields.io/badge/github-wiki-blue"/>
34+
</a>

docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '3.8'
2+
3+
services:
4+
clickhouse:
5+
image: clickhouse/clickhouse-server:23.4.2.11-alpine
6+
container_name: thedus_clickhouse
7+
logging:
8+
driver: none
9+
ports:
10+
- "9000:9000"
11+
- "8123:8123"
12+
healthcheck:
13+
test: wget --no-verbose --tries=1 --spider localhost:8123/ping || exit 1
14+
interval: 2s
15+
timeout: 2s
16+
retries: 16

0 commit comments

Comments
 (0)