Skip to content

Commit 2346c14

Browse files
committed
wip:better setup files
1 parent 4d7989c commit 2346c14

4 files changed

Lines changed: 79 additions & 54 deletions

File tree

Makefile

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1+
VENV_BIN ?= python3 -m venv
12
VENV_DIR ?= .venv
2-
TEST_PATH ?= ./tests
3-
PIP_CMD ?= pip
4-
NOSE_LOG_LEVEL ?= WARNING
3+
PIP_CMD ?= pip3
54

65
ifeq ($(OS), Windows_NT)
7-
VENV_RUN = . $(VENV_DIR)/Scripts/activate
6+
VENV_ACTIVATE = $(VENV_DIR)/Scripts/activate
87
else
9-
VENV_RUN = . $(VENV_DIR)/bin/activate
8+
VENV_ACTIVATE = $(VENV_DIR)/bin/activate
109
endif
1110

12-
setup-venv:
13-
(test `which virtualenv` || $(PIP_CMD) install --user virtualenv) && \
14-
(test -e $(VENV_DIR) || virtualenv $(VENV_OPTS) $(VENV_DIR))
11+
VENV_RUN = . $(VENV_ACTIVATE)
1512

16-
install-venv:
17-
make setup-venv && \
18-
test ! -e requirements.txt || ($(VENV_RUN); $(PIP_CMD) -q install -r requirements.txt)
13+
$(VENV_ACTIVATE): setup.py setup.cfg
14+
test -d $(VENV_DIR) || $(VENV_BIN) $(VENV_DIR)
15+
$(VENV_RUN); $(PIP_CMD) install --upgrade pip setuptools wheel plux
16+
touch $(VENV_ACTIVATE)
17+
18+
venv: $(VENV_ACTIVATE)
19+
20+
format: venv ## Run ruff and black to format the whole codebase
21+
($(VENV_RUN); python -m ruff check --show-source --fix .; python -m black .)
22+
23+
lint: venv ## Run code linter to check code style and check if formatter would make changes
24+
($(VENV_RUN); python -m ruff check --show-source . && python -m black --check .)
25+
26+
install: venv
27+
$(VENV_RUN); $(PIP_CMD) install -e .
28+
29+
test: venv ## Run tests
30+
($(VENV_RUN); python -m pytest -v --cov=plux --cov-report=term-missing --cov-report=xml tests)
1931

20-
test:
21-
($(VENV_RUN); DEBUG=$(DEBUG) PYTHONPATH=`pwd` nosetests $(NOSE_ARGS) --with-timer --logging-level=$(NOSE_LOG_LEVEL) --nocapture --no-skip --exe --cover-erase --cover-tests --cover-inclusive --cover-package=localstack --with-xunit --exclude='$(VENV_DIR).*' --ignore-files='lambda_python3.py' $(TEST_PATH))

requirements.txt

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

setug.cfg

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[metadata]
2+
name = localstack-utils
3+
version = attr: localstack_utils.__version__
4+
author = Cristopher Pinzon
5+
author_email = cristopher.pinzon@localstack.cloud
6+
summary = LocalStack Utils for testing
7+
description = Utils for testing with LocalStack
8+
long_description = file: README.md
9+
long_description_content_type = text/markdown; charset=UTF-8
10+
license = Apache License 2.0
11+
classifiers =
12+
Development Status :: 5 - Production/Stable
13+
License :: OSI Approved :: Apache Software License
14+
Operating System :: OS Independent
15+
Programming Language :: Python :: 3
16+
Programming Language :: Python :: 3.8
17+
Programming Language :: Python :: 3.9
18+
Programming Language :: Python :: 3.10
19+
Programming Language :: Python :: 3.11
20+
Topic :: Software Development :: Libraries
21+
Topic :: Utilities
22+
23+
[options]
24+
zip_safe = False
25+
packages = find:
26+
install_requires =
27+
docker>=6.1.1
28+
nose>=1.3.7
29+
nose-timer>=0.7.5
30+
test_requires =
31+
pytest>=7.4.0
32+
boto3>=1.26.121
33+
34+
[options.extras_require]
35+
dev =
36+
boto3>=1.26.121
37+
pytest>=7.4.0
38+
black==23.10.0
39+
ruff==0.1.0
40+
41+
[options.packages.find]
42+
exclude =
43+
tests*
44+
45+
[options.package_data]
46+
* = *.md
47+
exclude =
48+
tests
49+
tests.*
50+
51+
[options.entry_points]
52+
localstack_utils =
53+
localstack_utils = localstack_utils

setup.py

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,4 @@
1-
import re
2-
import setuptools
1+
#!/usr/bin/env python
2+
from setuptools import setup
33

4-
with open("README.md", "r", encoding="utf-8") as fh:
5-
long_description = fh.read()
6-
7-
install_req = []
8-
with open('requirements.txt') as f:
9-
requirements = f.read()
10-
11-
for line in re.split('\n', requirements):
12-
install_req.append(line)
13-
14-
15-
setuptools.setup(
16-
name="localstack-utils",
17-
description='An easy way to inclute Localstack with unit tests',
18-
version="0.0.1",
19-
author='Waldemar Hummer',
20-
author_email='waldemar.hummer@gmail.com',
21-
long_description=long_description,
22-
long_description_content_type="text/markdown",
23-
url="",
24-
project_urls={
25-
"Bug Tracker": "",
26-
},
27-
license='Apache License 2.0',
28-
classifiers=[
29-
"Programming Language :: Python :: 3",
30-
"Operating System :: OS Independent",
31-
"License :: OSI Approved :: Apache Software License",
32-
"Topic :: Software Development :: Testing",
33-
],
34-
package_dir={"": "localstack_utils"},
35-
packages=setuptools.find_packages(where="localstack_utils"),
36-
python_requires=">=3.6",
37-
install_requires=install_req
38-
)
4+
setup()

0 commit comments

Comments
 (0)