mongomig 0.1.0.dev0__py3-none-any.whl

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.
@@ -0,0 +1,177 @@
1
+ Metadata-Version: 2.5
2
+ Name: mongomig
3
+ Version: 0.1.0.dev0
4
+ Summary: Alembic-style schema evolution and migrations for MongoDB.
5
+ Project-URL: Homepage, https://github.com/anon-000/mongomig
6
+ Project-URL: Issues, https://github.com/anon-000/mongomig/issues
7
+ Author: aurosmruti
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: alembic,fastapi,migrations,mongodb,pydantic,pymongo,schema
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Database
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: pydantic>=2.6
24
+ Requires-Dist: pymongo>=4.6
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: rich>=13.7
27
+ Requires-Dist: typer>=0.12
28
+ Provides-Extra: beanie
29
+ Requires-Dist: beanie>=1.26; extra == 'beanie'
30
+ Provides-Extra: dev
31
+ Requires-Dist: mypy>=1.11; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
33
+ Requires-Dist: pytest>=8.0; extra == 'dev'
34
+ Requires-Dist: ruff>=0.6; extra == 'dev'
35
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # MongoMig
39
+
40
+ **Alembic-style schema evolution and migrations for MongoDB.**
41
+
42
+ Built for Python services (FastAPI, Flask, workers) on PyMongo, Motor or Beanie.
43
+
44
+ > **Status: pre-alpha.** Milestone 1 (foundation) is done. Running migrations (`upgrade` /
45
+ > `downgrade`), schema diff and autogenerate are coming next. See the roadmap below.
46
+
47
+ ```console
48
+ $ mongomig init
49
+ $ mongomig revision -m "add user profile"
50
+ Created revision 7be204a1c9e0 → migrations/versions/20260924_1432_7be204a1c9e0_add_user_profile.py
51
+
52
+ $ mongomig history
53
+ a1f3c9d20b44 -> 7be204a1c9e0 (head), add user profile
54
+ <base> -> a1f3c9d20b44, initial
55
+
56
+ $ mongomig current
57
+ Database: app
58
+ Current: a1f3c9d20b44 initial
59
+ Pending: 1
60
+ - 7be204a1c9e0 add user profile
61
+ ```
62
+
63
+ ## Install
64
+
65
+ ```bash
66
+ pip install mongomig # not yet published — install from source for now
67
+ ```
68
+
69
+ Requires Python 3.11+ and MongoDB 6.0+.
70
+
71
+ ## Quick start
72
+
73
+ ```bash
74
+ mongomig init # creates mongomig.yaml + migrations/
75
+ export MONGODB_URI="mongodb://localhost:27017"
76
+ mongomig revision -m "initial" # new revision file
77
+ mongomig current # what's applied vs pending
78
+ ```
79
+
80
+ `mongomig init` creates:
81
+
82
+ ```text
83
+ mongomig.yaml # connection + execution settings (no secrets!)
84
+ migrations/
85
+ ├── env.py # Python: points MongoMig at your models
86
+ ├── schema_snapshot.json # last known expected schema (used by autogenerate)
87
+ └── versions/ # one file per revision
88
+ ```
89
+
90
+ ### Configuration
91
+
92
+ ```yaml
93
+ database:
94
+ uri: ${MONGODB_URI} # ${VAR} and ${VAR:-default} are expanded
95
+ name: ${MONGODB_DATABASE:-app}
96
+ ```
97
+
98
+ Per-environment overrides live in `mongomig.<env>.yaml` and are merged on top:
99
+
100
+ ```bash
101
+ mongomig --env production current # or MONGOMIG_ENV=production
102
+ ```
103
+
104
+ MongoMig never prints passwords or full connection strings. It warns you if a password is
105
+ written directly into the config file.
106
+
107
+ ### Revision files
108
+
109
+ ```python
110
+ """add user profile"""
111
+
112
+ revision = "7be204a1c9e0"
113
+ down_revision = "a1f3c9d20b44"
114
+ reversible = True
115
+
116
+
117
+ def upgrade(ctx):
118
+ ...
119
+
120
+
121
+ def downgrade(ctx):
122
+ ...
123
+ ```
124
+
125
+ Revision order comes from `down_revision`, not from the file name. Revision ids are random,
126
+ so two developers working on separate branches never get the same id. If both branches add a
127
+ revision, `mongomig heads` shows two heads, and `mongomig revision` refuses to continue until
128
+ you choose a parent with `--head`.
129
+
130
+ Revision ids can be shortened to a unique prefix of 4 or more characters, the same way git
131
+ handles commit hashes.
132
+
133
+ ### Commands
134
+
135
+ | Command | Needs MongoDB | Description |
136
+ |---|---|---|
137
+ | `init` | no | Create config and migrations directory |
138
+ | `revision -m MSG [--head REV]` | no | Create a new revision |
139
+ | `heads` | no | Show head revision(s) |
140
+ | `history` | no | List revisions, newest first |
141
+ | `current` | yes | Applied vs pending revisions (read-only) |
142
+
143
+ Global options: `--config PATH`, `--env NAME`, `--json`, `--verbose`, `--version`.
144
+
145
+ Exit codes: `0` success · `1` validation · `2` execution/connection · `3` configuration ·
146
+ `4` revision conflict · `5` lock · `6` checksum mismatch.
147
+
148
+ ## Roadmap
149
+
150
+ - [x] **M1 Foundation**: config, CLI, revision files, revision graph, tracking
151
+ - [ ] **M2 Migration engine**: `upgrade`, `downgrade`, locking, `merge`, checksums, FastAPI lifespan helper
152
+ - [ ] **M3 Schema engine**: `@collection` models, Beanie support, `inspect`, snapshots
153
+ - [ ] **M4 Autogenerate**: `diff`, `revision --autogenerate`, index/validator diff
154
+ - [ ] **M5 Production safety**: `--dry-run`, `plan`, batching, progress
155
+ - [ ] **M6 Release**: `validate`, `doctor`, docs, PyPI
156
+
157
+ ## Development
158
+
159
+ ```bash
160
+ make install # uv venv + editable install with dev extras
161
+ make mongo-up # MongoDB 7 single-node replica set in Docker
162
+ make check # ruff + mypy --strict + pytest
163
+ ```
164
+
165
+ Integration tests are skipped automatically when MongoDB isn't running. To test against another
166
+ MongoDB version, run `MONGO_VERSION=8.0 make mongo-up`.
167
+
168
+ ### Releasing
169
+
170
+ 1. Bump `src/mongomig/_version.py` and update `CHANGELOG.md`, then merge to `main`.
171
+ 2. On GitHub, create a Release with tag `v<version>` (e.g. `v0.1.0`) and publish it.
172
+ 3. `.github/workflows/release.yml` checks that the tag matches the version, builds and
173
+ smoke-tests the wheel, then publishes to PyPI through Trusted Publishing.
174
+
175
+ ## License
176
+
177
+ MIT
@@ -0,0 +1,38 @@
1
+ mongomig/__init__.py,sha256=1ccmw5XFf0GGjxA9nw-ypwPuPDyOwz91K1rACEmqQRY,717
2
+ mongomig/__main__.py,sha256=9GxZQEhlyGv1bKuipdS6XdN-X551TK438DT90OHS-Qc,73
3
+ mongomig/_version.py,sha256=qbhMh4mg2JMoCFflKwIRvApU63RR8AxvYq1OT__8sgI,27
4
+ mongomig/errors.py,sha256=XsJCOBLK7wHvMUoVyFUfhnuwc6P0rF6an_t-M0QKT6c,2596
5
+ mongomig/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ mongomig/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ mongomig/cli/app.py,sha256=U4vrS_bxVwV3vkAL8CTja5lwtWkcyfpovAkxzwT-bhI,3970
8
+ mongomig/cli/context.py,sha256=iVVVjMOpYJkyE_wfYUt0uA0BXZvVN1wiY9Qa-y7nofY,1296
9
+ mongomig/cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ mongomig/cli/commands/current.py,sha256=tNkwfCaBwquzNhCCMroTi5B0zcAVTYyFFZ3TqN5QQj8,2512
11
+ mongomig/cli/commands/heads.py,sha256=VaSP4HrcfhCK7LxUx_K2dWRpwsHz4SilblKwFo2M4oc,1253
12
+ mongomig/cli/commands/history.py,sha256=o54pC5CLdKSpixwAxhGw4yYfZgShAD3C896WVJA-5kE,1673
13
+ mongomig/cli/commands/init.py,sha256=eLnR1hdBMEqGeEz51oFajWXHb892DtaFvbiRzWRV48s,2545
14
+ mongomig/cli/commands/revision.py,sha256=U1OYzM3VW4CnHBrVAX5AUqbq_CsENLuVo5NIrmbGlwA,1441
15
+ mongomig/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ mongomig/config/envpy.py,sha256=SdaKlxEuSZEwp4fvEYjT1fZ1Bij0nSxQCou8GOpcp4I,2132
17
+ mongomig/config/loader.py,sha256=fJuznaaMxFwDdViHgmgSawchR46o9vgZ-XVGTvhezgA,6436
18
+ mongomig/config/models.py,sha256=_B2xPgUh7PMim1AxKCfX5yddBX6hUcJfoegP_Wvf6Xw,2523
19
+ mongomig/database/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ mongomig/database/client.py,sha256=-qsjc_7rcx_cQ6XAtsCTxj58CXegigGKHe5DfVtjIV0,3004
21
+ mongomig/database/redact.py,sha256=s6_HcsMW1lhgCPWDqRfboa8eC-Rb4uTtMl6p0hEw3YQ,2553
22
+ mongomig/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ mongomig/migrations/graph.py,sha256=MacpuIZ0RKMp6-67POYMGwXXlh7_5sUICWuT-UsCyZY,6477
24
+ mongomig/migrations/revision.py,sha256=c7mM--kSRl_qTFLXWUpe8WB5pwR0jKH9o4jKLtfAx-I,3406
25
+ mongomig/migrations/script.py,sha256=fL1ztGSlVPHLEtoJ8oWyRrPc5aICRpATJrgTdX8zLrQ,6770
26
+ mongomig/migrations/tracker.py,sha256=dQl-hsX6V56cx2bOVR2gRLifHZbs_XLghVQcDNIvrdE,5296
27
+ mongomig/output/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
+ mongomig/output/console.py,sha256=Zti5c2DcP-4suKCagi8Buz-o09uAJ33LboHP64hG8rY,2966
29
+ mongomig/schema/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
+ mongomig/schema/snapshot.py,sha256=0a738FK3nj7dz5wi6bsZ2LQ7yO3usJZBXFjqdzP4CTc,1152
31
+ mongomig/templates/env.py.tmpl,sha256=91xUrbgWgYU3DpDcrK5BjO9nxzcvhu0Or56lMOGj0WQ,644
32
+ mongomig/templates/mongomig.yaml.tmpl,sha256=v4ftIlH7eVi3QsifOvHRY6GDmCE3mJn9IU3yMRWNaSA,713
33
+ mongomig/templates/revision.py.tmpl,sha256=6ttwV73iPCCMtofP7Ko5cOYzR7_0qYy8zp22RToM_Xk,338
34
+ mongomig-0.1.0.dev0.dist-info/METADATA,sha256=y0EGWI-rMU3nf-3qMpLkZZmj_yKh-Um4wxO6EuRmgyU,5811
35
+ mongomig-0.1.0.dev0.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
36
+ mongomig-0.1.0.dev0.dist-info/entry_points.txt,sha256=LQNjKyb6yFDhRlVMYyx3T3EkUyT_tDeY4WbNvLGE__M,51
37
+ mongomig-0.1.0.dev0.dist-info/licenses/LICENSE,sha256=pbKz-iBRMXj6nkDLbSiJkAdqk8m8OwP5Si4x8rIJAWE,1067
38
+ mongomig-0.1.0.dev0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.4
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mongomig = mongomig.cli.app:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 aurosmruti
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.