jetbase 0.12.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. jetbase-0.12.2/.github/workflows/ci.yml +236 -0
  2. jetbase-0.12.2/.github/workflows/publish.yml +32 -0
  3. jetbase-0.12.2/.github/workflows/publish_docs.yml +27 -0
  4. jetbase-0.12.2/.gitignore +177 -0
  5. jetbase-0.12.2/.pre-commit-config.yaml +14 -0
  6. jetbase-0.12.2/LICENSE +21 -0
  7. jetbase-0.12.2/PKG-INFO +135 -0
  8. jetbase-0.12.2/README.md +121 -0
  9. jetbase-0.12.2/docs/advanced/index.md +13 -0
  10. jetbase-0.12.2/docs/advanced/migration-locking.md +139 -0
  11. jetbase-0.12.2/docs/advanced/migration-types.md +258 -0
  12. jetbase-0.12.2/docs/commands/current.md +44 -0
  13. jetbase-0.12.2/docs/commands/fix.md +32 -0
  14. jetbase-0.12.2/docs/commands/history.md +87 -0
  15. jetbase-0.12.2/docs/commands/index.md +71 -0
  16. jetbase-0.12.2/docs/commands/init.md +88 -0
  17. jetbase-0.12.2/docs/commands/lock-status.md +60 -0
  18. jetbase-0.12.2/docs/commands/new.md +103 -0
  19. jetbase-0.12.2/docs/commands/rollback.md +165 -0
  20. jetbase-0.12.2/docs/commands/status.md +110 -0
  21. jetbase-0.12.2/docs/commands/unlock.md +42 -0
  22. jetbase-0.12.2/docs/commands/upgrade.md +143 -0
  23. jetbase-0.12.2/docs/commands/validate-checksums.md +132 -0
  24. jetbase-0.12.2/docs/commands/validate-files.md +119 -0
  25. jetbase-0.12.2/docs/configuration.md +183 -0
  26. jetbase-0.12.2/docs/getting-started.md +184 -0
  27. jetbase-0.12.2/docs/index.md +122 -0
  28. jetbase-0.12.2/docs/migrations/index.md +169 -0
  29. jetbase-0.12.2/docs/validations/index.md +166 -0
  30. jetbase-0.12.2/jetbase/cli/main.py +203 -0
  31. jetbase-0.12.2/jetbase/commands/current.py +20 -0
  32. jetbase-0.12.2/jetbase/commands/fix_checksums.py +172 -0
  33. jetbase-0.12.2/jetbase/commands/fix_files.py +133 -0
  34. jetbase-0.12.2/jetbase/commands/history.py +53 -0
  35. jetbase-0.12.2/jetbase/commands/init.py +26 -0
  36. jetbase-0.12.2/jetbase/commands/lock_status.py +25 -0
  37. jetbase-0.12.2/jetbase/commands/new.py +65 -0
  38. jetbase-0.12.2/jetbase/commands/rollback.py +172 -0
  39. jetbase-0.12.2/jetbase/commands/status.py +212 -0
  40. jetbase-0.12.2/jetbase/commands/unlock.py +26 -0
  41. jetbase-0.12.2/jetbase/commands/upgrade.py +248 -0
  42. jetbase-0.12.2/jetbase/commands/validators.py +37 -0
  43. jetbase-0.12.2/jetbase/config.py +339 -0
  44. jetbase-0.12.2/jetbase/constants.py +20 -0
  45. jetbase-0.12.2/jetbase/database/connection.py +40 -0
  46. jetbase-0.12.2/jetbase/database/queries/base.py +353 -0
  47. jetbase-0.12.2/jetbase/database/queries/default_queries.py +215 -0
  48. jetbase-0.12.2/jetbase/database/queries/postgres.py +14 -0
  49. jetbase-0.12.2/jetbase/database/queries/query_loader.py +87 -0
  50. jetbase-0.12.2/jetbase/database/queries/sqlite.py +197 -0
  51. jetbase-0.12.2/jetbase/engine/checksum.py +25 -0
  52. jetbase-0.12.2/jetbase/engine/dry_run.py +105 -0
  53. jetbase-0.12.2/jetbase/engine/file_parser.py +324 -0
  54. jetbase-0.12.2/jetbase/engine/formatters.py +61 -0
  55. jetbase-0.12.2/jetbase/engine/lock.py +65 -0
  56. jetbase-0.12.2/jetbase/engine/repeatable.py +125 -0
  57. jetbase-0.12.2/jetbase/engine/validation.py +238 -0
  58. jetbase-0.12.2/jetbase/engine/version.py +144 -0
  59. jetbase-0.12.2/jetbase/enums.py +42 -0
  60. jetbase-0.12.2/jetbase/exceptions.py +87 -0
  61. jetbase-0.12.2/jetbase/models.py +45 -0
  62. jetbase-0.12.2/jetbase/repositories/lock_repo.py +129 -0
  63. jetbase-0.12.2/jetbase/repositories/migrations_repo.py +451 -0
  64. jetbase-0.12.2/mkdocs.yml +82 -0
  65. jetbase-0.12.2/pyproject.toml +42 -0
  66. jetbase-0.12.2/tests/cli/migrations/RA__ra.sql +1 -0
  67. jetbase-0.12.2/tests/cli/migrations/ROC__roc.sql +1 -0
  68. jetbase-0.12.2/tests/cli/migrations/V1__m1.sql +4 -0
  69. jetbase-0.12.2/tests/cli/migrations/V21__mi21.sql +4 -0
  70. jetbase-0.12.2/tests/cli/migrations/V2__m2.sql +4 -0
  71. jetbase-0.12.2/tests/cli/migrations/V3__m3.sql +4 -0
  72. jetbase-0.12.2/tests/cli/migrations/V4__m4.sql +4 -0
  73. jetbase-0.12.2/tests/cli/migrations_versions_only/V1__m1.sql +4 -0
  74. jetbase-0.12.2/tests/cli/migrations_versions_only/V21__mi21.sql +4 -0
  75. jetbase-0.12.2/tests/cli/migrations_versions_only/V2__m2.sql +4 -0
  76. jetbase-0.12.2/tests/cli/migrations_versions_only/V3__m3.sql +4 -0
  77. jetbase-0.12.2/tests/cli/migrations_versions_only/V4__m4.sql +4 -0
  78. jetbase-0.12.2/tests/cli/test_current.py +61 -0
  79. jetbase-0.12.2/tests/cli/test_fix_checksums.py +74 -0
  80. jetbase-0.12.2/tests/cli/test_fix_files.py +47 -0
  81. jetbase-0.12.2/tests/cli/test_history.py +63 -0
  82. jetbase-0.12.2/tests/cli/test_init.py +33 -0
  83. jetbase-0.12.2/tests/cli/test_lock_status.py +50 -0
  84. jetbase-0.12.2/tests/cli/test_new.py +64 -0
  85. jetbase-0.12.2/tests/cli/test_rollback.py +161 -0
  86. jetbase-0.12.2/tests/cli/test_status.py +146 -0
  87. jetbase-0.12.2/tests/cli/test_unlock.py +50 -0
  88. jetbase-0.12.2/tests/cli/test_upgrade.py +543 -0
  89. jetbase-0.12.2/tests/cli/test_validate_checksums.py +80 -0
  90. jetbase-0.12.2/tests/conftest.py +112 -0
  91. jetbase-0.12.2/tests/test_config.py +314 -0
  92. jetbase-0.12.2/tests/test_integration/jetbase/config.py +5 -0
  93. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V1__create_users_table.sql +4 -0
  94. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V2__add_initial_users.sql +5 -0
  95. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V3__add_new_user.sql +6 -0
  96. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V4__add_new_user2.sql +6 -0
  97. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V5__add_new_user3.sql +6 -0
  98. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V6__add_new_user4.sql +6 -0
  99. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V7__add_new_user5.sql +6 -0
  100. jetbase-0.12.2/tests/test_integration/jetbase/migrations/V8__add_new_user6.sql +6 -0
  101. jetbase-0.12.2/tests/test_integration/test_rollback.py +57 -0
  102. jetbase-0.12.2/tests/test_integration/test_upgrade.py +61 -0
  103. jetbase-0.12.2/tests/unit/commands/test_current.py +42 -0
  104. jetbase-0.12.2/tests/unit/commands/test_new.py +47 -0
  105. jetbase-0.12.2/tests/unit/commands/test_rollback.py +79 -0
  106. jetbase-0.12.2/tests/unit/database/queries/test_base.py +23 -0
  107. jetbase-0.12.2/tests/unit/database/queries/test_query_loader.py +95 -0
  108. jetbase-0.12.2/tests/unit/engine/test_dry_run.py +132 -0
  109. jetbase-0.12.2/tests/unit/engine/test_file_parser.py +529 -0
  110. jetbase-0.12.2/tests/unit/engine/test_formatters.py +50 -0
  111. jetbase-0.12.2/tests/unit/engine/test_lock.py +57 -0
  112. jetbase-0.12.2/tests/unit/engine/test_repeatable.py +94 -0
  113. jetbase-0.12.2/tests/unit/engine/test_validation.py +122 -0
  114. jetbase-0.12.2/tests/unit/engine/test_version.py +72 -0
  115. jetbase-0.12.2/uv.lock +444 -0
@@ -0,0 +1,236 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - "jetbase/**" # only run when code inside my_package changes
7
+ - ".github/workflows/ci-pr.yml" # rerun if this workflow changes
8
+ - "pyproject.toml" # rerun if deps/config change
9
+ - "uv.lock" # rerun if lockfile changes
10
+ workflow_dispatch: {}
11
+ jobs:
12
+ lint-type-format-checks:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v5
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.10"
22
+
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v6
25
+
26
+ - name: Install dependencies
27
+ run: uv sync --dev
28
+
29
+ - name: Pyrefly type checker
30
+ run: uv run pyrefly check
31
+
32
+ - name: Ruff linter
33
+ run: uv run ruff check jetbase tests
34
+
35
+ - name: Ruff formatter
36
+ run: uv run ruff format jetbase tests --check
37
+
38
+ unit-tests:
39
+ runs-on: ubuntu-latest
40
+
41
+ steps:
42
+ - uses: actions/checkout@v5
43
+
44
+ - name: Set up Python
45
+ uses: actions/setup-python@v5
46
+ with:
47
+ python-version: "3.10"
48
+
49
+ - name: Install uv
50
+ uses: astral-sh/setup-uv@v6
51
+
52
+ - name: Install dependencies
53
+ run: uv sync --dev
54
+
55
+ - name: Run unit tests
56
+ run: uv run pytest tests/unit/ -v
57
+
58
+ postgres-cli-tests:
59
+ runs-on: ubuntu-latest
60
+
61
+ env:
62
+ JETBASE_SQLALCHEMY_URL: postgresql://postgres:postgres@localhost:5432/test_db
63
+
64
+ services:
65
+ postgres:
66
+ image: postgres:15
67
+ env:
68
+ POSTGRES_USER: postgres
69
+ POSTGRES_PASSWORD: postgres
70
+ POSTGRES_DB: test_db
71
+ options: >-
72
+ --health-cmd pg_isready
73
+ --health-interval 10s
74
+ --health-timeout 5s
75
+ --health-retries 5
76
+ ports:
77
+ - 5432:5432
78
+
79
+ steps:
80
+ - uses: actions/checkout@v5
81
+
82
+ - name: Set up Python
83
+ uses: actions/setup-python@v5
84
+ with:
85
+ python-version: "3.10"
86
+
87
+ - name: Install uv
88
+ uses: astral-sh/setup-uv@v6
89
+
90
+ - name: Install dependencies
91
+ run: uv sync --dev
92
+
93
+ - name: Run CLI tests
94
+ run: uv run pytest tests/cli/ -v
95
+
96
+ sqlite-cli-tests:
97
+ runs-on: ubuntu-latest
98
+
99
+ env:
100
+ JETBASE_SQLALCHEMY_URL: sqlite:///test.db
101
+
102
+ steps:
103
+ - uses: actions/checkout@v5
104
+
105
+ - name: Set up Python
106
+ uses: actions/setup-python@v5
107
+ with:
108
+ python-version: "3.10"
109
+
110
+ - name: Install uv
111
+ uses: astral-sh/setup-uv@v6
112
+
113
+ - name: Install dependencies
114
+ run: uv sync --dev
115
+
116
+ - name: Run CLI tests
117
+ run: uv run pytest tests/cli/ -v
118
+
119
+ integration-tests:
120
+ runs-on: ubuntu-latest
121
+
122
+ env:
123
+ JETBASE_SQLALCHEMY_URL: postgresql://postgres:postgres@localhost:5432/test_db
124
+
125
+ services:
126
+ postgres:
127
+ image: postgres:15
128
+ env:
129
+ POSTGRES_USER: postgres
130
+ POSTGRES_PASSWORD: postgres
131
+ POSTGRES_DB: test_db
132
+ options: >-
133
+ --health-cmd pg_isready
134
+ --health-interval 10s
135
+ --health-timeout 5s
136
+ --health-retries 5
137
+ ports:
138
+ - 5432:5432
139
+
140
+ steps:
141
+ - uses: actions/checkout@v5
142
+
143
+ - name: Set up Python
144
+ uses: actions/setup-python@v5
145
+ with:
146
+ python-version: "3.10"
147
+
148
+ - name: Install uv
149
+ uses: astral-sh/setup-uv@v6
150
+
151
+ - name: Install dependencies
152
+ run: uv sync --dev
153
+
154
+ - name: Run jetbase rollback with no migrations table created
155
+ working-directory: tests/test_integration/jetbase
156
+ run: uv run jetbase rollback
157
+
158
+ - name: Run jetbase current with no migrations table created
159
+ working-directory: tests/test_integration/jetbase
160
+ run: uv run jetbase current
161
+
162
+ - name: Run jetbase history with no migrations table created
163
+ working-directory: tests/test_integration/jetbase
164
+ run: uv run jetbase history
165
+
166
+ - name: Run jetbase upgrade with --dry-run param
167
+ working-directory: tests/test_integration/jetbase
168
+ run: uv run jetbase upgrade --dry-run
169
+
170
+ - name: Run upgrade dry-run test
171
+ working-directory: tests/test_integration
172
+ run: uv run pytest -m "dry_run" test_upgrade.py
173
+
174
+ - name: Run jetbase upgrade with --count param
175
+ working-directory: tests/test_integration/jetbase
176
+ run: uv run jetbase upgrade --count 2
177
+
178
+ - name: Run upgrade count test
179
+ working-directory: tests/test_integration
180
+ run: uv run pytest -m "count" test_upgrade.py
181
+
182
+ - name: Run jetbase upgrade with --to-version param
183
+ working-directory: tests/test_integration/jetbase
184
+ run: uv run jetbase upgrade --to-version 5
185
+
186
+ - name: Run upgrade to-version test
187
+ working-directory: tests/test_integration
188
+ run: uv run pytest -m "to_version" test_upgrade.py
189
+
190
+ - name: Run jetbase upgrade
191
+ working-directory: tests/test_integration/jetbase
192
+ run: uv run jetbase upgrade
193
+
194
+ - name: Run upgrade basic test
195
+ working-directory: tests/test_integration
196
+ run: uv run pytest -m "basic" test_upgrade.py
197
+
198
+ - name: Run jetbase rollback with --dry-run param
199
+ working-directory: tests/test_integration/jetbase
200
+ run: uv run jetbase rollback --dry-run
201
+
202
+ - name: Run rollback dry-run test
203
+ working-directory: tests/test_integration
204
+ run: uv run pytest -m "dry_run" test_rollback.py
205
+
206
+ - name: Run jetbase rollback with --count param
207
+ working-directory: tests/test_integration/jetbase
208
+ run: uv run jetbase rollback -c 2
209
+
210
+ - name: Run rollback count test
211
+ working-directory: tests/test_integration
212
+ run: uv run pytest -m "count" test_rollback.py
213
+
214
+ - name: Run jetbase rollback
215
+ working-directory: tests/test_integration/jetbase
216
+ run: uv run jetbase rollback
217
+
218
+ - name: Run rollback basic test
219
+ working-directory: tests/test_integration
220
+ run: uv run pytest -m "basic" test_rollback.py
221
+
222
+ - name: Run jetbase rollback with --to param
223
+ working-directory: tests/test_integration/jetbase
224
+ run: uv run jetbase rollback --to-version 2
225
+
226
+ - name: Run rollback to_version integration test
227
+ working-directory: tests/test_integration
228
+ run: uv run pytest -m "to_version" test_rollback.py
229
+
230
+ - name: Run jetbase current
231
+ working-directory: tests/test_integration/jetbase
232
+ run: uv run jetbase current
233
+
234
+ - name: Run jetbase history
235
+ working-directory: tests/test_integration/jetbase
236
+ run: uv run jetbase history
@@ -0,0 +1,32 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ publish:
8
+ runs-on: ubuntu-latest
9
+ if: github.actor == 'jaz-alli' && startsWith(github.ref, 'refs/tags/')
10
+
11
+ permissions:
12
+ id-token: write
13
+ contents: read
14
+
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.10"
23
+
24
+ - name: Build package
25
+ run: |
26
+ pip install build
27
+ python -m build
28
+
29
+ - name: Publish to PyPI
30
+ uses: pypa/gh-action-pypi-publish@release/v1
31
+ with:
32
+ attestations: true
@@ -0,0 +1,27 @@
1
+ name: Deploy Docs
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: write
8
+
9
+ jobs:
10
+ publish-docs:
11
+ runs-on: ubuntu-latest
12
+ if: github.actor == 'jaz-alli'
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: '3.10'
20
+
21
+ - name: Install dependencies
22
+ run: |
23
+ pip install mkdocs-material
24
+
25
+ - name: Deploy to GitHub Pages
26
+ run: mkdocs gh-deploy --force
27
+
@@ -0,0 +1,177 @@
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
175
+
176
+ # Other files and folders
177
+ .python-version
@@ -0,0 +1,14 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ rev: v0.14.1
4
+ hooks:
5
+ - id: ruff-check
6
+ args: ["I", "--fix"]
7
+ - id: ruff-format
8
+
9
+ - repo: https://github.com/facebook/pyrefly-pre-commit
10
+ rev: 0.0.1
11
+ hooks:
12
+ - id: pyrefly-typecheck-system
13
+ name: Pyrefly
14
+ pass_filenames: false
jetbase-0.12.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 jaz-alli
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.
@@ -0,0 +1,135 @@
1
+ Metadata-Version: 2.4
2
+ Name: jetbase
3
+ Version: 0.12.2
4
+ Summary: Jetbase is a Python database migration tool
5
+ Author-email: jaz <jaz.allibhai@gmail.com>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.10
8
+ Requires-Dist: packaging>=25.0
9
+ Requires-Dist: rich>=12.2.0
10
+ Requires-Dist: sqlalchemy>=2.0.10
11
+ Requires-Dist: tomli>=2.0.2
12
+ Requires-Dist: typer>=0.12.3
13
+ Description-Content-Type: text/markdown
14
+
15
+ # Welcome to Jetbase 🚀
16
+
17
+ **Jetbase** is a simple, lightweight database migration tool for Python projects.
18
+
19
+ Jetbase helps you manage database migrations in a simple, version-controlled way. Whether you're adding a new table, modifying columns, or need to undo a change, Jetbase makes it super easy!
20
+
21
+ ### Key Features ✨
22
+
23
+ - **📦 Simple Setup** — Get started with just one command
24
+ - **⬆️ Easy Upgrades** — Apply pending migrations with confidence
25
+ - **⬇️ Safe Rollbacks** — Made a mistake? No problem, roll it back!
26
+ - **📊 Clear Status** — Always know which migrations have been applied and which are pending
27
+ - **🔒 Migration Locking** — Prevents conflicts when multiple processes try to migrate
28
+ - **✅ Checksum Validation** — Detects if migration files have been modified
29
+ - **🔄 Repeatable Migrations** — Support for migrations that run on every upgrade
30
+
31
+ [📚 Full Documentation](https://jetbase-hq.github.io/jetbase/)
32
+
33
+ ## Quick Start 🏃‍♂️
34
+
35
+ ### Installation
36
+
37
+ **Using pip:**
38
+ ```shell
39
+ pip install jetbase
40
+ ```
41
+
42
+ **Using uv:**
43
+ ```shell
44
+ uv add jetbase
45
+ ```
46
+
47
+ ### Initialize Your Project
48
+
49
+ ```bash
50
+ jetbase init
51
+ cd jetbase
52
+ ```
53
+
54
+ This creates a `jetbase/` directory with:
55
+
56
+ - A `migrations/` folder for your SQL files
57
+ - An `env.py` configuration file
58
+
59
+ ### Configure Your Database
60
+
61
+ Edit `jetbase/env.py` with your database connection string (currently support for postgres and sqlite):
62
+
63
+ **PostgreSQL example:**
64
+ ```python
65
+ sqlalchemy_url = "postgresql+psycopg2://user:password@localhost:5432/mydb"
66
+ ```
67
+
68
+ **SQLite example:**
69
+ ```python
70
+ sqlalchemy_url = "sqlite:///mydb.db"
71
+ ```
72
+
73
+ ### Create Your First Migration
74
+
75
+ ```bash
76
+ jetbase new "create users table"
77
+ ```
78
+
79
+ This creates a new SQL file like `V20251225.120000__create_users_and_items_tables.sql`.
80
+
81
+ > **Tip:**
82
+ > You can also create migrations manually by adding SQL files in the `jetbase/migrations` directory, using the `V<version>__<description>.sql` naming convention (e.g., `V1__add_users_table.sql`, `V2.4__add_users_table.sql`).
83
+
84
+
85
+ ### Write Your Migration
86
+
87
+ Open the newly created file and add your SQL:
88
+
89
+ ```sql
90
+ -- upgrade
91
+ CREATE TABLE users (
92
+ id SERIAL PRIMARY KEY,
93
+ name VARCHAR(100) NOT NULL,
94
+ email VARCHAR(255) UNIQUE NOT NULL
95
+ );
96
+
97
+ CREATE TABLE items (
98
+ id SERIAL PRIMARY KEY,
99
+ name VARCHAR(100) NOT NULL
100
+ );
101
+
102
+ -- rollback
103
+ DROP TABLE items;
104
+ DROP TABLE users;
105
+ ```
106
+
107
+ ### Apply the Migration
108
+
109
+ ```bash
110
+ jetbase upgrade
111
+ ```
112
+
113
+ That's it! Your database is now up to date. 🎉
114
+
115
+ > **Note:**
116
+ > Jetbase uses SQLAlchemy under the hood to manage database connections.
117
+ > For any database other than SQLite, you must install the appropriate Python database driver.
118
+ > For example, to use Jetbase with PostgreSQL:
119
+
120
+ ```bash
121
+ pip install psycopg2
122
+ ```
123
+
124
+ You can also use another compatible driver if you prefer (such as `asyncpg`, `pg8000`, etc.).
125
+
126
+ ## Supported Databases
127
+
128
+ Jetbase currently supports:
129
+
130
+ - ✅ PostgreSQL
131
+ - ✅ SQLite
132
+
133
+ ## Need Help?
134
+
135
+ Open an issue on GitHub!