Skip to content

Conversation

pamelafox
Copy link
Collaborator

Purpose

This PR moves the check for AZURE_PUBLIC_NETWORK_ACCESS into prepdocs.py itself, to avoid having duplicate (and currently incorrect) logic in the shell scripts.
The drawback is that it will take another second before it realizes it shouldn't run prepdocs, but in this case, since the majority of developers do not have AZURE_PUBLIC_NETWORK_ACCESS disabled, that seems fine.

This PR is based on #2197 which I wasn't able to update for some reason, so I made a new PR.

Does this introduce a breaking change?

When developers merge from main and run the server, azd up, or azd deploy, will this produce an error?
If you're not sure, try it out on an old environment.

[ ] Yes
[X] No

Does this require changes to learn.microsoft.com docs?

This repository is referenced by this tutorial
which includes deployment, settings and usage instructions. If text or screenshot need to change in the tutorial,
check the box below and notify the tutorial author. A Microsoft employee can do this for you if you're an external contributor.

[ ] Yes
[X] No

Type of change

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

Code quality checklist

See CONTRIBUTING.md for more details.

  • The current tests all pass (python -m pytest).
  • I added tests that prove my fix is effective or that my feature works
  • I ran python -m pytest --cov to verify 100% coverage of added lines
  • I ran python -m mypy to check for type errors
  • I either used the pre-commit hooks or ran ruff and black manually on my code.


@bp.route("/")
async def index():
# TODO: use msal loginRedirect on a blankish page
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Meant to remove this TODO in the built-in auth PR but forgot to push the removal commit before merging. This TODO isn't actually needed, since built-in auth works.

if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Prepare documents by extracting content from PDFs, splitting content into sections, uploading to blob storage, and indexing in a search index.",
epilog="Example: prepdocs.py '.\\data\*' -v",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This epilog causes a SyntaxWarning in Python 3.12, and also isnt entirely accurate. The docs for data ingestion are the most accurate.


echo 'Running "prepdocs.py"'

AZURE_USE_AUTHENTICATION=$(azd env get-value AZURE_PUBLIC_NETWORK_ACCESS)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

prepdocs.ps1 was already missing this check, so we just remove it from sh and add it to prepdocs.py.

@pamelafox pamelafox merged commit e90920f into main Dec 2, 2024
9 checks passed
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.

3 participants