litellm-proxy-extras 0.1.10__tar.gz → 0.1.11__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.

Potentially problematic release.


This version of litellm-proxy-extras might be problematic. Click here for more details.

Files changed (21) hide show
  1. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/PKG-INFO +1 -1
  2. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/utils.py +72 -1
  3. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/pyproject.toml +2 -2
  4. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/LICENSE +0 -0
  5. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/README.md +0 -0
  6. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/__init__.py +0 -0
  7. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/_logging.py +0 -0
  8. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql +0 -0
  9. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql +0 -0
  10. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql +0 -0
  11. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql +0 -0
  12. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql +0 -0
  13. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql +0 -0
  14. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql +0 -0
  15. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql +0 -0
  16. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql +0 -0
  17. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql +0 -0
  18. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql +0 -0
  19. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql +0 -0
  20. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/migrations/migration_lock.toml +0 -0
  21. {litellm_proxy_extras-0.1.10 → litellm_proxy_extras-0.1.11}/litellm_proxy_extras/schema.prisma +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: litellm-proxy-extras
3
- Version: 0.1.10
3
+ Version: 0.1.11
4
4
  Summary: Additional files for the LiteLLM Proxy. Reduces the size of the main litellm package.
5
5
  Author: BerriAI
6
6
  Requires-Python: >=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*
@@ -1,6 +1,7 @@
1
1
  import glob
2
2
  import os
3
3
  import random
4
+ import re
4
5
  import subprocess
5
6
  import time
6
7
  from pathlib import Path
@@ -82,6 +83,26 @@ class ProxyExtrasDBManager:
82
83
  logger.info(f"Found {len(migration_paths)} migrations at {migrations_dir}")
83
84
  return [Path(p).parent.name for p in migration_paths]
84
85
 
86
+ @staticmethod
87
+ def _roll_back_migration(migration_name: str):
88
+ """Mark a specific migration as rolled back"""
89
+ subprocess.run(
90
+ ["prisma", "migrate", "resolve", "--rolled-back", migration_name],
91
+ timeout=60,
92
+ check=True,
93
+ capture_output=True,
94
+ )
95
+
96
+ @staticmethod
97
+ def _resolve_specific_migration(migration_name: str):
98
+ """Mark a specific migration as applied"""
99
+ subprocess.run(
100
+ ["prisma", "migrate", "resolve", "--applied", migration_name],
101
+ timeout=60,
102
+ check=True,
103
+ capture_output=True,
104
+ )
105
+
85
106
  @staticmethod
86
107
  def _resolve_all_migrations(migrations_dir: str):
87
108
  """Mark all existing migrations as applied"""
@@ -141,7 +162,34 @@ class ProxyExtrasDBManager:
141
162
  return True
142
163
  except subprocess.CalledProcessError as e:
143
164
  logger.info(f"prisma db error: {e.stderr}, e: {e.stdout}")
144
- if (
165
+ if "P3009" in e.stderr:
166
+ # Extract the failed migration name from the error message
167
+ migration_match = re.search(
168
+ r"`(\d+_.*)` migration", e.stderr
169
+ )
170
+ if migration_match:
171
+ failed_migration = migration_match.group(1)
172
+ logger.info(
173
+ f"Found failed migration: {failed_migration}, marking as rolled back"
174
+ )
175
+ # Mark the failed migration as rolled back
176
+ subprocess.run(
177
+ [
178
+ "prisma",
179
+ "migrate",
180
+ "resolve",
181
+ "--rolled-back",
182
+ failed_migration,
183
+ ],
184
+ timeout=60,
185
+ check=True,
186
+ capture_output=True,
187
+ text=True,
188
+ )
189
+ logger.info(
190
+ f"✅ Migration {failed_migration} marked as rolled back... retrying"
191
+ )
192
+ elif (
145
193
  "P3005" in e.stderr
146
194
  and "database schema is not empty" in e.stderr
147
195
  ):
@@ -155,6 +203,29 @@ class ProxyExtrasDBManager:
155
203
  ProxyExtrasDBManager._resolve_all_migrations(migrations_dir)
156
204
  logger.info("✅ All migrations resolved.")
157
205
  return True
206
+ elif (
207
+ "P3018" in e.stderr
208
+ ): # PostgreSQL error code for duplicate column
209
+ logger.info(
210
+ "Migration already exists, resolving specific migration"
211
+ )
212
+ # Extract the migration name from the error message
213
+ migration_match = re.search(
214
+ r"Migration name: (\d+_.*)", e.stderr
215
+ )
216
+ if migration_match:
217
+ migration_name = migration_match.group(1)
218
+ logger.info(f"Rolling back migration {migration_name}")
219
+ ProxyExtrasDBManager._roll_back_migration(
220
+ migration_name
221
+ )
222
+ logger.info(
223
+ f"Resolving migration {migration_name} that failed due to existing columns"
224
+ )
225
+ ProxyExtrasDBManager._resolve_specific_migration(
226
+ migration_name
227
+ )
228
+ logger.info("✅ Migration resolved.")
158
229
  else:
159
230
  # Use prisma db push with increased timeout
160
231
  subprocess.run(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "litellm-proxy-extras"
3
- version = "0.1.10"
3
+ version = "0.1.11"
4
4
  description = "Additional files for the LiteLLM Proxy. Reduces the size of the main litellm package."
5
5
  authors = ["BerriAI"]
6
6
  readme = "README.md"
@@ -22,7 +22,7 @@ requires = ["poetry-core"]
22
22
  build-backend = "poetry.core.masonry.api"
23
23
 
24
24
  [tool.commitizen]
25
- version = "0.1.10"
25
+ version = "0.1.11"
26
26
  version_files = [
27
27
  "pyproject.toml:version",
28
28
  "../requirements.txt:litellm-proxy-extras==",