Skip to content

Commit

Permalink
Add nanobind.source_dir() API to obtain the source path (#840)
Browse files Browse the repository at this point in the history
This is useful when building with other tools or build systems, like `setuptools`
in my case.
  • Loading branch information
nicholasjng authored Jan 6, 2025
1 parent b7c4f1a commit c13fac3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
if sys.version_info < (3, 8):
raise ImportError("nanobind does not support Python < 3.8.")

def source_dir() -> str:
"Return the path to the nanobind source directory."
return os.path.join(os.path.abspath(os.path.dirname(__file__)), "src")

def include_dir() -> str:
"Return the path to the nanobind include directory"
return os.path.join(os.path.abspath(os.path.dirname(__file__)), "include")
Expand All @@ -16,6 +20,7 @@ def cmake_dir() -> str:

__all__ = (
"__version__",
"source_dir",
"include_dir",
"cmake_dir",
)

0 comments on commit c13fac3

Please sign in to comment.