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

Unicode space characters in project metadata description #119

Open
wwuck opened this issue May 14, 2024 · 0 comments · May be fixed by #120
Open

Unicode space characters in project metadata description #119

wwuck opened this issue May 14, 2024 · 0 comments · May be fixed by #120
Assignees
Labels
bug Something isn't working

Comments

@wwuck
Copy link

wwuck commented May 14, 2024

Description

I am attempting to install flake8-encodings in a poetry project.

My project also uses the following pre-commit hooks:

  - repo: https://github.com/python-poetry/poetry
    rev: 1.8.3
    hooks:
      - id: poetry-lock
        args:
          - --no-update
      - id: poetry-check
        args:
          - --lock
  - repo: https://github.com/sirosen/texthooks
    rev: 0.6.6
    hooks:
      - id: alphabetize-codeowners
      - id: fix-smartquotes
      - id: fix-spaces
      - id: fix-ligatures
      - id: forbid-bidi-controls

When I install flake8-encodings into my poetry project, the poetry-lock pre-commit hook will add domdf-python-tools as a dependency in the poetry.lock lockfile.
The problem appears at the next hook when fix-spaces is run and it detects some utf-8 "EN SPACE" (U+2002) characters in the project description and replaces them with standard ascii space (U+0020) characters.

This prevents pre-commit from passing because on the next commit attempt, poetry-lock will detect changes in the lockfile and re-create the lockfile from pypi metadata and bringing back the utf-8 space characters.

Steps to Reproduce

  1. Install domdf-python-tools into a poetry project so the package description appears in poetry.lock.
  2. Run the https://github.com/sirosen/texthooks?tab=readme-ov-file#fix-spaces pre-commit hook.
  3. See that the hook has changed the contents of poetry.lock with git diff.

Actual result:

I copied the description string into a test script to check each character code:

>>> for c in '"Helpful functions for Python 🐍 🛠️"':
...   print(f"char '{c}' : {hex(ord(c))}")
... 
char '"' : 0x22
char 'H' : 0x48
char 'e' : 0x65
char 'l' : 0x6c
char 'p' : 0x70
char 'f' : 0x66
char 'u' : 0x75
char 'l' : 0x6c
char ' ' : 0x20
char 'f' : 0x66
char 'u' : 0x75
char 'n' : 0x6e
char 'c' : 0x63
char 't' : 0x74
char 'i' : 0x69
char 'o' : 0x6f
char 'n' : 0x6e
char 's' : 0x73
char ' ' : 0x20
char 'f' : 0x66
char 'o' : 0x6f
char 'r' : 0x72
char ' ' : 0x20
char 'P' : 0x50
char 'y' : 0x79
char 't' : 0x74
char 'h' : 0x68
char 'o' : 0x6f
char 'n' : 0x6e
char ' ' : 0x2002
char '🐍' : 0x1f40d
char ' ' : 0x2002
char '🛠' : 0x1f6e0
char '️' : 0xfe0f
char '"' : 0x22

Expected result:

Reproduces how often:

Every time installed

Version

  • Operating System: Devuan 5
  • Python: 3.12.3 (pyenv)
  • domdf_python_tools: 3.8.0.post2

Installation source

poetry/pypi

@wwuck wwuck added the bug Something isn't working label May 14, 2024
@wwuck wwuck linked a pull request May 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants