diff --git a/Makefile b/Makefile index 99d73d8..9aa6a80 100644 --- a/Makefile +++ b/Makefile @@ -2,26 +2,24 @@ install-dev-requirements: pip install -U pip - pip install pipenv install-test-requirements: - pipenv install --dev - pipenv run python -c "import pipfile; pf = pipfile.load('Pipfile'); print('\n'.join(package+version if version != '*' else package for package, version in pf.data['default'].items()))" > requirements.txt + pip install -e .[test] services-up: - pipenv run docker-compose up -d + docker-compose up -d services-down: - pipenv run docker-compose down --remove-orphans + docker-compose down --remove-orphans test-python: @echo "Running Python tests" - pipenv run wait-for-it --service httpbin.local:443 --service localhost:6379 --timeout 5 -- pipenv run python run_tests.py || exit 1 + wait-for-it --service httpbin.local:443 --service localhost:6379 --timeout 5 -- python run_tests.py || exit 1 @echo "" lint-python: @echo "Linting Python files" - pipenv run flake8 --ignore=E501,E731,W503 --exclude=.git,compat.py --per-file-ignores='mocket/async_mocket.py:E999' mocket + flake8 --ignore=E501,E731,W503 --exclude=.git,compat.py --per-file-ignores='mocket/async_mocket.py:E999' mocket @echo "" setup: develop @@ -35,9 +33,8 @@ safetest: export SKIP_TRUE_REDIS=1; export SKIP_TRUE_HTTP=1; make test publish: install-test-requirements - pipenv run python -m build --sdist . - pipenv run twine upload --repository mocket dist/mocket-$(shell python -c 'import mocket; print(mocket.__version__)').tar.gz - pipenv run anaconda upload dist/mocket-$(shell python -c 'import mocket; print(mocket.__version__)').tar.gz + python -m build --sdist . + twine upload --repository mocket dist/mocket-$(shell python -c 'import mocket; print(mocket.__version__)').tar.gz clean: rm -rf *.egg-info dist/ requirements.txt Pipfile.lock diff --git a/Pipfile b/Pipfile deleted file mode 100644 index 5f0009b..0000000 --- a/Pipfile +++ /dev/null @@ -1,37 +0,0 @@ -[[source]] -url = "https://pypi.python.org/simple" -verify_ssl = true -name = "pypi" - -[packages] -python-magic = ">=0.4.5" -decorator = ">=4.0.0" -urllib3 = ">=1.25.3" -httptools = "*" - -[dev-packages] -pre-commit = "*" -pytest = "*" -pytest-cov = "*" -pytest-asyncio = "*" -asgiref = "*" -requests = "*" -redis = "*" -gevent = "*" -sure = "*" -pook = "*" -flake8 = "<7" -xxhash = "*" -aiohttp = "*" -httpx = "*" -pipfile = "*" -build = "*" -wheel = "*" -twine = "*" -anaconda-client = "*" -fastapi = "*" -docker-compose = "*" -wait-for-it = "*" - -[requires] -python_version = "3" diff --git a/mocket/__init__.py b/mocket/__init__.py index d4669b4..8e38178 100644 --- a/mocket/__init__.py +++ b/mocket/__init__.py @@ -2,5 +2,3 @@ from .mocket import Mocket, MocketEntry, Mocketizer, mocketize __all__ = ("async_mocketize", "mocketize", "Mocket", "MocketEntry", "Mocketizer") - -__version__ = "3.11.1" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..09c5527 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,67 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +requires-python = ">=3.5" +name = "mocket" +description = "Socket Mock Framework - for all kinds of socket animals, web-clients included - with gevent/asyncio/SSL support" +version = "3.11.1" +readme = { file = "README.rst", content-type = "text/x-rst" } +license = { file = "LICENSE" } +authors = [{ name = "Giorgio Salluzzo", email = "giorgio.salluzzo@gmail.com" }] +urls = { github = "https://github.com/mindflayer/python-mocket" } +classifiers = [ + "Development Status :: 6 - Mature", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development", + "Topic :: Software Development :: Testing", + "License :: OSI Approved :: BSD License", +] +dependencies = [ + "python-magic>=0.4.5", + "decorator>=4.0.0", + "urllib3>=1.25.3", + "httptools", +] + +[project.optional-dependencies] +test = [ + "pre-commit", + "pytest", + "pytest-cov", + "pytest-asyncio", + "asgiref", + "requests", + "redis", + "gevent", + "sure", + "pook", + "flake8", + "xxhash", + "aiohttp", + "httpx", + "pipfile", + "build", + "twine", + "fastapi", + "docker-compose", + "wait-for-it", +] +speedups = [ + 'xxhash;platform_python_implementation=="CPython"', + 'xxhash-cffi;platform_python_implementation=="PyPy"', +] +pook = [ + "pook>=0.2.1", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 145fced..0000000 --- a/setup.py +++ /dev/null @@ -1,67 +0,0 @@ -import io -import os - -from setuptools import find_packages, setup - -os.environ.setdefault("PIPENV_SKIP_LOCK", "1") - -install_requires = [ - line - for line in io.open( - os.path.join(os.path.dirname(__file__), "requirements.txt") - ).readlines() - if not line.startswith("-i") -] - -pook_requires = ("pook>=0.2.1",) -exclude_packages = ("tests", "tests.*") - - -def read_version(package): - init_path = os.path.join(package, "__init__.py") - with io.open(init_path, "r") as fd: - for line in fd: - if line.startswith("__version__ = "): - return line.split()[-1].strip().strip('"') - - -setup( - name="mocket", - version=read_version("mocket"), - author="Giorgio Salluzzo", - author_email="giorgio.salluzzo@gmail.com", - url="https://github.com/mindflayer/python-mocket", - description="Socket Mock Framework - for all kinds of socket animals, web-clients included - \ - with gevent/asyncio/SSL support", - long_description=io.open("README.rst", encoding="utf-8").read(), - long_description_content_type="text/x-rst", - packages=find_packages(exclude=exclude_packages), - install_requires=install_requires, - setup_requires=[], - extras_require={ - "speedups": [ - 'xxhash;platform_python_implementation=="CPython"', - 'xxhash-cffi;platform_python_implementation=="PyPy"', - ], - "dev": [], - "pook": pook_requires, # plugins version supporting mocket.plugins.pook.MocketEngine - }, - license="BSD", - classifiers=[ - "Development Status :: 6 - Mature", - "Intended Audience :: Developers", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Software Development", - "Topic :: Software Development :: Testing", - "License :: OSI Approved :: BSD License", - ], -)