question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't include a folder that is a subfolder of one excluded by gitignore

See original GitHub issue
  • OS version and name: Arch Linux
  • Poetry version: 1.0.10

Relevant part of pyproject.toml:

[tool.poetry]
authors = ["<...>"]
description = "Solution preparation optimization."
exclude = ["examples/*.xlsx", "src/preppy/z_*"]
include = ["docs/_build/latex/*.pdf", "docs/_build/html/", "examples/*.toml"]
name = "preppy"
readme = "README.md"
version = "0.1.18"

Relevant lines in .gitignore:

# Sphinx documentation
docs/_build/

With the above configuration, my pdf documentation, docs/_build/latex/preppy.pdf, is included, but the docs/_build/html/ folder is not. If I change the include to…

include = ["docs/_build/latex/*.pdf", "docs/_build/html/*html", "examples/*.toml"]

…it does include the various *.html files, but this isn’t sufficient as there are other artifacts and subfolders in html I also wish to include.

I thought maybe the issue was my syntax, so I tried the following variations, which didn’t work either:

include = ["docs/_build/latex/*.pdf", "docs/_build/html", "examples/*.toml"]
include = ["docs/_build/latex/*.pdf", "docs/_build/html/*", "examples/*.toml"]

It seems as if there is some issue in including a folder (but not a file or group of files) that is a subfolder of one ignored by .gitignore.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
finswimmercommented, Aug 14, 2020

Hello @multipitch ,

currently poetry does not include a folder recursive (while it does for export). You can do it by using this patter: "docs/_build/html/**/*"

fin swimmer

2reactions
ppena-LiveDatacommented, Nov 10, 2022

Usually built files are files that are meant to be included in a distributed package but not included in version control, so I find this behavior very counterintuitive. If Poetry is going to continue to exclude VCS-ignored files, then at the minimum, the documentation should be REALLY explicit about that and have an example that includes something like build/**/*, since Path.glob()'s ** is quite confusing, and all the built files (including under subdirectories) are usually what someone would want to include.

Read more comments on GitHub >

github_iconTop Results From Across the Web

git - .gitignore exclude folder but include specific subfolder
If you want to commit a specific subfolders of public , say for e.g. in your public/products directory you want to include files...
Read more >
Gitignore - Exclude all except specific subdirectory · GitHub
Gitignore - Exclude all except specific subdirectory - .gitignore. ... If all files excluded and you will include only specific sub-directories.
Read more >
gitignore exclude folder but include specific subfolder
1 Answer. If you exclude application/, then everything under it will always be excluded. For this question, you need to use unignore to...
Read more >
gitignore Documentation - Git
It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn't list excluded directories for...
Read more >
Gitignore exclude folder but include a subfolder
In a project using Git I have a folder that is added to .gitignore. But i needed to include a subfolder that is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found