oxan / djangorestframework-dataclasses

Dataclasses serializer for Django REST framework
BSD 3-Clause "New" or "Revised" License
429 stars 28 forks source link

Version 1.3.0 wheel package is missing `py.typed` file #85

Closed intgr closed 1 year ago

intgr commented 1 year ago

Not sure how this happened, I don't see any relevant changes in the git diff between v1.2.0...v1.3.0

But the recent 1.3.0 release .whl file does not contain a py.typed file, making type checkers like mypy ignore all type hints in the library.

% wget https://files.pythonhosted.org/packages/62/ba/8a6784d2a278b65cc685fc482516a5fe510555126a6b5f518407f64a20f1/djangorestframework_dataclasses-1.3.0-py3-none-any.whl
% unzip -l djangorestframework_dataclasses-1.3.0-py3-none-any.whl
Archive:  djangorestframework_dataclasses-1.3.0-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2023-08-21 11:14   rest_framework_dataclasses/__init__.py
     3683  2023-08-21 19:28   rest_framework_dataclasses/field_utils.py
     5555  2023-08-21 19:51   rest_framework_dataclasses/fields.py
    36389  2023-08-21 19:44   rest_framework_dataclasses/serializers.py
      742  2023-08-21 19:44   rest_framework_dataclasses/types.py
     9774  2023-08-21 19:28   rest_framework_dataclasses/typing_utils.py
     1486  2023-08-21 20:00   djangorestframework_dataclasses-1.3.0.dist-info/LICENSE
    28665  2023-08-21 20:00   djangorestframework_dataclasses-1.3.0.dist-info/METADATA
       92  2023-08-21 20:00   djangorestframework_dataclasses-1.3.0.dist-info/WHEEL
       27  2023-08-21 20:00   djangorestframework_dataclasses-1.3.0.dist-info/top_level.txt
     1079  2023-08-21 20:00   djangorestframework_dataclasses-1.3.0.dist-info/RECORD
---------                     -------
    87492                     11 files               # <-- !!!! one fewer file

Different from 1.2.0 version, which has this file:

% wget https://files.pythonhosted.org/packages/b5/ed/efc06e9cc560bfe14efeabc1a1b442e6a995425d92c6679bcc6a24025448/djangorestframework_dataclasses-1.2.0-py3-none-any.whl
% unzip -l djangorestframework_dataclasses-1.2.0-py3-none-any.whl
Archive:  djangorestframework_dataclasses-1.2.0-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2019-09-09 17:05   rest_framework_dataclasses/__init__.py
     3445  2022-11-18 20:28   rest_framework_dataclasses/field_utils.py
     1606  2022-11-10 22:03   rest_framework_dataclasses/fields.py
        0  2020-01-29 18:16   rest_framework_dataclasses/py.typed        # <-- !!!! file is present
    30334  2022-11-18 20:28   rest_framework_dataclasses/serializers.py
      944  2022-11-18 20:28   rest_framework_dataclasses/types.py
     8787  2022-11-18 20:28   rest_framework_dataclasses/typing_utils.py
     1486  2022-11-18 20:29   djangorestframework_dataclasses-1.2.0.dist-info/LICENSE
    23439  2022-11-18 20:29   djangorestframework_dataclasses-1.2.0.dist-info/METADATA
       92  2022-11-18 20:29   djangorestframework_dataclasses-1.2.0.dist-info/WHEEL
       27  2022-11-18 20:29   djangorestframework_dataclasses-1.2.0.dist-info/top_level.txt
     1168  2022-11-18 20:29   djangorestframework_dataclasses-1.2.0.dist-info/RECORD
---------                     -------
    71328                     12 files               # <-- !!!! one more file
intgr commented 1 year ago

I think what may have happened is that the build configuration for py.typed was already lost between versions v1.1.1...v1.2.0 in commit https://github.com/oxan/djangorestframework-dataclasses/commit/9be33a94884df3a7ae04c1c2119435c929c59c0f

But the build directory from 1.1.1 was re-used for 1.2.0 package, and the stray py.typed file remained from a previous build. I've had similar issues in the past with unclean build directories.

oxan commented 1 year ago

Hmm, that's strange, I remember checking this when I worked on 9be33a9, but I must've missed something.

But the build directory from 1.1.1 was re-used for 1.2.0 package, and the stray py.typed file remained from a previous build.

AFAIK python -m build (which I use) runs every build in a clean environment, so this shouldn't happen.

In any case, your PR looks good, I've merged it; thanks!