Skip to content

Commit dd6deda

Browse files
committed
Turning Pyspark optional.
1 parent 84647d7 commit dd6deda

File tree

6 files changed

+126
-47
lines changed

6 files changed

+126
-47
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ black = "==19.3b0"
88
flake8 = "==3.7.7"
99
pytest = "==4.3.1"
1010
twine = "==1.13.0"
11+
cfn-lint = ">=0.22.0"
1112

1213
[packages]
1314
boto3 = "==1.9.164"
@@ -16,7 +17,6 @@ pandas = "==0.24.2"
1617
pyarrow = "==0.13.0"
1718
tenacity = "==5.0.4"
1819
pg8000 = "==1.13.1"
19-
pyspark = "==2.4.3"
2020

2121
[requires]
2222
python_version = "3.7"

Pipfile.lock

Lines changed: 113 additions & 40 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AWS Data Wrangler aims to fill a gap between AWS Analytics Services (Glue, Athen
88

99
---
1010

11-
*Contents:* **[Use Cases](#Use-Cases)** | **[Installation](#Installation)** | **[Usage](#Usage)** | **[License](#License)**
11+
*Contents:* **[Use Cases](#Use-Cases)** | **[Installation](#Installation)** | **[Examples](#Examples)** | **[License](#License)**
1212

1313
---
1414

@@ -30,7 +30,7 @@ AWS Data Wrangler aims to fill a gap between AWS Analytics Services (Glue, Athen
3030
AWS Data Wrangler runs only Python 3.6 and beyond.
3131
And runs on AWS Lambda, AWS Glue, EC2, on-premises, local, etc.
3232

33-
## Usage
33+
## Examples
3434

3535
### Writing Pandas Dataframe to Data Lake
3636

awswrangler/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
__title__ = "awswrangler"
22
__description__ = "Utilities for Pandas and Apache Spark on AWS."
3-
__version__ = "0.0b13"
3+
__version__ = "0.0b14"
44
__license__ = "Apache License 2.0"

awswrangler/session.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import logging
3+
import importlib
34

45
import boto3
56
from botocore.config import Config
@@ -9,7 +10,11 @@
910
from awswrangler.pandas import Pandas
1011
from awswrangler.glue import Glue
1112
from awswrangler.redshift import Redshift
12-
from awswrangler.spark import Spark
13+
14+
PYSPARK_INSTALLED = False
15+
if importlib.util.find_spec("pyspark"):
16+
PYSPARK_INSTALLED = True
17+
from awswrangler.spark import Spark
1318

1419

1520
LOGGER = logging.getLogger(__name__)
@@ -216,7 +221,9 @@ def redshift(self):
216221

217222
@property
218223
def spark(self):
219-
if not self._spark:
224+
if not PYSPARK_INSTALLED:
225+
self._spark = None
226+
elif not self._spark:
220227
self._spark = Spark(session=self)
221228
return self._spark
222229

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,4 @@
3131
"tenacity>=5.0.4",
3232
"pg8000>=1.13.1",
3333
],
34-
extras_require={"pyspark": ["pyspark>=2.4.3"]},
3534
)

0 commit comments

Comments
 (0)