Skip to content

Commit

Permalink
Docs: Contributing changes (langchain-ai#17551)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eyurtsev authored Feb 14, 2024
1 parent 7ae3ce6 commit e438fe6
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 52 deletions.
41 changes: 1 addition & 40 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,4 @@
Hi there! Thank you for even being interested in contributing to LangChain.
As an open-source project in a rapidly developing field, we are extremely open to contributions, whether they involve new features, improved infrastructure, better documentation, or bug fixes.

To learn about how to contribute, please follow the [guides here](https://python.langchain.com/docs/contributing/)

## 🗺️ Guidelines

### 👩‍💻 Ways to contribute

There are many ways to contribute to LangChain. Here are some common ways people contribute:

- [**Documentation**](https://python.langchain.com/docs/contributing/documentation): Help improve our docs, including this one!
- [**Code**](https://python.langchain.com/docs/contributing/code): Help us write code, fix bugs, or improve our infrastructure.
- [**Integrations**](https://python.langchain.com/docs/contributing/integrations): Help us integrate with your favorite vendors and tools.

### 🚩GitHub Issues

Our [issues](https://github.com/langchain-ai/langchain/issues) page is kept up to date with bugs, improvements, and feature requests.

There is a taxonomy of labels to help with sorting and discovery of issues of interest. Please use these to help organize issues.

If you start working on an issue, please assign it to yourself.

If you are adding an issue, please try to keep it focused on a single, modular bug/improvement/feature.
If two issues are related, or blocking, please link them rather than combining them.

We will try to keep these issues as up-to-date as possible, though
with the rapid rate of development in this field some may get out of date.
If you notice this happening, please let us know.

### 🙋Getting Help

Our goal is to have the simplest developer setup possible. Should you experience any difficulty getting setup, please
contact a maintainer! Not only do we want to help get you unblocked, but we also want to make sure that the process is
smooth for future contributors.

In a similar vein, we do enforce certain linting, formatting, and documentation standards in the codebase.
If you are finding these difficult (or even just annoying) to work with, feel free to contact a maintainer for help -
we do not want these to get in the way of getting good code into the codebase.

### Contributor Documentation

To learn about how to contribute, please follow the [guides here](https://python.langchain.com/docs/contributing/)
To learn how to contribute to LangChain, please follow the [contribution guide here](https://python.langchain.com/docs/contributing/).
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ docs_build:
docs/.local_build.sh

docs_clean:
rm -r _dist
@if [ -d _dist ]; then \
rm -r _dist; \
echo "Directory _dist has been cleaned."; \
else \
echo "Nothing to clean."; \
fi

docs_linkcheck:
poetry run linkchecker _dist/docs/ --ignore-url node_modules
Expand Down
33 changes: 27 additions & 6 deletions docs/api_reference/create_api_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
ROOT_DIR = Path(__file__).parents[2].absolute()
HERE = Path(__file__).parent


ClassKind = Literal["TypedDict", "Regular", "Pydantic", "enum"]


Expand Down Expand Up @@ -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__":
Expand Down
3 changes: 1 addition & 2 deletions docs/docs/contributing/documentation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Similar to linting, we recognize documentation can be annoying. If you do not wa
### Install dependencies

- [Quarto](https://quarto.org) - package that converts Jupyter notebooks (`.ipynb` files) into mdx files for serving in Docusaurus.
- `poetry install` from the monorepo root
- `poetry install --with lint,docs --no-root` from the monorepo root.

### Building

Expand Down Expand Up @@ -49,7 +49,6 @@ make api_docs_linkcheck
The docs are linted from the monorepo root. To lint the docs, run the following from there:

```bash
poetry install --with lint,typing
make lint
```

Expand Down
11 changes: 9 additions & 2 deletions docs/docs/contributing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ There are many ways to contribute to LangChain. Here are some common ways people
- [**Documentation**](./documentation.mdx): Help improve our docs, including this one!
- [**Code**](./code.mdx): Help us write code, fix bugs, or improve our infrastructure.
- [**Integrations**](integrations.mdx): Help us integrate with your favorite vendors and tools.
- [**Discussions**](https://github.com/langchain-ai/langchain/discussions): Help answer usage questions and discuss issues with users.

### 🚩GitHub Issues
### 🚩 GitHub Issues

Our [issues](https://github.com/langchain-ai/langchain/issues) page is kept up to date with bugs, improvements, and feature requests.

Expand All @@ -31,7 +32,13 @@ We will try to keep these issues as up-to-date as possible, though
with the rapid rate of development in this field some may get out of date.
If you notice this happening, please let us know.

### 🙋Getting Help
### 💭 GitHub Discussions

We have a [discussions](https://github.com/langchain-ai/langchain/discussions) page where users can ask usage questions, discuss design decisions, and propose new features.

If you are able to help answer questions, please do so! This will allow the maintainers to spend more time focused on development and bug fixing.

### 🙋 Getting Help

Our goal is to have the simplest developer setup possible. Should you experience any difficulty getting setup, please
contact a maintainer! Not only do we want to help get you unblocked, but we also want to make sure that the process is
Expand Down
2 changes: 1 addition & 1 deletion docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const config = {
},
{
to: "/docs/contributing",
label: "Developer's guide",
label: "Contributing",
},
{
type: "docSidebar",
Expand Down

0 comments on commit e438fe6

Please sign in to comment.