-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add automatic alembic config generation and cryptography depend… #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SidPatel151
wants to merge
1
commit into
DeepTrail:dev
Choose a base branch
from
SidPatel151:feat/auto-alembic-config
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+67
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #!/usr/bin/env python3 | ||
| """Script to generate alembic.ini configuration file.""" | ||
|
|
||
| import os | ||
| from pathlib import Path | ||
|
|
||
| def generate_alembic_ini(output_dir: str = "."): | ||
| """ | ||
| Generate alembic.ini file in the specified directory. | ||
|
|
||
| Args: | ||
| output_dir: Directory where alembic.ini should be created | ||
| """ | ||
| content = """[alembic] | ||
| script_location = alembic | ||
|
|
||
| [loggers] | ||
| keys = root,sqlalchemy,alembic | ||
|
|
||
| [handlers] | ||
| keys = console | ||
|
|
||
| [formatters] | ||
| keys = generic | ||
|
|
||
| [logger_root] | ||
| level = WARN | ||
| handlers = console | ||
| qualname = | ||
|
|
||
| [logger_sqlalchemy] | ||
| level = WARN | ||
| handlers = | ||
| qualname = sqlalchemy.engine | ||
|
|
||
| [logger_alembic] | ||
| level = INFO | ||
| handlers = | ||
| qualname = alembic | ||
|
|
||
| [handler_console] | ||
| class = StreamHandler | ||
| args = (sys.stderr,) | ||
| level = NOTSET | ||
| formatter = generic | ||
|
|
||
| [formatter_generic] | ||
| format = %(levelname)-5.5s [%(name)s] %(message)s | ||
| """ | ||
|
|
||
| output_path = Path(output_dir) / "alembic.ini" | ||
| with open(output_path, "w") as f: | ||
| f.write(content) | ||
|
|
||
| print(f"✅ Generated alembic.ini at {output_path}") | ||
|
|
||
| if __name__ == "__main__": | ||
| # Get the project root (assuming script is in scripts directory) | ||
| project_root = Path(__file__).parent.parent | ||
| generate_alembic_ini(str(project_root)) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SidPatel151 This is interesting that you added script to dynamically add the alembic.ini file. I am wondering what was your thought here? vs just creating a new alembic.ini and using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to create it automatically, as at this time, I didn't notice the alembic.ini file in the gitignore. I also remember talking to you about making it autonomous to do. It's more efficient in my opinion as it creates the whole ini file for you when doing all the installations, instead oyu having to manually copy/paste it in or type one out.