Skip to content

Commit 1f4e5ef

Browse files
[WIP] move to poetry (#831)
* [WIP] move to poetry * [WIP] verbose in CI * Fix pandas bug * Bypass faulty type checking for pymysql connection * Update dependencies * Changes to test against CodeBuild unit tests and distribution build * Remove editable install for docs * Fix typing Co-authored-by: Abdel Jaidi <[email protected]>
1 parent 32065e2 commit 1f4e5ef

24 files changed

+4352
-169
lines changed

.bumpversion.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ commit = False
44
tag = False
55
tag_name = {new_version}
66

7+
[bumpversion:file:pyproject.toml]
8+
9+
[bumpversion:file:test_infra/pyproject.toml]
10+
711
[bumpversion:file:README.md]
812

913
[bumpversion:file:CONTRIBUTING_COMMON_ERRORS.md]

.flake8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
max-line-length = 120
3+
extend-ignore = E203, W503
4+
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,.venv,.venv2,.tox,dev,.env,.coverage

.github/workflows/minimal-tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ jobs:
2929
- name: Install Requirements
3030
run: |
3131
python -m pip install --upgrade pip
32-
pip install -U -r requirements-dev.txt
32+
python -m pip install poetry==1.1.7
33+
poetry config virtualenvs.create false --local
34+
poetry install --extras "sqlserver" -vvv
3335
- name: Test Metadata
3436
run: pytest tests/test_metadata.py
3537
- name: Test Session

.github/workflows/static-checking.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727
- name: Install Requirements
2828
run: |
2929
python -m pip install --upgrade pip
30-
pip install -U -r requirements-dev.txt
30+
python -m pip install poetry==1.1.7
31+
poetry config virtualenvs.create false --local
32+
poetry install --extras "sqlserver" -vvv
3133
- name: mypy check
3234
run: mypy --install-types --non-interactive awswrangler
3335
- name: Flake8 Lint

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ share/python-wheels/
2626
*.egg
2727
MANIFEST
2828

29+
# poetry
30+
poetry.toml
31+
envs.toml
32+
2933
# PyInstaller
3034
# Usually these files are written by a python script from a template
3135
# before PyInstaller builds the exe, so as to inject date/other infos into it.

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ You can choose from three different environments to test your fixes/changes, bas
9292
### Mocked test environment
9393

9494
* Pick up a Linux or MacOS.
95-
* Install Python 3.7, 3.8 or 3.9
95+
* Install Python 3.7, 3.8 or 3.9 with [poetry](https://github.com/python-poetry/poetry) for package management
9696
* Fork the AWS Data Wrangler repository and clone that into your development environment
9797
* Go to the project's directory create a Python's virtual environment for the project
9898

@@ -104,7 +104,7 @@ or
104104

105105
* Install dependencies:
106106

107-
``pip install -r requirements-dev.txt``
107+
``poetry install --extras "sqlserver"``
108108

109109
* Run the validation script:
110110

@@ -123,7 +123,7 @@ or
123123
**DISCLAIMER**: Make sure you know what you are doing. These steps will charge some services on your AWS account and require a minimum security skill to keep your environment safe.
124124

125125
* Pick up a Linux or MacOS.
126-
* Install Python 3.7, 3.8 or 3.9
126+
* Install Python 3.7, 3.8 or 3.9 with [poetry](https://github.com/python-poetry/poetry) for package management
127127
* Fork the AWS Data Wrangler repository and clone that into your development environment
128128
* Go to the project's directory create a Python's virtual environment for the project
129129

@@ -135,15 +135,15 @@ or
135135

136136
* Install dependencies:
137137

138-
``pip install -r requirements-dev.txt``
138+
``poetry install --extras "sqlserver"``
139139

140140
* Go to the ``test_infra`` directory
141141

142142
``cd test_infra``
143143

144144
* Install CDK dependencies:
145145

146-
``pip install -r requirements.txt``
146+
``poetry install``
147147

148148
* [OPTIONAL] Set AWS_DEFAULT_REGION to define the region the Data Lake Test environment will deploy into. You may want to choose a region which you don't currently use:
149149

@@ -184,25 +184,25 @@ or
184184
**DISCLAIMER**: This environment contains Aurora MySQL, Aurora PostgreSQL and Redshift (single-node) clusters which will incur cost while running.
185185

186186
* Pick up a Linux or MacOS.
187-
* Install Python 3.7, 3.8 or 3.9
187+
* Install Python 3.7, 3.8 or 3.9 with [poetry](https://github.com/python-poetry/poetry) for package management
188188
* Fork the AWS Data Wrangler repository and clone that into your development environment
189189
* Go to the project's directory create a Python's virtual environment for the project
190190

191191
`python -m venv .venv && source .venv/bin/activate`
192192

193193
* Then run the command bellow to install all dependencies:
194194

195-
``pip install -r requirements-dev.txt``
195+
``poetry install --extras "sqlserver"``
196196

197197
* Go to the ``test_infra`` directory
198198

199199
``cd test_infra``
200200

201201
* Install CDK dependencies:
202202

203-
``pip install -r requirements.txt``
203+
``poetry install``
204204

205-
* [OPTIONAL] Set AWS_DEFAULT_REGION to define the region the Full Test envrioment will deploy into. You may want to choose a region which you don't currently use:
205+
* [OPTIONAL] Set AWS_DEFAULT_REGION to define the region the Full Test environment will deploy into. You may want to choose a region which you don't currently use:
206206

207207
``export AWS_DEFAULT_REGION=ap-northeast-1``
208208

MANIFEST.in

Lines changed: 0 additions & 15 deletions
This file was deleted.

awswrangler/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def chunkify(lst: List[Any], num_chunks: int = 1, max_length: Optional[int] = No
227227
if not lst:
228228
return []
229229
n: int = num_chunks if max_length is None else int(math.ceil((float(len(lst)) / float(max_length))))
230-
np_chunks = np.array_split(lst, n) # type: ignore
230+
np_chunks = np.array_split(lst, n)
231231
return [arr.tolist() for arr in np_chunks if len(arr) > 0]
232232

233233

building/build-wheel.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
set -ex
33

44
pushd ..
5-
rm -rf *.egg-info build dist/*.whl
6-
python setup.py bdist_wheel
7-
rm -rf *.egg-info build
5+
rm -rf dist/*.whl
6+
poetry build -f wheel

building/lambda/Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,13 @@ RUN yum install -y \
1212
ninja-build \
1313
${py_dev}
1414

15-
RUN pip3 install --upgrade pip six cython cmake hypothesis
15+
RUN pip3 install --upgrade pip six cython cmake hypothesis poetry==1.1.7
1616

17-
ADD requirements.txt /root/
18-
RUN pip3 install -r /root/requirements.txt
17+
WORKDIR /root
1918

20-
ADD requirements-dev.txt /root/
21-
# Removing "-e ." installation
22-
RUN head -n -3 /root/requirements-dev.txt > /root/temp.txt
23-
RUN mv /root/temp.txt /root/requirements-dev.txt
24-
RUN pip3 install -r /root/requirements-dev.txt
19+
COPY pyproject.toml poetry.lock ./
20+
RUN poetry config virtualenvs.create false --local && poetry install --no-root
2521

26-
RUN rm -rf /root/requirements*
22+
RUN rm -f pyproject.toml poetry.lock
2723

2824
ENTRYPOINT ["/bin/sh"]

0 commit comments

Comments
 (0)