mirror of
https://github.com/hwchase17/langchain.git
synced 2025-12-02 06:46:07 +00:00
Docs: Contributing changes (#17551)
A few minor changes for contribution: 1) Updating link to say "Contributing" rather than "Developer's guide" 2) Minor changes after going through the contributing documentation page.
This commit is contained in:
@@ -14,7 +14,6 @@ from pydantic import BaseModel
|
||||
ROOT_DIR = Path(__file__).parents[2].absolute()
|
||||
HERE = Path(__file__).parent
|
||||
|
||||
|
||||
ClassKind = Literal["TypedDict", "Regular", "Pydantic", "enum"]
|
||||
|
||||
|
||||
@@ -323,30 +322,52 @@ def _package_dir(package_name: str = "langchain") -> Path:
|
||||
|
||||
|
||||
def _get_package_version(package_dir: Path) -> str:
|
||||
with open(package_dir.parent / "pyproject.toml", "r") as f:
|
||||
pyproject = toml.load(f)
|
||||
"""Return the version of the package."""
|
||||
try:
|
||||
with open(package_dir.parent / "pyproject.toml", "r") as f:
|
||||
pyproject = toml.load(f)
|
||||
except FileNotFoundError as e:
|
||||
print(
|
||||
f"pyproject.toml not found in {package_dir.parent}.\n"
|
||||
"You are either attempting to build a directory which is not a package or "
|
||||
"the package is missing a pyproject.toml file which should be added."
|
||||
"Aborting the build."
|
||||
)
|
||||
exit(1)
|
||||
return pyproject["tool"]["poetry"]["version"]
|
||||
|
||||
|
||||
def _out_file_path(package_name: str = "langchain") -> Path:
|
||||
def _out_file_path(package_name: str) -> Path:
|
||||
"""Return the path to the file containing the documentation."""
|
||||
return HERE / f"{package_name.replace('-', '_')}_api_reference.rst"
|
||||
|
||||
|
||||
def _doc_first_line(package_name: str = "langchain") -> str:
|
||||
def _doc_first_line(package_name: str) -> str:
|
||||
"""Return the path to the file containing the documentation."""
|
||||
return f".. {package_name.replace('-', '_')}_api_reference:\n\n"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Generate the api_reference.rst file for each package."""
|
||||
print("Starting to build API reference files.")
|
||||
for dir in os.listdir(ROOT_DIR / "libs"):
|
||||
# Skip any hidden directories
|
||||
# Some of these could be present by mistake in the code base
|
||||
# e.g., .pytest_cache from running tests from the wrong location.
|
||||
if not dir.startswith("."):
|
||||
print("Skipping dir:", dir)
|
||||
continue
|
||||
|
||||
if dir in ("cli", "partners"):
|
||||
continue
|
||||
else:
|
||||
print("Building package:", dir)
|
||||
_build_rst_file(package_name=dir)
|
||||
for dir in os.listdir(ROOT_DIR / "libs" / "partners"):
|
||||
partner_packages = os.listdir(ROOT_DIR / "libs" / "partners")
|
||||
print("Building partner packages:", partner_packages)
|
||||
for dir in partner_packages:
|
||||
_build_rst_file(package_name=dir)
|
||||
print("API reference files built.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user