Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Contributing folder #4415

Merged
merged 26 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d29888a
issues
mendonk Nov 5, 2024
077a741
contributing
mendonk Nov 5, 2024
e384a7d
telemetry-cleanup
mendonk Nov 5, 2024
6cdf04c
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 5, 2024
8cb170b
name
mendonk Nov 5, 2024
70d8e35
name
mendonk Nov 5, 2024
8b5c5a8
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 5, 2024
0e96eeb
pr-guidance
mendonk Nov 5, 2024
becb959
Merge branch 'docs-telemetry-and-contributing' of https://github.com/…
mendonk Nov 5, 2024
4a8e3fb
Apply suggestions from code review
mendonk Nov 6, 2024
54d880c
code-review
mendonk Nov 6, 2024
86da53b
move-discussions
mendonk Nov 6, 2024
f34e069
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 6, 2024
95a2691
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 8, 2024
f7a569e
have-written
mendonk Nov 8, 2024
78c29fc
why-to-run-locally
mendonk Nov 8, 2024
e9a3f5b
clarify-how-to-contribute
mendonk Nov 8, 2024
7809002
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 8, 2024
1e68c95
add-custom-component-page
mendonk Nov 8, 2024
18ff492
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 8, 2024
377c91d
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 11, 2024
bea16aa
Apply suggestions from code review
mendonk Nov 12, 2024
ad1a400
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 12, 2024
c610e42
update-join-the-community-age
mendonk Nov 12, 2024
5b192d0
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 12, 2024
532b49c
Merge branch 'main' into docs-telemetry-and-contributing
mendonk Nov 12, 2024
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
19 changes: 6 additions & 13 deletions docs/docs/Contributing/contributing-github-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,14 @@ sidebar_position: 2
slug: /contributing-github-issues
mendonk marked this conversation as resolved.
Show resolved Hide resolved
---

Our [issues](https://github.com/langflow-ai/langflow/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. For an overview of the system we use to tag our issues and pull requests, see the Langflow repo's [labels page](https://github.com/langflow-ai/langflow/labels).
mendonk marked this conversation as resolved.
Show resolved Hide resolved

## GitHub Discussions
mendonk marked this conversation as resolved.
Show resolved Hide resolved
mendonk marked this conversation as resolved.
Show resolved Hide resolved

Our [issues](https://github.com/langflow-ai/langflow/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.
If you're looking for help with your code, consider posting a question on the Langflow [GitHub Discussions board](https://github.com/langflow-ai/langflow/discussions). Please understand that we won't be able to provide individual support via email. We also believe that help is much more valuable if it's **shared publicly**, so that more people can benefit from it.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

Since the Discussions board is public, please follow this guidance when posting your code questions.

If you're looking for help with your code, consider posting a question on the [GitHub Discussions board](https://github.com/langflow-ai/langflow/discussions). Please understand that we won't be able to provide individual support via email. We also believe that help is much more valuable if it's **shared publicly**, so that more people can benefit from it.

- **Describing your issue:** Try to provide as many details as possible. What exactly goes wrong? _How_ is it failing? Is there an error? "XY doesn't work" usually isn't that helpful for tracking down problems. Always remember to include the code you ran and if possible, extract only the relevant parts and don't just dump your entire script. This will make it easier for us to reproduce the error.
- **Sharing long blocks of code or logs:** If you need to include long code, logs or tracebacks, you can wrap them in `<details>` and `</details>`. This [collapses the content](https://developer.mozilla.org/en/docs/Web/HTML/Element/details) so it only becomes visible on click, making the issue easier to read and follow.

## Issue labels {#e19eae656c914ce7aedc4f55565cc0bc}


---


[See this page](https://github.com/langflow-ai/langflow/labels) for an overview of the system we use to tag our issues and pull requests.
1. When describing your issue, try to provide as many details as possible. What exactly goes wrong? _How_ is it failing? Is there an error? "XY doesn't work" usually isn't that helpful for tracking down problems. Always remember to include the code you ran and if possible, extract only the relevant parts and don't just dump your entire script. This will make it easier for us to reproduce the error.

2. When you include long code, logs, or tracebacks, wrap them in `<details>` and `</details>` tags. This [collapses the content](https://developer.mozilla.org/en/docs/Web/HTML/Element/details) so the contents only becomes visible on click, making the issue easier to read and follow.
mendonk marked this conversation as resolved.
Show resolved Hide resolved
183 changes: 68 additions & 115 deletions docs/docs/Contributing/contributing-how-to-contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,157 +4,110 @@ sidebar_position: 1
slug: /contributing-how-to-contribute
mendonk marked this conversation as resolved.
Show resolved Hide resolved
---

# How to contribute to Langflow
mendonk marked this conversation as resolved.
Show resolved Hide resolved

This guide is intended to help you get started contributing to Langflow.
mendonk marked this conversation as resolved.
Show resolved Hide resolved
As an open-source project in a rapidly developing field, we are extremely open
to contributions, whether it be in the form of a new feature, improved infra, or better documentation.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

:::info
To contribute to this project, please follow the [fork and pull request](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) workflow.
mendonk marked this conversation as resolved.
Show resolved Hide resolved
mendonk marked this conversation as resolved.
Show resolved Hide resolved

This page may contain outdated information. It will be updated as soon as possible.
## Prerequisites
mendonk marked this conversation as resolved.
Show resolved Hide resolved

:::
- [uv(>=0.4)](https://docs.astral.sh/uv/getting-started/installation/)
- [Node.js](https://nodejs.org/en/download/package-manager)

## Contribute code

Develop Langflow locally with [uv](https://docs.astral.sh/uv/getting-started/installation/) and [Node.js](https://nodejs.org/en/download/package-manager).

### Clone the Langflow Repository

👋 Hello there!
1. Navigate to the [Langflow GitHub repository](https://github.com/langflow-ai/langflow) and click **Fork**.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

We welcome contributions from developers of all levels to our open-source project on [GitHub](https://github.com/langflow-ai/langflow). If you'd like to contribute, please check our contributing guidelines and help make Langflow more accessible.
2. Add the new remote to your local repository on your local machine:

```bash
git remote add fork https://github.com/<your_git_username>/langflow.git
```

### Prepare the development environment

As an open-source project in a rapidly developing field, we are extremely open to contributions, whether in the form of a new feature, improved infra, or better documentation.
1. Create development hooks.

```bash
make init
```

This command sets up the development environment by installing backend and frontend dependencies, building the frontend static files, and initializing the project. It runs `make install_backend`, `make install_frontend`, `make build_frontend`, and finally `uv run langflow run` to start the application.

To contribute to this project, please follow a ["fork and pull request"](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) workflow. Please do not try to push directly to this repo unless you are a maintainer.
2. Run `make lint`, `make format`, and `make unit_tests` before pushing to the repository.

### Debug

## Local Development {#0388cc3c758d434d994022863a6bafa9}
The repo includes a `.vscode/launch.json` file for debugging the backend in VSCode, which is a lot faster than debugging with Docker compose. To debug Langflow with the `launch.json` file in VSCode:
mendonk marked this conversation as resolved.
Show resolved Hide resolved

1. Open Langflow in VSCode.
2. Press Ctrl+Shift+D (or Cmd+Shift+D on Mac) to open the Run and Debug view.
mendonk marked this conversation as resolved.
Show resolved Hide resolved
3. Choose a configuration from the dropdown at the top (for example, "Debug Backend").
mendonk marked this conversation as resolved.
Show resolved Hide resolved
4. Click the green play button or press F5 to start debugging.
5. This allows you to quickly debug different parts of your application, like the backend, frontend, or CLI, directly from VSCode.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

---


You can develop Langflow using docker compose, or locally.


We provide a `.vscode/launch.json` file for debugging the backend in VSCode, which is a lot faster than using docker compose.


Setting up hooks:


`make init`


This will install the pre-commit hooks, which will run `make format` on every commit.


It is advised to run `make lint` before pushing to the repository.


## Run Locally {#5225c2ef0cd6403c9f6c6bbd888115e0}


---


Langflow can run locally by cloning the repository and installing the dependencies. We recommend using a virtual environment to isolate the dependencies from your system.


Before you start, make sure you have the following installed:

- Poetry (&gt;=1.4)
- Node.js

Then, in the root folder, install the dependencies and start the development server for the backend:
### Run Langflow locally (Poetry and Node.js)
mendonk marked this conversation as resolved.
Show resolved Hide resolved

Run Langflow locally by cloning the repository and installing the dependencies. We recommend using a virtual environment like venv or conda to isolate dependencies.
mendonk marked this conversation as resolved.
Show resolved Hide resolved
mendonk marked this conversation as resolved.
Show resolved Hide resolved

`make backend`
Before you begin, ensure you have [uv](https://docs.astral.sh/uv/getting-started/installation/) and [Node.js](https://nodejs.org/en/download/package-manager) installed.

1. In the repository root, install the dependencies and start the development server for the backend:

And the frontend:


`make frontend`


## Docker Compose {#b07f359414ff4220ac615afc364ee46e}


---


The following snippet will run the backend and frontend in separate containers. The frontend will be available at `localhost:3000` and the backend at `localhost:7860`.


`docker compose up --build# ormake dev build=1`


## Documentation {#5f34bcaeccdc4489b0c5ee2c4a21354e}


---


The documentation is built using [Docusaurus](https://docusaurus.io/). To run the documentation locally, run the following commands:


`cd docsnpm installnpm run start`


The documentation will be available at `localhost:3000` and all the files are located in the `docs/docs` folder. Once you are done with your changes, you can create a Pull Request to the `main` branch.


## Submitting Components {#9676353bc4504551a4014dd572ac8be8}


---


New components are added as objects of the [CustomComponent](https://github.com/langflow-ai/langflow/blob/dev/src/backend/base/langflow/interface/custom/custom_component/custom_component.py) class and any dependencies are added to the [pyproject.toml](https://github.com/langflow-ai/langflow/blob/dev/pyproject.toml#L27) file.


### Add an example component {#8caae106c853465d83183e7f5272e4d8}


You have a new document loader called **MyCustomDocumentLoader** and it would look awesome in Langflow.

1. Write your loader as an object of the [CustomComponent](https://github.com/langflow-ai/langflow/blob/dev/src/backend/base/langflow/interface/custom/custom_component/custom_component.py) class. You'll create a new class, `MyCustomDocumentLoader`, that will inherit from `CustomComponent` and override the base class's methods.
2. Define optional attributes like `display_name`, `description`, and `documentation` to provide information about your custom component.
3. Implement the `build_config` method to define the configuration options for your custom component.
4. Implement the `build` method to define the logic for taking input parameters specified in the `build_config` method and returning the desired output.
5. Add the code to the [/components/documentloaders](https://github.com/langflow-ai/langflow/tree/dev/src/backend/base/langflow/components) folder.
6. Add the dependency to [/documentloaders/__init__.py](https://github.com/langflow-ai/langflow/blob/dev/src/backend/base/langflow/components/documentloaders/__init__.py) as `from .MyCustomDocumentLoader import MyCustomDocumentLoader`.
7. Add any new dependencies to the outer [pyproject.toml](https://github.com/langflow-ai/langflow/blob/dev/pyproject.toml#L27) file.
8. Submit documentation for your component. For this example, you'd submit documentation to the [loaders page](https://github.com/langflow-ai/langflow/blob/dev/docs/docs/components/loaders).
9. Submit your changes as a pull request. The Langflow team will have a look, suggest changes, and add your component to Langflow.

## User Sharing {#34ac32e11f344eab892b94531a21d2c9}


---

```bash
make backend
```

You might want to share and test your custom component with others, but don't need it merged into the main source code.
2. Install dependencies and start the frontend:

```bash
make frontend
```

If so, you can share your component on the Langflow store.
## Contribute documentation

The documentation is built using [Docusaurus](https://docusaurus.io/). To run the documentation locally, run the following commands:
mendonk marked this conversation as resolved.
Show resolved Hide resolved

1. [Register at the Langflow store](https://www.langflow.store/login/).
```bash
cd docs
npm install
npm run start
```

The documentation will be available at `localhost:3000` and all the files are located in the `docs/docs` folder.

2. Undergo pre-validation before receiving an API key.
## Open a pull request

Once you wrote and manually tested your change, you can start sending the patch to the main repository.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

3. To deploy your amazing component directly to the Langflow store, without it being merged into the main source code, navigate to your flow, and then click **Share**. The share window appears:
- Open a new GitHub pull request with the patch against the `main` branch.
- Ensure the PR title follows semantic commits conventions.
mendonk marked this conversation as resolved.
Show resolved Hide resolved
- For example, `feat: add new feature`, `fix: correct issue with X`.
- Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.


![](./683296796.png)
## Report bugs or suggest improvements
mendonk marked this conversation as resolved.
Show resolved Hide resolved

Our [GitHub issues](https://github.com/langflow-ai/langflow/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. [See this page](https://github.com/langflow-ai/langflow/labels) for an overview of
the system we use to tag our issues and pull requests.

4. Choose whether you want to flow to be public or private. You can also **Export** your flow as a JSON file from this window. When you're ready to share the flow, click **Share Flow**. You should see a **Flow shared successfully** popup.
If you're looking for help with your code, consider posting a question on the
[GitHub Discussions board](https://github.com/langflow-ai/langflow/discussions). Please
understand that we won't be able to provide individual support via email. We
also believe that help is much more valuable if it's **shared publicly**,
so that more people can benefit from it.

Since the Discussions board is public, please follow this guidance when posting your code questions.

5. To confirm, navigate to the **Langflow Store** and filter results by **Created By Me**. You should see your new flow on the **Langflow Store**.
1. When describing your issue, try to provide as many details as possible. What exactly goes wrong? _How_ is it failing? Is there an error? "XY doesn't work" usually isn't that helpful for tracking down problems. Always remember to include the code you ran and if possible, extract only the relevant parts and don't just dump your entire script. This will make it easier for us to reproduce the error.

2. When you include long code, logs, or tracebacks, wrap them in `<details>` and `</details>` tags. This [collapses the content](https://developer.mozilla.org/en/docs/Web/HTML/Element/details) so the contents only becomes visible on click, making the issue easier to read and follow.
26 changes: 3 additions & 23 deletions docs/docs/Contributing/contributing-telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,15 @@ sidebar_position: 0
slug: /contributing-telemetry
---



:::info

This page may contain outdated information. It will be updated as soon as possible.

:::




Our system uses anonymous telemetry to collect essential usage statistics to enhance functionality and user experience. This data helps us identify commonly used features and areas needing improvement, ensuring our development efforts align with what you need.


:::note
Langflow uses anonymous telemetry to collect essential usage statistics to enhance functionality and user experience. This data helps us identify popular features and areas needing improvement, and ensures development efforts align with what you need.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

We respect your privacy and are committed to protecting your data. We do not collect any personal information or sensitive data. All telemetry data is anonymized and used solely for improving Langflow.

You can opt-out of telemetry by setting the `LANGFLOW_DO_NOT_TRACK` or `DO_NOT_TRACK` environment variable to `true` before running Langflow. This will disable telemetry data collection.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

:::




## Data Collected Includes {#1734ed50fb4a4a45aaa84185b44527ca}
This telemetry data is crucial for enhancing Langflow and ensuring that our development efforts align with your needs. Your feedback and suggestions are invaluable in shaping the future of Langflow, and we appreciate your support in making Langflow better for everyone.
mendonk marked this conversation as resolved.
Show resolved Hide resolved

## Telemetry Data Collected
mendonk marked this conversation as resolved.
Show resolved Hide resolved

### Run {#2d427dca4f0148ae867997f6789e8bfb}

Expand Down Expand Up @@ -66,5 +48,3 @@ You can opt-out of telemetry by setting the `LANGFLOW_DO_NOT_TRACK` or `DO_NO
- **Success**: Whether the component operated successfully, which helps in quality control.
- **ErrorMessage**: Details of any errors encountered, crucial for debugging and improvement.

This telemetry data is crucial for enhancing Langflow and ensuring that our development efforts align with your needs. Your feedback and suggestions are invaluable in shaping the future of Langflow, and we appreciate your support in making Langflow better for everyone.

Loading