Skip to content

Commit ea21850

Browse files
committed
migrate to pyproject.toml
1 parent 8bffb3a commit ea21850

File tree

8 files changed

+58
-25
lines changed

8 files changed

+58
-25
lines changed

.github/workflows/pytest.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ jobs:
1212
- "3.8"
1313
- "3.9"
1414
- "3.10"
15+
- "3.11"
1516
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-python@v2
17+
- uses: actions/checkout@v3
18+
- uses: actions/setup-python@v4
1819
with:
1920
python-version: ${{ matrix.python }}
20-
- uses: amancevice/setup-code-climate@v0
21+
- uses: amancevice/setup-code-climate@v1
2122
with:
2223
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }}
2324
- run: cc-test-reporter before-build
24-
- run: pip install . flake8 pytest pytest-cov pytest-flake8
25-
- run: pytest
25+
- run: pip install pipenv
26+
- run: make
2627
- run: cc-test-reporter after-build
2728
if: ${{ github.event_name != 'pull_request' }}

Makefile

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
PYFILES := $(shell find lambda_gateway tests -name '*.py')
2-
SDIST := dist/$(shell python setup.py --fullname).tar.gz
1+
all: test build
32

4-
all: $(SDIST)
3+
build: .venv
4+
pipenv run flit build
55

66
clean:
77
rm -rf dist
88

9-
upload: Brewfile.lock.json $(SDIST)
10-
twine upload $(SDIST)
9+
ipython:
10+
pipenv run ipython
1111

12-
.PHONY: all clean upload
12+
publish: test build
13+
git diff HEAD --quiet
14+
pipenv run flit publish
1315

14-
$(SDIST): $(PYFILES) Pipfile.lock
16+
test: .venv
17+
pipenv run black --check lambda_gateway tests
1518
pipenv run pytest
16-
python setup.py sdist
1719

18-
Brewfile.lock.json: Brewfile
19-
brew bundle
20+
.PHONY: all build clean ipython publish test
2021

21-
Pipfile.lock: Pipfile
22+
Pipfile.lock .venv: Pipfile
23+
mkdir -p .venv
2224
pipenv install --dev
25+
touch .venv

Pipfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[dev-packages]
7+
black = "*"
78
boto3 = "*"
8-
flake8 = "*"
9+
flit = "*"
910
ipdb = "*"
1011
ipython = "*"
1112
pytest = "*"
1213
pytest-cov = "*"
13-
pytest-flake8 = "*"
14-
twine = "*"
1514

1615
[packages]
1716
lambda-gateway = {editable = true,path = "."}

lambda_gateway/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"""
2+
Lambda Gateway
3+
"""
14
import logging
25

36
__version__ = "1.0.0"

pyproject.toml

+30-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
11
[build-system]
2-
requires = ["setuptools", "wheel"]
3-
build-backend = "setuptools.build_meta:__legacy__"
2+
requires = ["flit_core >=3.2,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[project]
6+
authors = [{name = "Alexander Mancevice", email = "[email protected]"}]
7+
classifiers = [
8+
"Development Status :: 3 - Alpha",
9+
"Intended Audience :: Developers",
10+
"Intended Audience :: System Administrators",
11+
"License :: OSI Approved :: MIT License",
12+
"License :: OSI Approved :: MIT License",
13+
"Operating System :: OS Independent",
14+
"Operating System :: OS Independent",
15+
"Programming Language :: Python :: 3",
16+
"Programming Language :: Python :: 3.7",
17+
"Programming Language :: Python :: 3.8",
18+
"Programming Language :: Python :: 3.9",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Topic :: Utilities",
22+
]
23+
dynamic = ["version", "description"]
24+
license = {file = "LICENSE"}
25+
name = "lambda_gateway"
26+
requires-python = ">= 3.7"
27+
readme = "README.md"
28+
29+
[project.urls]
30+
Home = "https://github.com/amancevice/python-lambda-gateway"
431

532
[tool.pytest.ini_options]
633
minversion = "6.0"
7-
addopts = "--verbose --flake8 --cov tests --cov-report term-missing --cov-report xml --cov lambda_gateway"
34+
addopts = "--cov lambda_gateway --cov tests --cov-report term-missing --cov-report xml"

tests/test_event_proxy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class TestEventProxy:
10-
def setup(self):
10+
def setup_method(self):
1111
self.subject = EventProxy("index.handler", "/simple/", 3)
1212

1313
@pytest.mark.parametrize(

tests/test_lambda_context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_start():
1111

1212

1313
class TestContext:
14-
def setup(self):
14+
def setup_method(self):
1515
self.subject = Context(1)
1616

1717
def test_function_name(self):

tests/test_request_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class TestLambdaRequestHandler:
14-
def setup(self):
14+
def setup_method(self):
1515
self.subject = Mock(LambdaRequestHandler)
1616
self.subject.proxy = Mock(EventProxy)
1717
self.subject.version = "2.0"

0 commit comments

Comments
 (0)