-
Couldn't load subscription status.
- Fork 1
Fix Linear Webhooks Example and Add Standalone Version #5
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
base: develop
Are you sure you want to change the base?
Conversation
| if missing_vars: | ||
| print(f"Error: Missing required environment variables: {', '.join(missing_vars)}") | ||
| print("Please set these variables in your .env file or environment.") | ||
| return |
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.
The error handling for missing environment variables could be improved. Currently, the function simply returns without terminating the program, which could lead to further execution without the necessary configurations. Consider using sys.exit(1) to exit the program with a non-zero status code, indicating an error condition.
Suggested Change:
import sys
if missing_vars:
print(f"Error: Missing required environment variables: {', '.join(missing_vars)}")
print("Please set these variables in your .env file or environment.")
sys.exit(1)| return | ||
|
|
||
| print("Starting Linear webhook server...") | ||
| print(f"LINEAR_TEAM_ID: {os.getenv('LINEAR_TEAM_ID')}") |
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.
Printing sensitive information such as LINEAR_TEAM_ID directly to the console can lead to security risks if the logs are accessed by unauthorized users. Consider removing this print statement or ensuring that such sensitive information is handled securely and not exposed in logs or console outputs.
Suggested Change:
Remove or modify the print statement to avoid exposing sensitive information:
# print(f"LINEAR_TEAM_ID: {os.getenv('LINEAR_TEAM_ID')}")| from codegen.extensions.events.codegen_app import CodegenApp | ||
| import modal | ||
|
|
||
| image = modal.Image.debian_slim(python_version="3.13").apt_install("git").pip_install("fastapi[standard]", "codegen>=v0.22.2") |
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.
The use of a specific Python version (python_version="3.13") in the modal.Image.debian_slim method might lead to issues if this version becomes deprecated or unsupported. It's generally a good practice to allow for some flexibility in versioning unless there is a specific requirement for this exact version.
Recommendation: Consider using a version range or a more commonly supported version of Python to ensure long-term compatibility and ease of maintenance.
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.
it should use modal instead
(codegen) l@l:/codegen/codegen-examples/Modules/linear_webhooks$ modal token set --token-id ak-ldg5oJeWXKZdrY2IH5sBxL --token-secret as-OxpmDuowTV1AMOrFmiqIjm/codegen/codegen-examples/Modules/linear_webhooks$ python webhooks.py
Verifying token against https://api.modal.com
Token verified successfully!
Token written to /home/l/.modal.toml in profile zeeeepa.
(codegen) l@l:
Traceback (most recent call last):
File "/home/l/codegen/codegen-examples/Modules/linear_webhooks/webhooks.py", line 6, in
app = CodegenApp(name="test-linear", modal_api_key="", image=image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: CodegenApp.init() got an unexpected keyword argument 'modal_api_key'
(codegen) l@l:~/codegen/codegen-examples/Modules/linear_webhooks$
This PR fixes issues with the Linear webhooks example and adds a standalone version that can be run without Modal.
Changes:
Fixed the import statement in
webhooks.py:from codegen.extensions.events.app import CodegenApptofrom codegen.extensions.events.codegen_app import CodegenAppFixed the CodegenApp initialization in
webhooks.py:modal_api_keyandimage)app = CodegenApp(name="test-linear")Added a comprehensive README.md with setup and usage instructions
Added a requirements.txt file for easy dependency installation
Added a standalone.py script that can be run without Modal:
These changes make it easier for users to get started with the Linear webhooks example, whether they want to use Modal for deployment or run it as a standalone application.