Skip to content

Commit

Permalink
Update PyMSSQL (#3996)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLaPiana authored Aug 30, 2023
1 parent ebf3263 commit ff8dab9
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 54 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ The types of changes are:

## [Unreleased](https://github.com/ethyca/fides/compare/2.19.0...main)

### Changed

- Bump PyMSSQL version and remove workarounds [#3996](https://github.com/ethyca/fides/pull/3996)

## [2.19.0](https://github.com/ethyca/fides/compare/2.18.0...2.19.0)

### Added
Expand Down
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ RUN pip --no-cache-dir --disable-pip-version-check install --upgrade pip setupto

COPY requirements.txt .

# isolate our pymssql install and pin cython and pymssql versions explicitly
# this is due to a pymssql issue and is hopefully only temporarily necessary
# see https://github.com/ethyca/fides/issues/3824
RUN pip install cython==0.29.35
RUN pip install pymssql==2.1.5 --no-build-isolation

RUN pip install --no-cache-dir install -r requirements.txt

COPY dev-requirements.txt .
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ include LICENSE
include README.md
include requirements.txt
include dev-requirements.txt
include dangerous-requirements.txt
include versioneer.py
include src/fides/api/alembic/alembic.ini
include src/fides/_version.py
Expand Down
3 changes: 0 additions & 3 deletions dangerous-requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion noxfiles/ci_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def collect_tests(session: nox.Session) -> None:
errors within the test code.
"""
session.install(".")
install_requirements(session, include_dangerous=True)
install_requirements(session)
command = ("pytest", "tests/", "--collect-only")
session.run(*command)

Expand Down
4 changes: 1 addition & 3 deletions noxfiles/utils_nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ def teardown(session: nox.Session, volumes: bool = False, images: bool = False)
session.log("Teardown complete")


def install_requirements(session: nox.Session, include_dangerous=False) -> None:
def install_requirements(session: nox.Session) -> None:
session.install("-r", "requirements.txt")
session.install("-r", "dev-requirements.txt")
if include_dangerous:
session.install("-r", "dangerous-requirements.txt")


@nox.session()
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pydash==6.0.2
PyJWT==2.4.0
pymongo==3.13.0
PyMySQL==1.0.2
pymssql==2.2.8
python-jose[cryptography]==3.3.0
pyyaml>=5,<7
redis==3.5.3
Expand Down
39 changes: 0 additions & 39 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pathlib
from typing import List

from setuptools import find_packages, setup

Expand All @@ -14,43 +13,6 @@

install_requires = open("requirements.txt", encoding="utf-8").read().strip().split("\n")
dev_requires = open("dev-requirements.txt", encoding="utf-8").read().strip().split("\n")
dangerous_requires = (
open("dangerous-requirements.txt", encoding="utf-8").read().strip().split("\n")
)


def optional_requirements(
dependency_names: List[str], requires: List[str] = dangerous_requires
) -> List[str]:
"""
Matches the provided dependency names to lines in `optional-requirements.txt`,
and returns the full dependency string for each one.
Prevents the need to store version numbers in two places.
"""

requirements: List[str] = []

for dependency in dependency_names:
for optional_dependency in requires:
if optional_dependency.startswith(dependency):
requirements.append(optional_dependency)
break

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

raise ModuleNotFoundError


# Human-Readable Extras
# Versions are read from corresponding lines in `optional-requirements.txt`
extras = {
"mssql": optional_requirements(["pymssql"], dangerous_requires),
}
dangerous_extras = ["mssql"] # These extras break on certain platforms
extras["all"] = sum(
[value for key, value in extras.items() if key not in dangerous_extras], []
)

###################
## Package Setup ##
Expand All @@ -73,7 +35,6 @@ def optional_requirements(
license="Apache License 2.0",
install_requires=install_requires,
dev_requires=dev_requires,
extras_require=extras,
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3 :: Only",
Expand Down
2 changes: 1 addition & 1 deletion src/fides/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import os
import sys
from datetime import datetime, timezone
from time import perf_counter
from logging import WARNING
from time import perf_counter
from typing import Callable, Optional
from urllib.parse import unquote

Expand Down

0 comments on commit ff8dab9

Please sign in to comment.