Skip to content

[REF-1464] Handle requirements.txt encoding#2284

Merged
martinxu9 merged 5 commits intomainfrom
martinxu9/req-encoding
Dec 14, 2023
Merged

[REF-1464] Handle requirements.txt encoding#2284
martinxu9 merged 5 commits intomainfrom
martinxu9/req-encoding

Conversation

@martinxu9
Copy link
Copy Markdown
Contributor

@martinxu9 martinxu9 commented Dec 13, 2023

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)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

New Feature Submission:

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

Changes To Core Features:

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

After these steps, you're ready to open a pull request.

  1. Previously the handling of requirements.txt in user local environment assumes utf-8 the default encoding used in builtin open method. If user has a different encoding, we open and append will cause the file to have inconsistent encoding on different lines and make part of the content unreadable using any given encoding
  2. Add UT to cover the non utf-8 files.
  3. For hosting: now that we re-check/re-generate requirements.txt when user deploys, it is safe to simply pin the reflex version instead of >=.

masenf
masenf previously approved these changes Dec 13, 2023
Comment thread pyproject.toml
packaging = "^23.1"
pipdeptree = "^2.13.0"
reflex-hosting-cli = ">=0.1.2"
charset-normalizer = "^3.3.2"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

just out of curiosity, was chardet considered for this? it's what i've mostly seen used in the past, but i see it hasn't had a release for quite some time.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not really, I didn't look into that. I saw some online answers using this, and this seems to be a dependency of some of current packages already.
But I will double check what people say about those two before merging.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

oh nice, charset-normalizer already being in our installed payload makes this an easy decision

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh ok. Let's use this package for now. It's in a rather tiny area of our code

Comment thread pyproject.toml Outdated
@martinxu9
Copy link
Copy Markdown
Contributor Author

@masenf thumbs up one more time please

Copy link
Copy Markdown
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, thought this already merged

@martinxu9
Copy link
Copy Markdown
Contributor Author

sorry, thought this already merged

No worries. I think our branch is set up to dismiss approvals if there's any new changes. I needed to merge upstream

@martinxu9 martinxu9 merged commit 9da65b9 into main Dec 14, 2023
@martinxu9 martinxu9 deleted the martinxu9/req-encoding branch December 14, 2023 22:25
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