Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif

recursive-include shiny/www *
recursive-include shiny/experimental/www *
recursive-include shiny/api-examples *
recursive-include shiny/templates *

prune shiny/api-examples
prune shiny/experimental/api-examples
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ requires = ["setuptools>=60", "wheel", "setuptools_scm>=8.0"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = { find = { include = ["shiny", "shiny.*"] } }
[tool.setuptools.packages.find]
where = ["."]
include = ["shiny*"]
namespaces = false

[tool.setuptools.exclude-package-data]
"*" = ["api-examples/**"]

[tool.setuptools_scm]
write_to = "shiny/_version.py"
Expand Down
10 changes: 10 additions & 0 deletions shiny/_docstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

def find_api_examples_dir(start_dir: str) -> Optional[str]:
current_dir = os.path.abspath(start_dir)
search_start = current_dir
while True:
api_examples_dir = os.path.join(current_dir, "api-examples")
if os.path.isdir(api_examples_dir):
Expand All @@ -19,6 +20,15 @@ def find_api_examples_dir(start_dir: str) -> Optional[str]:
if current_dir == os.path.dirname(current_dir):
break # Reached the global root directory
current_dir = os.path.dirname(current_dir)

# Not found - provide helpful error for documentation builders
if os.getenv("SHINY_ADD_EXAMPLES") == "true":
raise FileNotFoundError(
"Could not find 'api-examples/' directory. "
"Documentation must be built from the source repository, "
"not from an installed package. "
f"Searched from: {search_start}"
)
return None


Expand Down
Loading