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

build2023/switch to pyproject #240

Merged
merged 3 commits into from
Jan 30, 2024
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
30 changes: 12 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ To get started quickly, follow the steps below.

1. Ensure you have Python 3.8+ and [Git](https://git-scm.com/) installed on your system. You can check your Python version by running:

```
```bash
python --version
```

2. Clone the project repository:

```
```bash
git clone https://github.com/NVIDIA/NeMo-Guardrails.git
```

3. Navigate to the project directory:

```
```bash
cd nemoguardrails
```

4. Create a virtual environment to isolate your project's dependencies:

```
```bash
python3 -m venv venv
```

Expand All @@ -48,34 +48,28 @@ To get started quickly, follow the steps below.

- On Windows:

```
```powershell
venv\Scripts\activate
```

- On macOS and Linux:

```
```bash
source venv/bin/activate
```

6. Install the main dependencies from `requirements.txt`:

```
pip install -r requirements.txt
```

7. Install the development dependencies from `requirements-dev.txt`:
6. Install the main dependencies:

```
pip install -r requirements-dev.txt
```bash
python -m pip install ".[dev]"
```

This will install pre-commit, pytest, and other development tools specified in the `requirements-dev.txt` file.
This will install pre-commit, pytest, and other development tools, as well as all optional dependencies.

8. Set up pre-commit hooks:
7. Set up pre-commit hooks:

```
pre-commit install
python -m pre-commit install
```

This will ensure that the pre-commit checks, including Black, are run before each commit.
Expand Down
7 changes: 0 additions & 7 deletions MANIFEST.in

This file was deleted.

127 changes: 127 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[project]
name = "nemoguardrails"
description = "NeMo Guardrails is an open-source toolkit for easily adding programmagle guardrails to LLM-based conversational systems."
authors = [
{ name = "NVIDIA", email = "[email protected]"}
]
license = { file = "LICENSE.md" }
readme = "README.md"
dynamic = ["version"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
]
requires-python = ">=3.8"

dependencies = [
"aiohttp==3.8.5",
"annoy==1.17.3",
"fastapi==0.103.1",
"httpx==0.24.1",
"jinja2==3.1.2",
"langchain==0.0.352",
"nest-asyncio==1.5.6",
"pydantic==1.10.13",
"pyyaml~=6.0",
"sentence-transformers==2.2.2",
"simpleeval==0.9.13",
"starlette==0.27.0",
"typer==0.7.0",
"uvicorn==0.23.2",
"watchdog==3.0.0"
]

[project.optional-dependencies]
eval = [
"tqdm~=4.65",
"numpy~=1.24"
]
openai = [
"openai==0.28.1"
]
sdd = [
"presidio-analyzer~=2.2.351",
"presidio-anonymizer~=2.2.351",
"spacy~=3.7.2",
]
all = [
"nemo-guardrails[eval,sdd,openai]",
]
dev = [
"nemoguardrails[all]", # install all dependencies
"black==23.3.0",
"aioresponses==0.7.4",
"mypy==1.1.1",
"pre-commit==3.1.1",
"pylint==2.17.0",
"pytest==7.2.2",
"pytest-asyncio==0.21.0",
"pytest-cov==4.1.0",
"pytest-httpx==0.22.0"
]

[project.urls]
homepage = "https://github.com/NVIDIA/nemo-guardrails"
documentation = "https://github.com/NVIDIA/nemo-guardrails/tree/develop/docs"
repository = "https://github.com/NVIDIA/nemo-guardrails"
issues = "https://github.com/NVIDIA/nemo-guardrails/issues"
changelog = "https://github.com/NVIDIA/NeMo-Guardrails/blob/develop/CHANGELOG.md"

[project.scripts]
nemoguardrails = "nemoguardrails.__main__:app"

[tool.setuptools]
packages = ["nemoguardrails"]
license-files = [
"LICENSE.md",
"LICENSE-Apache-2.0.txt",
"LICENCES-3rd-party.txt"
]

[tool.setuptools.dynamic]
version = {attr = "nemoguardrails.__version__"}

[tool.setuptools.package-data]
nemoguardrails = [
"**/*.yml",
"**/*.co",
"**/*.txt",
"**/*.json",
"../examples/**/*",
"../chat-ui/**/*",
"eval/data/**/*",
]

[tool.pytest.ini_options]
addopts = "-p no:warnings"
log-level = "DEBUG"

# The flag below should only be activated in special debug sessions
# i.e. the test hangs and we need to see what happened up to that point.
# There are some race conditions with how the logging streams are closed in the teardown
# phase, which will cause tests to fail or "magically" ignored.
log_cli = "False"

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
9 changes: 0 additions & 9 deletions pytest.ini

This file was deleted.

12 changes: 0 additions & 12 deletions requirements-dev.txt

This file was deleted.

17 changes: 0 additions & 17 deletions requirements.txt

This file was deleted.

99 changes: 0 additions & 99 deletions setup.py

This file was deleted.