Comments (4)
Hello, I came across this issue while troubleshooting why rules from a global .gitignore configuration were not being recognized.
Honoring the first identified .gitignore for a project is not sufficient for the case where the full rule set that would normally apply to a project context also depends on other configuration used by Git.
Rather than try to maintain hatchling specific semantics for resolving and honoring the Git ignore set, would it be possible for hatchling to defer to Git's own ruleset interpretation? For example, something like find . | git check-ignore --stdin
will output all the files that should be ignored from the file tree according to whatever Git ignore rules would normally apply to a project, with Git as the authority.
I think asking Git itself to be the filter would also address the concern for projects that do not include a .gitignore file which should then fall back onto whatever heuristic Git uses in that situation.
from hatch.
My thought is to maintain the behavior of finding the first ignore file, but then only break if a .git
directory is found at some point along traversing up the root or if there is a PKG-INFO
in the same directory (implying a source distribution).
How does that sound?
from hatch.
An example project can be found at https://github.com/astral-test/uv-public-pypackage/tree/395ba191b190da0451c1e67a9b4a1cb5340398e5
Reproduction is something like this
❯ echo "*" > .gitignore
❯ git clone https://github.com/astral-test/uv-public-pypackage
❯ cd uv-public-pypackage
❯ rm -f .gitignore
❯ pip install -e .
❯ python -c "import uv_public_pypackage"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'uv_public_pypackage'
then only break if a .git directory is found at some point along traversing up the root
Would this break if run from the repository root then? Since it'd have a .git
directory? GIt submodules seem like an important edge-case to consider as well.
from hatch.
@geodab That is a good idea and something I wish to support as an option. I'm going to use the following issue to track: #304
from hatch.
Related Issues (20)
- raised "SyntaxError: invalid syntax" in a /usr/bin/python2.7 environment HOT 2
- Environment Variables for all environments HOT 13
- When using MetadataHookInterface, `gui-script` is not generating entry point in wheel HOT 6
- Please make trove classifier validation optional/non-fatal HOT 2
- MetadataHookInterface with logging leads to failures HOT 3
- Ensure Environment Plugin Dependencies for `hatch fmt` HOT 6
- A direct reference with context formatting causes an error violating URL validation of packaging HOT 2
- In latest unreleased hatch, many test errors when uv is not installed HOT 7
- Hatch doesn’t find Python versions other than its own and `…/python{,3}` on Linux HOT 17
- AttributeError: 'WindowsPath' object has no attribute 'endswith' HOT 5
- Running `hatch fmt` when pyproject.toml has context formatting causes failure HOT 1
- [Hatchling] Interpolate variable `version` in section `tool.hatch.build.targets.wheel.force-include` somehow? HOT 2
- `hatch version` should be able to handle static version numbers HOT 1
- hatch-v1.9.5 includes the features of Hatch v1.10.0 HOT 2
- Better PyApp integration
- Style adjustments to the README table render
- uv not installed despite being a hard dependency HOT 1
- Experiencing extreme slowness when running hatch run inside Docker HOT 5
- [lint.isort] settings duplicated HOT 1
- Binary app error: Could not find a version that satisfies the requirement HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hatch.