Skip to content

Flit removes VCS check for ignored files when --format wheel is used #743

@potiuk

Description

@potiuk

When you build your package with flit (latest version 3.12.0) the fact whether .gitignored files are ignored or not depends on the presence of --format flag. It looks like the .gitignored files are excluded only when --format sdist is used or when "default" settings are used (no --format specifided). But this filtering is not applied when you only build wheel files.

You can check it by checking out airflow repo and following the steps:

git clone git@github.com:apache/airflow.git

# generate UI files
cd airflow
pre-commit run compile-fab-assets --all-files 

# at this moment  providers/fab/src/airflow/providers/fab/www/node_modules should be created
# the file is .gitignored at top level folder
cd  providers/fab

# cleanup dist
jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± rm -rf dist/*
zsh: sure you want to delete all the files in /home/jarek/code/airflow/providers/fab/dist [yn]? y
zsh: no matches found: dist/*
                                                                                                                                                                                                                                             [jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider 1 ± 


# build both sdist and wheel packages - make sure VCS files are ignored
[jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± flit build --use-vcs
Found 207 files tracked in git                                                                                                                                                                                                   I-flit.sdist
Built sdist: dist/apache_airflow_providers_fab-2.0.0.tar.gz                                                                                                                                                                 I-flit_core.sdist
Copying package file(s) from /tmp/tmpkikll3wf/apache_airflow_providers_fab-2.0.0/src/airflow/providers/fab                                                                                                                  I-flit_core.wheel
Writing metadata files                                                                                                                                                                                                      I-flit_core.wheel
Writing the record of files                                                                                                                                                                                                 I-flit_core.wheel
Built wheel: dist/apache_airflow_providers_fab-2.0.0-py3-none-any.whl                                                                                                                                                       I-flit_core.wheel
[jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± ls -la dist
total 1308
drwxr-xr-x 1 jarek jarek    184 Apr  7 14:37 .
drwxr-xr-x 1 jarek jarek    142 Apr  7 14:37 ..
-rw------- 1 jarek jarek 603350 Apr  7 14:37 apache_airflow_providers_fab-2.0.0-py3-none-any.whl
-rw-r--r-- 1 jarek jarek 729661 Apr  7 14:37 apache_airflow_providers_fab-2.0.0.tar.gz

# you see that the .whl file ~600 KB

# Do it again but only for wheel
[jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± rm -rf dist/*       
zsh: sure you want to delete all 2 files in /home/jarek/code/airflow/providers/fab/dist [yn]? y
                                                                                                                                                                                                                                             
[jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± 
[jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± flit build --use-vcs --format wheel
Copying package file(s) from src/airflow/providers/fab                                                                                                                                                                      I-flit_core.wheel
Writing metadata files                                                                                                                                                                                                      I-flit_core.wheel
Writing the record of files                                                                                                                                                                                                 I-flit_core.wheel
Built wheel: dist/apache_airflow_providers_fab-2.0.0-py3-none-any.whl                                                                                                                                                       I-flit_core.wheel

# You can see that built packagr is ~30M and there is no message about ignoring files in flit output

[jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± ls -la dist 
total 29824
drwxr-xr-x 1 jarek jarek      102 Apr  7 14:37 .
drwxr-xr-x 1 jarek jarek      142 Apr  7 14:37 ..
-rw------- 1 jarek jarek 30539333 Apr  7 14:37 apache_airflow_providers_fab-2.0.0-py3-none-any.whl
[jarek:~/code/airflow/providers/fab] fix-too-big-size-of-fab-provider ± 

It's quite unexpected to have VCS exclusion only applied when sdist is build - especially that it is applied when the wheel package is build together with sdist

I'd expect the VCS exclusion to be applied also when .whl file is build alone

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions