Skip to content

Commit e823823

Browse files
authored
Migrate to pyproject.toml from setup.py (capitalone#218)
* adding pyproject.toml & update edgetest workflow * bump patch version * pip-compile the reqs file * pyproject fix indent * adding 3.11 to test matrix
1 parent 366ae88 commit e823823

File tree

8 files changed

+134
-112
lines changed

8 files changed

+134
-112
lines changed

.github/workflows/edgetest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ jobs:
2121
- id: run-edgetest
2222
uses: fdosani/[email protected]
2323
with:
24-
edgetest-flags: '-c setup.cfg -r requirements.txt --export'
24+
edgetest-flags: '-c pyproject.toml --export'
2525
base-branch: 'develop'
2626
skip-pr: 'false'

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.8, 3.9, '3.10']
18+
python-version: [3.8, 3.9, '3.10', '3.11']
1919

2020
steps:
2121
- uses: actions/checkout@v2

docs/source/developer.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,25 +91,24 @@ knowing what they're doing. Caveat emptor!
9191
Management of Requirements
9292
--------------------------
9393

94-
Requirements of the project should be added to ``requirements.txt``. Optional requirements used only for testing,
95-
documentation, or code quality are added to ``setup.py`` and ``EXTRAS_REQUIRE``
94+
Requirements of the project should be added to ``dependencies`` within our ``pyproject.toml``. Optional requirements used only for testing,
95+
documentation, or code quality are added to the ``project.optional-dependencies`` of our ``pyproject.toml``.
9696

9797
edgetest
9898
--------
9999

100100
edgetest is a utility to help keep requirements up to date and ensure a subset of testing requirements still work.
101101
More on edgetest `here <https://github.com/capitalone/edgetest>`_.
102102

103-
The ``setup.cfg`` has configuration details on how to run edgetest. This process can be automated via GitHub Actions.
104-
(A future addition, which will come soon).
103+
The ``pyproject.toml`` has configuration details on how to run edgetest. This process can be automated via GitHub Actions.
105104

106105
In order to execute edgetest locally you can run the following after install ``edgetest``:
107106

108107
.. code-block:: bash
109108
110-
edgetest -c setup.cfg -r requirements.txt --export
109+
edgetest -c pyproject.toml --export
111110
112-
This should return output like the following and also updating ``requirements.txt``:
111+
This should return output like the following and also update our ``dependencies`` within the ``pyproject.toml``:
113112

114113
.. code-block:: bash
115114
@@ -120,7 +119,6 @@ This should return output like the following and also updating ``requirements.tx
120119
core True pandas 1.3.5
121120
core True PyYAML 6.0
122121
============= =============== =================== =================
123-
No PEP-517 style requirements in setup.cfg to update. Updating requirements.txt
124122
125123
126124
Release Guide

locopy/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
__version__ = "0.5.2"
17+
__version__ = "0.5.3"

pyproject.toml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
[project]
2+
name = "locopy"
3+
description = "Loading/Unloading to Amazon Redshift using Python"
4+
readme = "README.rst"
5+
authors = [
6+
{ name="Faisal Dosani", email="[email protected]" },
7+
]
8+
license = {text = "Apache Software License"}
9+
dependencies = [
10+
"boto3<=1.28.3,>=1.9.92",
11+
"PyYAML<=6.0,>=5.1",
12+
"pandas<=2.0.3,>=0.25.2",
13+
"numpy<=1.25.1,>=1.22.0",
14+
]
15+
16+
requires-python = ">=3.8.0"
17+
classifiers = [
18+
"Intended Audience :: Developers",
19+
"Natural Language :: English",
20+
"Operating System :: OS Independent",
21+
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3 :: Only",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
]
29+
30+
dynamic = ["version"]
31+
32+
[project.urls]
33+
Homepage = "https://github.com/capitalone/locopy"
34+
Documentation = "https://capitalone.github.io/locopy/"
35+
36+
[tool.setuptools]
37+
packages = ["locopy"]
38+
zip-safe = false
39+
40+
[tool.setuptools.dynamic]
41+
version = {attr = "locopy._version.__version__"}
42+
43+
[project.optional-dependencies]
44+
psycopg2 = ["psycopg2-binary>=2.7.7"]
45+
pg8000 = ["pg8000>=1.13.1"]
46+
snowflake = ["snowflake-connector-python[pandas]>=2.1.2"]
47+
docs = ["sphinx", "sphinx_rtd_theme"]
48+
tests = [
49+
"hypothesis",
50+
"pytest",
51+
"pytest-cov",
52+
]
53+
qa = [
54+
"pre-commit",
55+
"black",
56+
"isort",
57+
]
58+
build = ["build", "twine", "wheel"]
59+
edgetest = ["edgetest", "edgetest-conda"]
60+
dev = [
61+
"locopy[tests]",
62+
"locopy[docs]",
63+
"locopy[qa]",
64+
"locopy[build]",
65+
]
66+
67+
[isort]
68+
multi_line_output = 3
69+
include_trailing_comma = true
70+
force_grid_wrap = 0
71+
use_parentheses = true
72+
line_length = 88
73+
74+
[edgetest.envs.core]
75+
python_version = "3.9"
76+
extras = [
77+
"tests",
78+
"psycopg2",
79+
"pg8000",
80+
"snowflake",
81+
]
82+
command = "pytest tests -m 'not integration'"
83+
upgrade = [
84+
"boto3",
85+
"PyYAML",
86+
"pandas",
87+
"numpy",
88+
]

requirements.txt

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,38 @@
1-
boto3<=1.28.3,>=1.9.92
2-
PyYAML<=6.0,>=5.1
3-
pandas<=2.0.3,>=0.25.2
4-
numpy<=1.25.1,>=1.22.0
1+
#
2+
# This file is autogenerated by pip-compile with Python 3.9
3+
# by the following command:
4+
#
5+
# pip-compile --output-file=requirements.txt pyproject.toml
6+
#
7+
boto3==1.28.0
8+
# via locopy (pyproject.toml)
9+
botocore==1.31.3
10+
# via
11+
# boto3
12+
# s3transfer
13+
jmespath==1.0.1
14+
# via
15+
# boto3
16+
# botocore
17+
numpy==1.25.0
18+
# via
19+
# locopy (pyproject.toml)
20+
# pandas
21+
pandas==2.0.3
22+
# via locopy (pyproject.toml)
23+
python-dateutil==2.8.2
24+
# via
25+
# botocore
26+
# pandas
27+
pytz==2023.3
28+
# via pandas
29+
pyyaml==6.0
30+
# via locopy (pyproject.toml)
31+
s3transfer==0.6.1
32+
# via boto3
33+
six==1.16.0
34+
# via python-dateutil
35+
tzdata==2023.3
36+
# via pandas
37+
urllib3==1.26.16
38+
# via botocore

setup.cfg

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

setup.py

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

0 commit comments

Comments
 (0)