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

Issues 1633 Add frontend_path to config to support running multiple reflex apps off the same domain, and 1583 Show the correct info on where the site is being served. #1724

Merged
merged 16 commits into from
Sep 2, 2023

Conversation

nevdelap
Copy link
Contributor

All Submissions:

  • Have you followed the guidelines stated in CONTRIBUTING.md file?
  • Have you checked to ensure there aren't any other open Pull Requests for the desired changed.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

New Feature Submission:

  • Does your submission pass the tests?
  • Have you linted your code locally prior to submission?

I've run this, all good, except for some pre-existing issues that are in main complaining about test_config.py.

home 15:27:48 (0) ~> cw reflex_check
#!/bin/bash
set -eufo pipefail

readonly ESC=$'\033'"["
readonly BOLD="${ESC}1m"
readonly RESET="${ESC}0m"

echo -e "\n${BOLD}Testing.$RESET"
poetry run pytest tests --cov --no-cov-on-fail --cov-report=

echo -e "\n${BOLD}Linting.$RESET"
poetry run ruff check --fix .
poetry run pyright reflex tests
find reflex tests -name "*.py" -not -path reflex/reflex.py | xargs poetry run darglint

echo -e "\n${BOLD}Formatting.$RESET"
poetry run black reflex tests

echo -e "\n${BOLD}All good.$RESET"

Changes To Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them? In the issues.
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

Closes #1633 and #1583.

@nevdelap nevdelap marked this pull request as draft August 31, 2023 06:46
@nevdelap
Copy link
Contributor Author

After merging and resolving the conflict I've retested locally for the thing that needed resolving, and for the things the changes do, and I've rerun the tests and everything, and it's all good. I'm redeploying to my own sites on DigitalOcean.

@nevdelap
Copy link
Contributor Author

nevdelap commented Aug 31, 2023

Had to discover that I needed to change event to _event in my backend nginx config, then it all worked like a bought one.

@nevdelap nevdelap marked this pull request as ready for review August 31, 2023 08:01
Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

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

This looks really great! Just a couple of comments, and will discuss with the team about the walrus operator.

@@ -36,9 +37,13 @@ def run_process_and_launch_url(run_command: list[str]):
)

for line in processes.stream_logs("Starting frontend", process):
if "ready started server on" in line:
url = line.split("url: ")[-1].strip()
if match := re.search("ready started server on ([0-9.:]+)", line):
Copy link
Collaborator

Choose a reason for hiding this comment

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

the walrus was introduced in python 3.8, but reflex still claims to support 3.7 although we do not test with it... this would certainly require us to drop 3.7 support in the main package.

The team has been discussing dropping 3.7 for at least a month, but we haven't made a solid decision yet. Although 3.7 went end of life 2 months ago (2023-06-27), there are still some supported linux distributions that might be shipping it.

i'm not asking you do change the code here...yet, but will discuss with the team and see if the time has come to drop 3.7 support. (Personally, I'm of the mind, that if we don't test it in CI, then we don't really support it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are things you cannot do without the :=, but since this isn't one of them, happy to change it.

if "ready started server on" in line:
url = line.split("url: ")[-1].strip()
if match := re.search("ready started server on ([0-9.:]+)", line):
url = match.group(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
url = match.group(1)
url = f"http://{match.group(1)}"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

if match := re.search("ready started server on ([0-9.:]+)", line):
url = match.group(1)
if get_config().frontend_path != "":
url += get_config().frontend_path
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to see urllib.parse.urljoin here, to ensure that leading and trailing slashes are squashed.

Suggested change
url += get_config().frontend_path
url = urljoin(url, get_config().frontend_path)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

console.print(f"App running at: [bold green]{url}")
else:
console.debug(line)
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think process.stream_logs already logs each line at debug level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@nevdelap nevdelap requested a review from masenf August 31, 2023 21:37
@nevdelap
Copy link
Contributor Author

nevdelap commented Sep 1, 2023

@masenf I reran the checks and got failures that I think are caused by fed75ea, error: "NoRenderImportVar" is unknown import symbol.

(I typed that two hours ago and didn't press Enter. 🤪)

@nevdelap
Copy link
Contributor Author

nevdelap commented Sep 1, 2023

Actually, it looks like it is caused by 63b5fbd because the pre-commit wasn't run on it?

image

@masenf
Copy link
Collaborator

masenf commented Sep 1, 2023

Yeah that should be fixed now, if you remerge from main

@nevdelap
Copy link
Contributor Author

nevdelap commented Sep 1, 2023

Hi @masenf. I hadn't run poetry run pytest integration since it's not mentioned in CONTRIBUTING.md, but I've just run it and it worked.

image

Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

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

sorry the CI was flaky, looks good!

@masenf masenf merged commit 41e97bb into reflex-dev:main Sep 2, 2023
34 checks passed
@nevdelap nevdelap deleted the issue1633 branch September 2, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants