Giter Club home page Giter Club logo

Comments (4)

geodab avatar geodab commented on June 1, 2024 1

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.

ofek avatar ofek commented on June 1, 2024

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.

zanieb avatar zanieb commented on June 1, 2024

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.

ofek avatar ofek commented on June 1, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.