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

Make optional-requirements.txt a source of version truth #1171

Merged
merged 7 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ The types of changes are:
* Changed behavior of adding privacy declarations to decouple the actions of the "add" and "next" buttons [#1086](https://github.com/ethyca/fides/pull/1086)
* Moved system related UI components from the `config-wizard` directory to the `system` directory [#1097](https://github.com/ethyca/fides/pull/1097)

### Developer Experience

* Optional dependencies may have their version defined only once, in `optional-requirements.txt` [#1171](https://github.com/ethyca/fides/pull/1171)

### Fixed

* Fixed the "help" link in the UI header [#1078](https://github.com/ethyca/fides/pull/1078)
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ include LICENSE
include README.md
include requirements.txt
include dev-requirements.txt
include optional-requirements.txt
include versioneer.py
include src/fides/api/ctl/alembic.ini
include src/fides/_version.py
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ exclude = '''
## isort ##
###########
[tool.isort]
known_first_party = ["versioneer"]
profile = "black"
line_length = 88
src_paths = ["src", "tests", "noxfiles"]
Expand Down
38 changes: 28 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pathlib
from typing import List

from setuptools import find_packages, setup

Expand All @@ -13,18 +14,35 @@

install_requires = open("requirements.txt").read().strip().split("\n")
dev_requires = open("dev-requirements.txt").read().strip().split("\n")
optional_requires = open("optional-requirements.txt").read().strip().split("\n")


def optional_requirements(dependency_names: List[str]) -> List[str]:
PSalant726 marked this conversation as resolved.
Show resolved Hide resolved
requirements: List[str] = []

for dependency in dependency_names:
for optional_dependency in optional_requires:
if dependency in optional_dependency:
PSalant726 marked this conversation as resolved.
Show resolved Hide resolved
requirements.append(optional_dependency)
break

if len(requirements) == len(dependency_names):
return requirements

raise ModuleNotFoundError


# Human-Readable Extras
# Add these to `optional-requirements.txt` as well for Docker caching
aws = ["boto3~=1.24.46"]
bigquery = ["sqlalchemy-bigquery==1.4.4"]
mongo = ["pymongo==3.12.0"]
mssql = ["pyodbc==4.0.34"]
mysql = ["pymysql==1.0.2"]
okta = ["okta==2.5.0"]
redis = ["redis==3.5.3", "fastapi-caching[redis]"]
redshift = ["sqlalchemy-redshift==0.8.11"]
snowflake = ["snowflake-sqlalchemy==1.4.1"]
# Versions are read from corresponding lines in `optional-requirements.txt`
aws = optional_requirements(["boto3"])
bigquery = optional_requirements(["sqlalchemy-bigquery"])
mongo = optional_requirements(["pymongo"])
mssql = optional_requirements(["pyodbc"])
mysql = optional_requirements(["PyMySQL"])
okta = optional_requirements(["okta"])
redis = optional_requirements(["redis", "fastapi-caching[redis]"])
redshift = optional_requirements(["sqlalchemy-redshift"])
snowflake = optional_requirements(["snowflake-sqlalchemy"])

extras = {
"aws": aws,
Expand Down