python-jsonschema / jsonschema-specifications

Support files exposing JSON from the JSON Schema specifications to Python
https://jsonschema-specifications.readthedocs.io/
MIT License
10 stars 7 forks source link

Wheel built from sdist is empty #58

Closed gschwaer closed 2 weeks ago

gschwaer commented 5 months ago

I was trying to build a wheel from the sdist release but the wheel does not contain any code. Here's what I did:

$ tar -xf jsonschema_specifications-2023.12.1.tar.gz
$ cd jsonschema_specifications-2023.12.1
$ python -m build -w
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - hatch-vcs
  - hatchling
* Getting build dependencies for wheel...
* Building wheel...
Successfully built jsonschema_specifications-2023.12.1-py3-none-any.whl
$ unzip -l dist/jsonschema_specifications-2023.12.1-py3-none-any.whl
Archive:  dist/jsonschema_specifications-2023.12.1-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
     2977  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/METADATA
       87  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/WHEEL
     1057  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/licenses/COPYING
      391  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/RECORD
---------                     -------
     4512                     4 files

I downloaded the sdist release jsonschema_specifications-2023.12.1.tar.gz from https://github.com/python-jsonschema/jsonschema-specifications/releases/tag/v2023.12.1

$ python --version
Python 3.9.12
$ python -m build --version
build 1.2.1
Julian commented 5 months ago

I can't reproduce this, it seems fine here:

⊙  curl -L https://github.com/python-jsonschema/jsonschema-specifications/releases/download/v2023.12.1/jsonschema_specifications-2023.12.1.tar.gz | tar xf - && cd jsonschema_specifications-2023.12.1 && pyproject-build --version && pyproject-build . -w && unzip -l dist/*.whl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 13983  100 13983    0     0  19424      0 --:--:-- --:--:-- --:--:-- 19424
build 1.2.1 (/Users/julian/.dotfiles/.local/share/virtualenvs/build/lib/python3.12/site-packages/build)
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - hatch-vcs
  - hatchling
* Getting build dependencies for wheel...
* Building wheel...
Successfully built jsonschema_specifications-2023.12.1-py3-none-any.whl
Archive:  dist/jsonschema_specifications-2023.12.1-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
      385  02-02-2020 00:00   jsonschema_specifications/__init__.py
     1140  02-02-2020 00:00   jsonschema_specifications/_core.py
     1785  02-02-2020 00:00   jsonschema_specifications/schemas/draft201909/metaschema.json
     1860  02-02-2020 00:00   jsonschema_specifications/schemas/draft201909/vocabularies/applicator
      517  02-02-2020 00:00   jsonschema_specifications/schemas/draft201909/vocabularies/content
     1531  02-02-2020 00:00   jsonschema_specifications/schemas/draft201909/vocabularies/core
      892  02-02-2020 00:00   jsonschema_specifications/schemas/draft201909/vocabularies/meta-data
     2834  02-02-2020 00:00   jsonschema_specifications/schemas/draft201909/vocabularies/validation
     2452  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/metaschema.json
     1659  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/applicator
      519  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/content
     1564  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/core
      403  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/format
      448  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/format-annotation
      445  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/format-assertion
      892  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/meta-data
      506  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/unevaluated
     2834  02-02-2020 00:00   jsonschema_specifications/schemas/draft202012/vocabularies/validation
     2600  02-02-2020 00:00   jsonschema_specifications/schemas/draft3/metaschema.json
     4357  02-02-2020 00:00   jsonschema_specifications/schemas/draft4/metaschema.json
     4437  02-02-2020 00:00   jsonschema_specifications/schemas/draft6/metaschema.json
     4819  02-02-2020 00:00   jsonschema_specifications/schemas/draft7/metaschema.json
        0  02-02-2020 00:00   jsonschema_specifications/tests/__init__.py
     1106  02-02-2020 00:00   jsonschema_specifications/tests/test_jsonschema_specifications.py
     2977  02-02-2020 00:00   jsonschema_specifications-2023.12.1.dist-info/METADATA
       87  02-02-2020 00:00   jsonschema_specifications-2023.12.1.dist-info/WHEEL
     1057  02-02-2020 00:00   jsonschema_specifications-2023.12.1.dist-info/licenses/COPYING
     3228  02-02-2020 00:00   jsonschema_specifications-2023.12.1.dist-info/RECORD
---------                     -------
    47334                     28 files

(Out of curiosity, any reason you're doing this, we already publish a wheel of course?)

gschwaer commented 4 months ago

Interesting, the exact same line does not work for me. (I added -z to tar, because it complained)

curl -L https://github.com/python-jsonschema/jsonschema-specifications/releases/download/v2023.12.1/jsonschema_specifications-2023.12.1.tar.gz | tar xzf - && cd jsonschema_specifications-2023.12.1 && pyproject-build --version && pyproject-build . -w && unzip -l dist/*.whl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 13983  100 13983    0     0  27579      0 --:--:-- --:--:-- --:--:-- 27579
build 1.2.1 (/home/gschwaer/.local/opt/miniconda3/lib/python3.9/site-packages/build)
* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - hatch-vcs
  - hatchling
* Getting build dependencies for wheel...
* Building wheel...
Successfully built jsonschema_specifications-2023.12.1-py3-none-any.whl
Archive:  dist/jsonschema_specifications-2023.12.1-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
     2977  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/METADATA
       87  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/WHEEL
     1057  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/licenses/COPYING
      391  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/RECORD
---------                     -------
     4512                     4 files

I'm building the wheel from source because that's what my build system does (Buildroot). I noticed an error in an unrelated package that could not find the jsonschema_specifications module. That was because the module was not present due to the wheel only contained the dist-info.

Weird the whole thing... I unfortunately don't have any experience with python building, do you have an idea what could be the culprit here?

Or how I can get more (than basically zero) debug output on the build?

Maybe I should try contacting the hatch project?

Thx for your help!

Julian commented 4 months ago

I honestly have no guesses -- if you install a new copy of build into a virtual environment do you get the same result? And/or if you install hatch itself instead of pyproject-build and run hatch build do you get a working wheel?

gschwaer commented 4 months ago

Hi, sorry for the delay. I tried it with hatch directly and still got only metadata files:

$ curl -L https://github.com/python-jsonschema/jsonschema-specifications/releases/download/v2023.12.1/jsonschema_specifications-2023.12.1.tar.gz | tar xzf - \
&& cd jsonschema_specifications-2023.12.1 \
&& hatch build \
&& unzip -l dist/*.whl
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 13983  100 13983    0     0  19474      0 --:--:-- --:--:-- --:--:-- 55932
────────────────────────────────────────────────────────────────── sdist ───────────────────────────────────────────────────────────────────
dist/jsonschema_specifications-2023.12.1.tar.gz
────────────────────────────────────────────────────────────────── wheel ───────────────────────────────────────────────────────────────────
dist/jsonschema_specifications-2023.12.1-py3-none-any.whl
Archive:  dist/jsonschema_specifications-2023.12.1-py3-none-any.whl
  Length      Date    Time    Name
---------  ---------- -----   ----
     2977  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/METADATA
       87  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/WHEEL
     1057  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/licenses/COPYING
      391  2020-02-02 00:00   jsonschema_specifications-2023.12.1.dist-info/RECORD
---------                     -------
     4512                     4 files

with latest hatch:

$ hatch --version
Hatch, version 1.12.0

The .tar.gz also contains only metadata files.

gschwaer commented 4 months ago

I think I just found the solution! https://github.com/pypa/hatch/issues/1283#issuecomment-1962802809 This is a bug in hatch that only appears if the project does not contain a .gitignore file (may be empty) and some directory above the one being build contains a .gitignore that has an ignore-all option *. This bug is recognized and tracked in hatch (see above).

Would it be acceptable to add an empty .gitignore to the repo for the time being?