Вот мой полный файл Toml < /p>
Код: Выделить всё
[tool.poetry]
name = "projectname"
version = "0.1.0"
description = "my package"
authors = ["Name Name "]
readme = "README.md"
packages = [{ include = "mypackage", from = "src" }]
[tool.poetry.dependencies]
python = "^3.10"
beautifulsoup4 = "^4.13.3"
rapidfuzz = "^3.12.2"
requests = "^2.32.3"
[tool.poetry.group.dev.dependencies]
pytest = "^8.3.5"
pytest-benchmark = "*"
pytest-cov = "*"
ruff = "*"
pyright = "*"
pre-commit = "*"
tox = "^4.24.2"
[tool.poetry.scripts]
myscript = "mypackage.search_offers:main"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["tests"]
[tool.ruff]
line-length = 100 # Matches `black`
target-version = "py310" # Python version
[tool.ruff.lint]
extend-select = ["E", "F", "W", "I"] # Enable linting + import sorting
fixable = ["ALL"] # Auto-fix everything
[tool.ruff.format]
quote-style = "double" # Optional: use double quotes
[tool.pyright]
include = ["src", "tests"]
pythonVersion = "3.10"
typeCheckingMode = "strict"
reportMissingTypeStubs = false
[tool.tox]
env_list = ["py310", "py311", "lint", "type"]
[tool.tox.env.py310]
description = "Run tests with pytest on Python 3.10"
package = "editable" # ✅ Install local package in editable mode (like `pip install -e .`)
wheel_build_env = "build"
deps = ["pytest", "pytest-cov", "pytest-benchmark"]
commands = [["pytest", "--cov=src", "--cov-report=xml"]]
[tool.tox.env.py311]
description = "Run tests with pytest on Python 3.11"
package = "editable"
wheel_build_env = "build"
deps = ["pytest", "pytest-cov", "pytest-benchmark"]
commands = [["pytest", "--cov=src", "--cov-report=xml"]]
[tool.tox.env.lint]
description = "Run Ruff for linting"
skip_install = true
deps = ["ruff"]
commands = ["ruff check ."]
[tool.tox.env.type]
description = "Run Pyright for type checking"
skip_install = true
deps = ["pyright"]
commands = ["pyright"]
Запуск tox -e py311 или поэзия запустить tox -e py311 с ошибкой
poetry -ex -e py311 с ошибкой
или поэзия.py311: skipped because could not find python interpreter with spec(s): py311
py311: SKIP (0.01 seconds)
evaluation failed

< /code>
Вот что я сделал:
Я установил pyenv < /p>
brew install pyenv
< /code>
Затем я установил Python 3.11 < /p>
pyenv install 3.11
< /code>
Следующая документация Pyenv ReadMe.md относительно использования с Tox I Установка новой версии как Global System < /p>
pyenv global system 3.11.11
< /code>
Вот выходы некоторых команд: < /p>
> python3.11
zsh: command not found: python3.11
> pyenv which python3.11
/Users/myname/.pyenv/versions/3.11.11/bin/python3.11
> pyenv versions
system
* 3.11.11 (set by /Users/myname/Documents/myproject/.python-version)
> python --version
Python 3.10.10
< /code>
Chatgpt говорит мне добавить эту строку в раздел [tool.tox.env.py311] в Toml. < /p>
basepython = ["/Users/myname/.pyenv/versions/3.11.11/bin/python3.11"] #
< /code>
Это решает проблему, но мне не нравится это решение, я бы предпочел что -то, что не полагается на ручной вклад пути Python. Я также намерен добавить это в качестве действия GitHub, поэтому мне нужно что -то, что не полагается на настройки моей машины < /p>
, может ли кто -нибудь сказать мне, если я что -то испортил? Я неправильно понял, как использовать эти инструменты?
Я пытаюсь выучить токс и поэзию, так что это все еще очень новое для меня < /p>
Большое спасибо < /p>
Подробнее здесь: https://stackoverflow.com/questions/794 ... ry-project