Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to forcibly include a directory? #243

Closed
blink1073 opened this issue May 15, 2022 · 9 comments · Fixed by #246
Closed

How to forcibly include a directory? #243

blink1073 opened this issue May 15, 2022 · 9 comments · Fixed by #246

Comments

@blink1073
Copy link
Contributor

We have generated files in ipyparallel that we'd like to include in the sdist and the wheel. The entire folder (ipyparallel/labextension) is ignored by .gitignore. I tried using include and artifacts config to include files in the directory but they are not ending up in the dist files. I suspect it is because the folder has already been ignored by the time the include/artifact pattern is checked.

@blink1073
Copy link
Contributor Author

What I had expected to work was:

[tool.hatch.build]
artifacts = [
  "ipyparallel/labextension/**/*.*"
]

@blink1073
Copy link
Contributor Author

We have the same problem in jupyter/notebook#6425 as well (notebook/labextension).

@blink1073
Copy link
Contributor Author

Ah, I got it working with:

[tool.hatch.build.force-include]
"./ipyparallel/labextension" = "ipyparallel/labextension"

Seems like a reasonable solution if you want to close this one.

@ofek
Copy link
Sponsor Collaborator

ofek commented May 15, 2022

Artifacts should work, can you paste an example path?

>>> import pathspec
>>> pathspec.PathSpec.from_lines(pathspec.patterns.GitWildMatchPattern, ['ipyparallel/labextension/**/*.*']).match_file('ipyparallel/labextension/foo/bar.txt')
True

@blink1073
Copy link
Contributor Author

ipyparallel/labextension/package.json
ipyparallel/labextension/static/bundle.js

@ofek
Copy link
Sponsor Collaborator

ofek commented May 15, 2022

Aww 🙁 https://github.com/pypa/hatch/blob/hatchling-v0.24.0/backend/src/hatchling/builders/plugin/interface.py#L181-L186

I do that for performance. I'll fix and put that behind a "fast" option.

@ofek
Copy link
Sponsor Collaborator

ofek commented May 15, 2022

#246

@agoose77
Copy link

I ran into this too, and resorted to force-include. Thanks for the fix!

@ofek ofek closed this as completed in #246 May 15, 2022
@blink1073
Copy link
Contributor Author

Excellent, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants