Compare commits

..

3 Commits

Author SHA1 Message Date
b19c7e806a
Fix linting errors
Remove unused imports
Disable redundant errors
Add notes for why errors are disabled
2024-08-15 14:41:34 -04:00
27ef531762
Add handling of error when poetry.lock does not exist
Fixes #81
2024-08-15 13:55:37 -04:00
92b72435f4
Replace optional [poetry] extra with explicit poetry dependencies
Fixes #79
2024-08-15 13:55:37 -04:00
15 changed files with 1325 additions and 828 deletions

View File

@ -12,6 +12,8 @@ jobs:
strategy: strategy:
matrix: matrix:
python: python:
- version: "3.7"
toxenv: py37
- version: "3.8" - version: "3.8"
toxenv: py38 toxenv: py38
- version: "3.9" - version: "3.9"
@ -20,8 +22,6 @@ jobs:
toxenv: py310 toxenv: py310
- version: "3.11" - version: "3.11"
toxenv: py311 toxenv: py311
- version: "3.12"
toxenv: py312
fail-fast: true fail-fast: true
steps: steps:
- name: Checkout - name: Checkout

View File

@ -47,13 +47,12 @@ repos:
- id: reorder-python-imports - id: reorder-python-imports
name: reorder-python-imports name: reorder-python-imports
entry: isort entry: reorder-python-imports
language: system language: system
require_serial: true args:
- "--unclassifiable-application-module=tox_poetry_installer"
types: types:
- python - python
args:
- "--filter-files"
- id: black - id: black
name: black name: black

2069
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -23,11 +23,11 @@ classifiers = [
"Natural Language :: English", "Natural Language :: English",
"Operating System :: OS Independent", "Operating System :: OS Independent",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
] ]
@ -35,34 +35,30 @@ classifiers = [
poetry_installer = "tox_poetry_installer" poetry_installer = "tox_poetry_installer"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = "^3.7"
cleo = ">=1.0,<3.0" cleo = ">=1.0,<3.0"
poetry = "^1.5.0" poetry = "^1.5.0"
poetry-core = "^1.1.0" poetry-core = "^1.1.0"
tox = "^4.1" tox = "^4"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
bandit = {version = "^1.7.7", python = "^3.10"} bandit = "^1.6.2"
black = {version = "^24.3.0", python = "^3.10"} black = "^22.3.0"
blacken-docs = {version = "^1.18.0", python = "^3.10"} blacken-docs = "^1.8.0"
ipython = {version = "^8.10.1", python = "^3.10"} ipython = {version = "^8.10.1", python = "^3.8"}
isort = {version = "^5.13.2", python = "^3.10"} mdformat = "^0.7"
mdformat = {version = "^0.7", python = "^3.10"} mdformat-gfm = "^0.3"
mdformat-gfm = {version = "^0.3", python = "^3.10"} mypy = "^0.930"
mypy = {version = "^0.930", python = "^3.10"} pre-commit = "^2.7.1"
pre-commit = {version = "^3.8.0", python = "^3.10"} pre-commit-hooks = "^3.3.0"
pre-commit-hooks = {version = "^4.6.0", python = "^3.10"} pylint = "^2.13.0"
pylint = {version = "^3.2.6", python = "^3.10"} pytest = "^6.0.2"
pytest = {version = "^8.3.2", python = "^3.10"} pytest-cov = "^2.10.1"
pytest-cov = {version = "^5.0.0", python = "^3.10"} reorder-python-imports = "^2.3.5"
toml = {version = "^0.10.1", python = "^3.10"} safety = "^2.2.0"
tox = "^4.1" toml = "^0.10.1"
types-toml = {version = "^0.10.1", python = "^3.10"} tox = "^4"
types-toml = "^0.10.1"
[tool.isort]
profile = "black"
force_single_line = "true"
lines_after_imports = 2
[build-system] [build-system]
requires = ["poetry-core>=1.1.0"] requires = ["poetry-core>=1.1.0"]

View File

@ -7,7 +7,6 @@ import tox.tox_env.python.virtual_env.runner
from poetry.factory import Factory from poetry.factory import Factory
import tox_poetry_installer.hooks._tox_on_install_helpers import tox_poetry_installer.hooks._tox_on_install_helpers
from .fixtures import mock_poetry_factory from .fixtures import mock_poetry_factory
from .fixtures import mock_venv from .fixtures import mock_venv

View File

@ -3,7 +3,6 @@
The next best thing to having one source of truth is having a way to ensure all of your The next best thing to having one source of truth is having a way to ensure all of your
sources of truth agree with each other. sources of truth agree with each other.
""" """
from pathlib import Path from pathlib import Path
import toml import toml

View File

@ -4,10 +4,9 @@ import poetry.utils.env
import pytest import pytest
import tox_poetry_installer.hooks._tox_on_install_helpers import tox_poetry_installer.hooks._tox_on_install_helpers
from tox_poetry_installer import exceptions
from .fixtures import mock_poetry_factory from .fixtures import mock_poetry_factory
from .fixtures import mock_venv from .fixtures import mock_venv
from tox_poetry_installer import exceptions
def test_allow_missing(): def test_allow_missing():

16
tox.ini
View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py3{8,9,10,11,12} static, static-tests, security envlist = py37, py38, py39, py310, py311, static, static-tests, security
skip_missing_interpreters = true skip_missing_interpreters = true
[testenv] [testenv]
@ -24,10 +24,10 @@ ignore_errors = true
locked_deps = locked_deps =
black black
blacken-docs blacken-docs
isort
mdformat mdformat
mdformat-gfm mdformat-gfm
mypy mypy
reorder-python-imports
pre-commit pre-commit
pre-commit-hooks pre-commit-hooks
pylint pylint
@ -50,7 +50,6 @@ locked_deps =
pylint pylint
pytest pytest
mypy mypy
toml
types-toml types-toml
commands = commands =
pylint {toxinidir}/tests/ \ pylint {toxinidir}/tests/ \
@ -77,3 +76,14 @@ commands =
--recursive \ --recursive \
--quiet \ --quiet \
--skip B101 --skip B101
poetry export \
--format requirements.txt \
--output {envtmpdir}/requirements.txt \
--without-hashes \
--with dev \
--extras poetry
safety check \
--file {envtmpdir}/requirements.txt \
--output text \
# https://github.com/pytest-dev/py/issues/287
--ignore 51457

View File

@ -21,7 +21,6 @@ at the module scope it is imported into function scope wherever Poetry component
moves import errors from load time to runtime which allows the plugin to be skipped if Poetry isn't moves import errors from load time to runtime which allows the plugin to be skipped if Poetry isn't
installed and/or a more helpful error be raised within the Tox framework. installed and/or a more helpful error be raised within the Tox framework.
""" """
import sys import sys
from tox_poetry_installer import exceptions from tox_poetry_installer import exceptions

View File

@ -5,7 +5,6 @@ in this module.
All constants should be type hinted. All constants should be type hinted.
""" """
from typing import Tuple from typing import Tuple
from tox_poetry_installer import __about__ from tox_poetry_installer import __about__

View File

@ -1,5 +1,4 @@
"""Helper functions for the :func:`tox_on_install` hook""" """Helper functions for the :func:`tox_on_install` hook"""
import collections import collections
import concurrent.futures import concurrent.futures
import contextlib import contextlib
@ -21,7 +20,6 @@ from tox_poetry_installer import constants
from tox_poetry_installer import exceptions from tox_poetry_installer import exceptions
from tox_poetry_installer import logger from tox_poetry_installer import logger
if typing.TYPE_CHECKING: if typing.TYPE_CHECKING:
from tox_poetry_installer import _poetry from tox_poetry_installer import _poetry

View File

@ -1,5 +1,4 @@
"""Add required env configuration options to the tox INI file""" """Add required env configuration options to the tox INI file"""
from typing import List from typing import List
from tox.config.sets import EnvConfigSet from tox.config.sets import EnvConfigSet

View File

@ -1,5 +1,4 @@
"""Add additional command line arguments to tox to configure plugin behavior""" """Add additional command line arguments to tox to configure plugin behavior"""
from tox.config.cli.parser import ToxParser from tox.config.cli.parser import ToxParser
from tox.plugin import impl from tox.plugin import impl

View File

@ -4,7 +4,6 @@ Loads the local Poetry environment and the corresponding lockfile then pulls the
specified by the Tox environment. Finally these dependencies are installed into the Tox specified by the Tox environment. Finally these dependencies are installed into the Tox
environment using the Poetry ``PipInstaller`` backend. environment using the Poetry ``PipInstaller`` backend.
""" """
from itertools import chain from itertools import chain
from tox.plugin import impl from tox.plugin import impl

View File

@ -4,7 +4,6 @@ Calling ``tox.reporter.something()`` and having to format a string with the pref
gets really old fast, but more importantly it also makes the flow of the main code gets really old fast, but more importantly it also makes the flow of the main code
more difficult to follow because of the added complexity. more difficult to follow because of the added complexity.
""" """
import logging import logging
from tox_poetry_installer import constants from tox_poetry_installer import constants