Skip to content

Poetry for dependency management #436

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

Merged

Conversation

irgolic
Copy link
Contributor

@irgolic irgolic commented Nov 7, 2023

We're currently using both requirements.txt and setup.py to specify our dependencies. Let's get rid of both of those and unify them with poetry.

After installing poetry, you can install the main and dev dependencies with:

poetry install

To only install the main dependencies (as users will when they pip install the library), use:

poetry install --only main

To install docs dependencies too, use:

poetry install --with docs

To install extra dependencies for validators, use:

poetry install --all-extras

This is equivalent to:

poetry install --extras="sql summary vectordb profanity detect-secrets manifest critique"

Upon our next release, to use the extras, users will need to install the package as with the corresponding extras they wish to use, eg:

pip install "guardrails-ai[sql]"

Copy link

vercel bot commented Nov 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
guardrails ⬜️ Ignored (Inspect) Visit Preview Nov 8, 2023 5:33pm

@irgolic irgolic force-pushed the poetry-for-dependency-management branch from 43e4757 to c06408d Compare November 8, 2023 17:21
@codecov-commenter
Copy link

codecov-commenter commented Nov 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@c7cb998). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #436   +/-   ##
=======================================
  Coverage        ?   81.42%           
=======================================
  Files           ?       36           
  Lines           ?     3940           
  Branches        ?        0           
=======================================
  Hits            ?     3208           
  Misses          ?      732           
  Partials        ?        0           
Flag Coverage Δ
unittests 81.42% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zsimjee zsimjee merged commit 957ee25 into guardrails-ai:main Nov 8, 2023
CalebCourier pushed a commit to guardrails-ai/guardrails-internal that referenced this pull request Nov 22, 2023
author zsimjee <[email protected]> 1699036706 -0700
committer Caleb Courier <[email protected]> 1700668933 -0600

Setup passed password (guardrails-ai#429)

* use pypi pass from env

* upgrade pip before installing deps

* pass pypi pass explicitly

* use environ competently

Cron nb (guardrails-ai#425)

* install deps + pkg for nb runs

* lock nb runner to 3.11.x

* use cohere api key from environ

* ref env vars for cohere + openai

fix bad merge in code originally from validators.py (guardrails-ai#427)

* fix bad merge in code originally from validators.py

* lint fixes

bump version (guardrails-ai#428)

Setup passed password (guardrails-ai#429)

* use pypi pass from env

* upgrade pip before installing deps

* pass pypi pass explicitly

* use environ competently

list -> List

Lock openai version (guardrails-ai#435)

* temporarily lock openai version

* bump version to be ready for release

Poetry for dependency management (guardrails-ai#436)

* Replace setup.py/requirements.txt/version.py with pyproject.toml/poetry.lock

* add dateutil to core dependencies

* convert dependency groups to extras

* Makefile/CI: Change to poetry

* poetry run

* replace make dev with make full

* poetry: include guardrails console script

* release_version: Set pypi token in poetry

pyproject.toml: version 0.2.7 => 0.2.8

from_element => from_xml

rail: load_schema => load_schema_from_xml

pydantic_utils.attach_validators_to_element: Fix typehint

Pass validator arguments through for string guard

Remove XML from pydantic guard instantiation

python_rail.compiled_prompt_1: Fix test (wrongly not annotated as optional)

Remove conversion-to-XML code

Move integration test to where it belongs

schema: Remove commented out method

load_string_schema_from_pydantic -> load_json_schema_from_pydantic

datatypes: Fix datatype deprecation

Remove deprecated datatypes from pydantic

test_run: Fix `from_element` => `from_xml` call

datatypes: Raise deprecation warning on datatype init

Move pydantic_utils to split package

logs_utils: Move ArbitraryModel to pydantic_utils

Move DataType.from_pydantic_field to pydantic_utils

add --build option to poetry build

release_version: specify token differently

fix project name (guardrails => guardrails-ai)

Fix reask prompt/instructions (guardrails-ai#432)

* schema: Always use reask prompt/instructions setter

* guard/run: Remove reask prompt/instructions plumbing

* guard: Allow passing reask prompt/instructions to pydantic constructor

* guard: Link reask prompt/instructions properties to schema

* format

index similarToList notebook (guardrails-ai#426)

Fix custom onfail handler (guardrails-ai#421)

* formatattr: Pass through custom on_fail methods

* validator_service: Pass all FailResults to custom fail handler instead of only first

* test_validators: Add custom on_fail handler test

Init pydantic_utils v2

Adjust tests for pydantic2

pydantic: Allow Dict/List field types (fix guardrails-ai#319)

test_validators: Fix SimilarToList validator test

CI: handle pydantic v1 and v2 separately

list => List

parsing_utils: Type ignore

pydantic_utils/v2: safe BareModel

fix Makefile for poetry

fix ci cache for pydantic versions

lint and test fixes

autoformat

Create PII Filter validator (guardrails-ai#395)

* Add PII filter: v0

* Update PII filter

* Update class docstring, add more entities to filter, bugfix and update some comments

* Move logic to helper function, update DEV_REQUIREMENTS, add integration tests

* Fix linting

* Write code according to Python 3.9

* Add mocks for AnalyzerEngine and AnonymizerEngine

* Change | to Union

* Add notebook example demo for PIIFilter

* Add package imports

* Init pydantic_utils v2

* Adjust tests for pydantic2

* pydantic: Allow Dict/List field types (fix guardrails-ai#319)

* test_validators: Fix SimilarToList validator test

* CI: handle pydantic v1 and v2 separately

* list => List

* parsing_utils: Type ignore

* pydantic_utils/v2: safe BareModel

* fix Makefile for poetry

* fix ci cache for pydantic versions

* Remove setup.py

* Update pyproject and poetry

* Linting fixes

* Remove types remain intact changes

* Strong type results to covaraiant Sequence, as suggested by Pyright

* Fix linting issues

* Change casting

* Add else condition for pii_entities to avoid unbound errors for entities_to_filter

---------

Co-authored-by: zsimjee <[email protected]>
Co-authored-by: Rafael Irgolic <[email protected]>

OpenAI v1 support (guardrails-ai#441)

* Support both openai v0 and v1

* Adjust CI for openai v0/v1

* Move LLMResponse object to its own file

* Add usage to provenance test mock

* Comment out ArbitraryCallable test suite for openai errors

* Adjust tests for openai v0/v1

* remove unused imports

* OpenAIv1: Don't instantiate openai.completions.create if key isn't present in environ

lint and type fix

fix test

' -> "

Rail XML: Rename "format" attr to "validators" (guardrails-ai#439)

* Rail XML: Rename "format" attr to "validators"

* added note that `format` will be removed in 0.4.x

* test_rail: Check format deprecation resolves properly

Allow OpenAI v1

pyproject.toml: Clamp pydantic to ">=1.10.9, <2.5"

pyproject.toml: Clamp pyright to 1.1.334

update poetry.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants