[BUG] glob-style pattern with range ([0-9]) not working
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- python
- Domain
- build-system
Research direction
Start with the supplied setuptools-globstyle-bug.zip and the MANIFEST.in rules, then run the documented build and inspect the wheel with unzip -l. Compare global-exclude 202[0-9] with the working 202 and 202[23] patterns. Done means the range pattern excludes file3_20230814T111336.py as expected.
Written by the indexing model from the issue text.
Description
setuptools version
68.0.0
Python version
Python 3.10.12
OS
Ubuntu 22.04 under WSL2
Additional environment information
Environment
$ python --version
Python 3.10.12
$ pip freeze
build==0.10.0
packaging==23.1
pyproject_hooks==1.0.0
# Editable install with no version control (setuptools-tests==1.0)
-e <somedir>/setuptools-test
tomli==2.0.1
Setup to reproduce the problem
Description
When MANIFEST.in contains global-exclude *202*, any file with this string is being excluded such as file3_20230814T111336.py (WORKS AS INTENDED).
However, when MANIFEST.in contains global-exclude *202[0-9]*, any file with a string that follows that glob-style pattern gets included, such as one named file3_20230814T111336.py. That is the BUG.
Note that I tested the glob-style pattern an it is valid:
$ find . -name '*202[0-9]*'
./src/file3_20230814T111336.py
Last note, when MANIFEST.in contains global-exclude *202[23]*, that does work and file3_20230814T111336.py gets excluded. The [] syntax seams to work partially, but its "range" functionality does not.
Setuptools is not following what its documentation is referring to at Controlling files in the distribution which points to PyPA’s Packaging User Guide. In this last page, we do find:
matches any one of the characters between the square brackets (which may contain character ranges, e.g., [a-z] or [a-fA-F0-9]).
Expected behavior
global-exclude *202[0-9]*, any file with a string that follows that glob-style pattern should get excluded.
How to Reproduce
setuptools-globstyle-bug.zip provides an environment where one can test this. Simply edit MANIFEST.in to test the glob-style pattern you plan to test and call build to see what gets included in the wheel.
Output
When MANIFEST.in contains global-exclude *202[0-9]*, we notice below that the file file3_20230814T111336.py gets included.
unzip -l dist/*.whl
Length Date Time Name
--------- ---------- ----- ----
45 2023-08-14 13:09 file1.py
45 2023-08-14 13:09 file2.py
45 2023-08-14 13:09 file3_20230814T111336.py
45 2023-08-14 13:09 file3_print.py
265 2023-08-14 16:58 setuptools_tests-1.0.dist-info/METADATA
92 2023-08-14 16:58 setuptools_tests-1.0.dist-info/WHEEL
46 2023-08-14 16:58 setuptools_tests-1.0.dist-info/top_level.txt
599 2023-08-14 16:58 setuptools_tests-1.0.dist-info/RECORD
--------- -------
1182 8 files
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pypa/setuptools
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
pypa/setuptools#5272 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
pypa/setuptools#5235 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pypa/setuptools#5234 · 1 comment ·
-
bug Needs Triage
Difficulty 1/5 Under an hour Newbie friendliness 78/100
pypa/setuptools#4135 · 1 comment · 1 reaction ·
-
documentation Needs Triage
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
pypa/setuptools#2753 ·
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100