diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5e4630a..66d52f52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,8 +25,8 @@ jobs: - name: Install dependencies run: | - pip install -U setuptools - pip install -r tests/REQUIREMENTS.lint.txt + pip install --upgrade setuptools tox + pip install .[lint] - name: Run Tox run: tox -e lint @@ -48,8 +48,8 @@ jobs: - name: Install dependencies run: | - pip install -U setuptools - pip install -r tests/REQUIREMENTS.test.txt + pip install --upgrade setuptools tox + pip install .[test] python -m playwright install python -m playwright install-deps diff --git a/.gitignore b/.gitignore index e5b919e4..6d21d16c 100644 --- a/.gitignore +++ b/.gitignore @@ -274,5 +274,4 @@ tags [._]*.un~ # End of https://www.toptal.com/developers/gitignore/api/python,vim,emacs,eclipse -/envs/ /doc/output diff --git a/Makefile b/Makefile index 09304207..10fd2204 100644 --- a/Makefile +++ b/Makefile @@ -1,38 +1,26 @@ SHELL=/bin/bash -PYTHON=python3 - -PYTHON_ENV_ROOT=envs -PYTHON_DEV_ENV=$(PYTHON_ENV_ROOT)/$(PYTHON)-dev -PYTHON_PACKAGING_ENV=$(PYTHON_ENV_ROOT)/$(PYTHON)-packaging-env +PYTHON=python3.10 +PYTHON_ENV=env .PHONY: clean doc dist test ci-test lint isort shell freeze -# development environment ##################################################### -$(PYTHON_DEV_ENV): REQUIREMENTS.dev.txt - rm -rf $(PYTHON_DEV_ENV) && \ - $(PYTHON) -m venv $(PYTHON_DEV_ENV) && \ - . $(PYTHON_DEV_ENV)/bin/activate && \ +# python env ################################################################## +$(PYTHON_ENV): pyproject.toml + rm -rf $(PYTHON_ENV) && \ + $(PYTHON) -m venv $(PYTHON_ENV) && \ + . $(PYTHON_ENV)/bin/activate && \ pip install pip --upgrade && \ - pip install -r ./REQUIREMENTS.dev.txt - -# packaging environment ####################################################### -$(PYTHON_PACKAGING_ENV): REQUIREMENTS.packaging.txt - rm -rf $(PYTHON_PACKAGING_ENV) && \ - $(PYTHON) -m venv $(PYTHON_PACKAGING_ENV) && \ - . $(PYTHON_PACKAGING_ENV)/bin/activate && \ - pip install --upgrade pip && \ - pip install .[packaging] + pip install -e .[dev,packaging] -# environment helper ########################################################## clean: - rm -rf $(PYTHON_ENV_ROOT) + rm -rf $(PYTHON_ENV) -shell: | $(PYTHON_DEV_ENV) - . $(PYTHON_DEV_ENV)/bin/activate && \ +shell: | $(PYTHON_ENV) + . $(PYTHON_ENV)/bin/activate && \ rlpython -freeze: | $(PYTHON_DEV_ENV) - . $(PYTHON_DEV_ENV)/bin/activate && \ +freeze: | $(PYTHON_ENV) + . $(PYTHON_ENV)/bin/activate && \ pip freeze # tests ####################################################################### @@ -49,11 +37,11 @@ isort: ./docker-compose run playwright tox -e isort $(args) # packaging ################################################################### -dist: | $(PYTHON_PACKAGING_ENV) - . $(PYTHON_PACKAGING_ENV)/bin/activate && \ +dist: | $(PYTHON_ENV) + . $(PYTHON_ENV)/bin/activate && \ rm -rf dist *.egg-info && \ - python -m build + $(PYTHON) -m build _release: dist - . $(PYTHON_PACKAGING_ENV)/bin/activate && \ + . $(PYTHON_ENV)/bin/activate && \ twine upload --config-file ~/.pypirc.fscherf dist/* diff --git a/REQUIREMENTS.dev.txt b/REQUIREMENTS.dev.txt deleted file mode 100644 index 6713590f..00000000 --- a/REQUIREMENTS.dev.txt +++ /dev/null @@ -1,2 +0,0 @@ --e . -tox \ No newline at end of file diff --git a/REQUIREMENTS.packaging.txt b/REQUIREMENTS.packaging.txt deleted file mode 100644 index 51e16c70..00000000 --- a/REQUIREMENTS.packaging.txt +++ /dev/null @@ -1,2 +0,0 @@ -build -twine \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 9929ef7c..54b656b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,49 @@ packaging = [ "twine", ] +dev = [ + "tox", +] + +test = [ + "aiohttp>=3,<4", + "jinja2", + "rlpython", + "typing-extensions", + + "coverage==7.2.6", + "pytest==7.3.1", + "pytest-aiohttp==1.0.4", + "pytest-dependency==0.5.1", + "pytest-mock==3.10.0", + "pytest-timeout==2.1.0", + "playwright==1.34.0", +] + +lint = [ + "aiohttp>=3,<4", + "jinja2", + "rlpython", + "typing-extensions", + + "coverage", + "flake8==6.0.0", + "flake8-2020==1.8.0", + "flake8-bugbear==23.5.9", + "flake8-commas==2.1.0", + "flake8-comprehensions==3.12.0", + "flake8-length==0.3.1", + "flake8-logging-format==0.9.0", + "flake8-mutable==1.2.0", + "flake8-noqa==1.3.1", + "flake8-pytest-style==1.7.2", + "flake8-quotes==3.3.2", + "flake8-use-fstring==1.4", + "mypy==1.3.0", + "isort==5.12.0", + "pytest==7.3.1", +] + [project.urls] "Homepage" = "https://lona-web.org" diff --git a/tests/REQUIREMENTS.lint.txt b/tests/REQUIREMENTS.lint.txt deleted file mode 100644 index dd5fbdfe..00000000 --- a/tests/REQUIREMENTS.lint.txt +++ /dev/null @@ -1,22 +0,0 @@ -aiohttp>=3,<4 -jinja2 -rlpython -typing-extensions - -tox -coverage -flake8==6.0.0 -flake8-2020==1.8.0 -flake8-bugbear==23.5.9 -flake8-commas==2.1.0 -flake8-comprehensions==3.12.0 -flake8-length==0.3.1 -flake8-logging-format==0.9.0 -flake8-mutable==1.2.0 -flake8-noqa==1.3.1 -flake8-pytest-style==1.7.2 -flake8-quotes==3.3.2 -flake8-use-fstring==1.4 -mypy==1.3.0 -isort==5.12.0 -pytest==7.3.1 diff --git a/tests/REQUIREMENTS.test.txt b/tests/REQUIREMENTS.test.txt deleted file mode 100644 index 9848dcd8..00000000 --- a/tests/REQUIREMENTS.test.txt +++ /dev/null @@ -1,13 +0,0 @@ -aiohttp>=3,<4 -jinja2 -rlpython -typing-extensions - -tox -coverage==7.2.6 -pytest==7.3.1 -pytest-aiohttp==1.0.4 -pytest-dependency==0.5.1 -pytest-mock==3.10.0 -pytest-timeout==2.1.0 -playwright==1.34.0 diff --git a/tox.ini b/tox.ini index 5cf6effb..fc062fa1 100644 --- a/tox.ini +++ b/tox.ini @@ -10,9 +10,7 @@ envlist=lint,py37,py38,py39,py310,py311 [testenv] passenv = PLAYWRIGHT_BROWSERS_PATH ignore_errors=True - -deps = - -r tests/REQUIREMENTS.test.txt +deps = .[test] commands = coverage erase @@ -26,8 +24,7 @@ commands = coverage html -d htmlcov [testenv:lint] -deps = - -r tests/REQUIREMENTS.lint.txt +deps = .[lint] commands = flake8 --config=flake8.ini lona tests test_project test_script doc @@ -37,8 +34,7 @@ commands = [testenv:isort] -deps = - isort +deps = .[lint] commands = isort .