Skip to content
Merged
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
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
root = true

[*]
charset = utf-8
insert_final_newline = true

[*.md]
indent_style = space
indent_size = 2
max_line_length = 100

[*.py]
indent_style = space
indent_size = 4
max_line_length = 100

[*.toml]
indent_style = space
indent_size = 2
max_line_length = 100

[*.yaml]
indent_style = space
indent_size = 2
max_line_length = 100

[Makefile]
indent_style = tab
indent_size = 8
9 changes: 5 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
## Description

<!-- Describe the changes you made in this PR. -->
<!-- Describe the changes you made in this Pull Request. -->

## Checklist

<!-- Make sure all items below are checked before submitting the PR. -->
<!-- Make sure all items below are checked before submitting the Pull Request. -->

- [ ] I have run the tests locally with `make install-dev` and `make test`
- [ ] I have installed pre-commit on this project (for instance with the `make install-dev` command)
**before** creating any commit, or I have run successfully the `make lint` command on my changes
- [ ] I have run successfully the `make test` command on my changes
- [ ] I have updated the `README.md` if my changes affected it
- [ ] I have updated the package version in `linkup/_version.py` and `pyproject.toml` if I plan on creating a new release
170 changes: 8 additions & 162 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,170 +1,16 @@
# Byte-compiled / optimized / DLL files
# Python-generated files
.idea/
.ipynb_checkpoints/
.venv/
.vscode/
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv*
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site
*.egg-info
*.py[oc]

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


# OSX
# MacOS stuff
.DS_Store

# Dev
playground.ipynb
playground.py
2 changes: 2 additions & 0 deletions .mdformat.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
number = true
wrap = 100
26 changes: 22 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-merge-conflict
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- id: name-tests-test
- id: no-commit-to-branch
args: [--branch, main]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
rev: v0.13.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/hukkin/mdformat
rev: 0.7.22
hooks:
- id: mdformat
exclude: CHANGELOG.md

- repo: https://github.com/ComPWA/taplo-pre-commit
rev: v0.9.3
hooks:
- id: taplo-format

- repo: https://github.com/google/yamlfmt
rev: v0.17.2
hooks:
- id: yamlfmt

- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
rev: v8.28.0
hooks:
- id: gitleaks
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10
3.9
7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[formatting]
align_comments = false
allowed_blank_lines = 1
column_width = 100
reorder_arrays = true
reorder_inline_tables = true
reorder_keys = true
4 changes: 4 additions & 0 deletions .yamlfmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
formatter:
type: basic
retain_line_breaks_single: true
max_line_length: 100
34 changes: 26 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,30 @@ install-dev:
@$(MAKE) install
uv run pre-commit install

lint:
SKIP=no-commit-to-branch uv run pre-commit run --all-files

test-mypy:
@# Avoid running mypy on the whole directory ("./") to avoid potential conflicts with files with the same name (e.g. between different types of tests)
uv run mypy ./src/
uv run mypy ./tests/unit/
test-pytest:
uv run pytest --cov=src/linkup/ ./tests/unit/
test:
@echo "Running tests..."
uv run pre-commit run --all-files
uv run mypy .
# Follow the test practices recommanded by LangChain (v0.3)
# See https://python.langchain.com/docs/contributing/how_to/integrations/standard_tests/
uv run pytest --cov=src/linkup/ --cov-report term-missing --disable-socket --allow-unix-socket tests/unit_tests
# TODO: uncomment the following line when integration tests are ready
# pytest tests/integration_tests
@$(MAKE) test-mypy
@echo
@$(MAKE) test-pytest

update-uv:
uv lock --upgrade
uv sync
update-pre-commit:
uv run pre-commit autoupdate

clean:
rm -rf dist/
rm -f .coverage
rm -rf .mypy_cache/
rm -rf .pytest_cache/
rm -rf .ruff_cache/
rm -rf **/*/__pycache__/
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
![PyPI - Downloads](https://img.shields.io/pypi/dm/linkup-sdk)
[![Discord](https://img.shields.io/discord/1303713168916348959?color=7289da&logo=discord&logoColor=white)](https://discord.gg/9q9mCYJa86)


A [Python SDK](https://docs.linkup.so/pages/sdk/python/python) for the
[Linkup API](https://www.linkup.so/), allowing easy integration with Linkup's services. 🐍

Expand Down
2 changes: 2 additions & 0 deletions examples/1_direct_search_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
for instance in a RAG system, with the output_type parameter set to "searchResults".
"""

from rich import print

from linkup import LinkupClient

client = LinkupClient()
Expand Down
2 changes: 2 additions & 0 deletions examples/2_sourced_answer_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
along with the sources supporting it.
"""

from rich import print

from linkup import LinkupClient

client = LinkupClient()
Expand Down
5 changes: 2 additions & 3 deletions examples/3_structured_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
documented schema to steer the Linkup search in any direction.
"""

from typing import List

from pydantic import BaseModel, Field
from rich import print

from linkup import LinkupClient

Expand All @@ -17,7 +16,7 @@ class Event(BaseModel):


class Events(BaseModel):
events: List[Event] = Field(description="The list of events")
events: list[Event] = Field(description="The list of events")


client = LinkupClient()
Expand Down
7 changes: 4 additions & 3 deletions examples/4_asynchronous_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@

import asyncio
import time
from typing import List

from rich import print

from linkup import LinkupClient

client = LinkupClient()

queries: List[str] = [
queries: list[str] = [
"What are the 3 major events in the life of Abraham Lincoln?",
"What are the 3 major events in the life of George Washington?",
]
Expand All @@ -27,7 +28,7 @@ async def search(idx: int, query: str) -> None:
depth="standard", # or "deep"
output_type="searchResults", # or "sourcedAnswer" or "structured"
)
print(f"{idx+1}: {time.time() - t0:.3f}s")
print(f"{idx + 1}: {time.time() - t0:.3f}s")
print(response)
print("-" * 100)

Expand Down
Loading