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

New Requirements, ability to run program locally #128

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

Helithumper
Copy link
Contributor

Solves #127

Initially was focused on getting requirements working with pip-compile, however had to add more changes to get the program to run due to alot of wrong variables and pathing.

make dev should begin the dev server

@jontyms
Copy link
Member

jontyms commented Jul 12, 2024

Sorry to hear you had problems running the application, I just pushed new instructions to the readme. I also removed the ability to run the application directly from main.py.

Copy link
Member

@jontyms jontyms left a comment

Choose a reason for hiding this comment

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

  • Removing the app. from the imports breaks pytest.
  • Why do we need pip-compile?
  • Why do we need a Makefile?
  • Can you split your config changes into a separate PR?

@Helithumper
Copy link
Contributor Author

Helithumper commented Jul 12, 2024

  • Removing the app. from the imports breaks pytest.

This is because as currently configured the tests are in an entirely different module from the app. We can fix this by using relative modules and replacing each of the new imports to become .models for example.

  • Why do we need pip-compile?

The piling up numbers of failing PRs from dependabot are due to no way to recompute the dependency chain. Dependabot tries to upgrade a version and ends up stuck due to circular or otherwise incorrect dependency versions. pip-compile allows us to actually fix the dependabot issues by just recomputing the latest version of requirements.txt from requirements.in

  • Why do we need a Makefile?

Makes running the code easier. Provides macros for execution of the program as well as building the dependencies.

  • Can you split your config changes into a separate PR?

I can do this, however it'll likely result in this PR not functioning as the current config isn't correct and was both named incorrectly as well as was missing parts. I began working on that in order to get anything running as the committed config wasn't up to date.

@Helithumper
Copy link
Contributor Author

Test doesn't pass yet due to the test overall being bad and expecting a random file to be populated for openvpn without error handling and without gracefully handling the error.

@Helithumper
Copy link
Contributor Author

Fixed test err

@jontyms
Copy link
Member

jontyms commented Jul 13, 2024

This is because as currently configured the tests are in an entirely different module from the app. We can fix this by using relative modules and replacing each of the new imports to become .models for example.

I think the relative imports are messier, especially if you have to go multiple levels. I am not familiar with why you would do relative or absolute imports. Perhaps you could explain.

Copy link
Member

@jontyms jontyms left a comment

Choose a reason for hiding this comment

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

I am open to trying pip-compile

@@ -245,9 +261,11 @@ class Settings(BaseSettings, metaclass=SingletonBaseSettingsMeta):
stripe: StripeConfig = stripe_config
email: EmailConfig = email_config
jwt: JwtConfig = jwt_config
database: DatabaseConfig = database_config
database: DatabaseConfig = database_config or DatabaseConfig(
url="sqlite:///:memory:"
Copy link
Member

Choose a reason for hiding this comment

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

I am not a fan, if the config file it not found or misconfigured in prod, this could fail silently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then we can add the logic above to include a logging.warn like I did for keycloak

@Helithumper
Copy link
Contributor Author

This is because as currently configured the tests are in an entirely different module from the app. We can fix this by using relative modules and replacing each of the new imports to become .models for example.

I think the relative imports are messier, especially if you have to go multiple levels. I am not familiar with why you would do relative or absolute imports. Perhaps you could explain.

We can do either. In this case I used relative imports due to pytest's dependency resolver. We can use absolute tests however we'll need to add config to include the package in Pytest's path or use python3 -m pytest for all tests.

Either way works

@jontyms
Copy link
Member

jontyms commented Jul 17, 2024

Created #140 to address config file
working on other prs to address the other fixes in this pr

@jontyms jontyms mentioned this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants