Skip to content
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

Autogenerating Dependencies During Deployment #2033

Merged
merged 15 commits into from
Oct 27, 2023
Merged

Autogenerating Dependencies During Deployment #2033

merged 15 commits into from
Oct 27, 2023

Conversation

Alek99
Copy link
Member

@Alek99 Alek99 commented Oct 25, 2023

Current Approach

Generate a requirements.txt with just reflex. When the user goes to deploy if they do not add any packages to requirements.txt warn them about this and proceed with their deployment.

If they are missing any the deployment will fail when running the backend.

Proposed Approach

If a requirements.txt is not present in the user's project when they go to deploy generate a requirements.txt using only their top-level dependencies.

If the requirements.txt is present skip.

Could not find requirements.txt. Do you want to generate it? [y/n]: y
Name of deployment (test-teal-apple): 
...

Generates a requirement.txt in the root of their project

Pros

  • Saves the user time during deployment, when generating top-level dependencies
  • Ensures they don't miss any requirements in their project which would cause the deployment to fail
  • Works with venv, poetry and also without using a venv

Cons

  • Catches all top-level dependencies so may get extra if the user has added a dependency and then taken it out of their project without updating their environment
  • Introduces another package (It is pretty small though)

@Alek99 Alek99 added enhancement Anything you want improved needs investigation labels Oct 25, 2023
@Alek99 Alek99 changed the title Test to see if Autogenerating dependencies During Deployment is viable Autogenerating Dependencies During Deployment Oct 25, 2023
console.warn("It seems like there's no requirements.txt in your project.")
response = console.ask(
"Would you like us to auto-generate one based on your current environment?",
choices=["y", "n"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Do we want to give them Y/n, enter is yes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather not here just because I want this command to be very explicit

reflex/utils/dependency.py Outdated Show resolved Hide resolved
@Alek99 Alek99 requested a review from masenf October 26, 2023 20:06
@Alek99 Alek99 marked this pull request as ready for review October 26, 2023 20:31
masenf
masenf previously approved these changes Oct 26, 2023
@picklelo picklelo merged commit 70a6b5f into main Oct 27, 2023
37 checks passed
@picklelo picklelo deleted the alek/autodepen branch November 1, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Anything you want improved needs investigation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants