From fae9f5843d3384c7f11dae7f351456aeb5a4fe9f Mon Sep 17 00:00:00 2001 From: xxyzz Date: Sun, 25 Sep 2022 13:26:17 +0800 Subject: [PATCH] Add extras packages to `tool.poetry.dependencies` in pyproject.toml Extras dependencies need to be added as optional dependencies, otherwise they won't be installed. Document: https://python-poetry.org/docs/pyproject/#extras Poetry GitHub issue: https://github.com/python-poetry/poetry/issues/5604 --- poetry.lock | 54 +++++++++++++++++++++++++++++++++----------------- pyproject.toml | 8 ++++++-- 2 files changed, 42 insertions(+), 20 deletions(-) diff --git a/poetry.lock b/poetry.lock index 08d5e2e..9951389 100644 --- a/poetry.lock +++ b/poetry.lock @@ -23,10 +23,10 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [package.extras] -dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"] -docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] -tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] -tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"] +dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "sphinx", "sphinx-notfound-page", "zope.interface"] +docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"] +tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "zope.interface"] +tests_no_zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six"] [[package]] name = "backcall" @@ -125,8 +125,8 @@ typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} zipp = ">=0.5" [package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=4.6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pep517", "pyfakefs", "flufl.flake8", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pep517", "pyfakefs", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"] [[package]] name = "iniconfig" @@ -140,7 +140,7 @@ python-versions = "*" name = "ipadic" version = "1.0.0" description = "IPAdic packaged for Python" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -163,6 +163,7 @@ pexpect = {version = ">4.3", markers = "sys_platform != \"win32\""} pickleshare = "*" prompt-toolkit = ">=2.0.0,<3.0.0 || >3.0.0,<3.0.1 || >3.0.1,<3.1.0" pygments = "*" +setuptools = ">=18.5" traitlets = ">=4.2" [package.extras] @@ -171,10 +172,10 @@ doc = ["Sphinx (>=1.3)"] kernel = ["ipykernel"] nbconvert = ["nbconvert"] nbformat = ["nbformat"] -notebook = ["notebook", "ipywidgets"] +notebook = ["ipywidgets", "notebook"] parallel = ["ipyparallel"] qtconsole = ["qtconsole"] -test = ["nose (>=0.10.1)", "requests", "testpath", "pygments", "nbformat", "ipykernel", "numpy (>=1.17)"] +test = ["ipykernel", "nbformat", "nose (>=0.10.1)", "numpy (>=1.17)", "pygments", "requests", "testpath"] [[package]] name = "jedi" @@ -195,7 +196,7 @@ testing = ["Django (<3.1)", "colorama", "docopt", "pytest (<7.0.0)"] name = "jieba" version = "0.42.1" description = "Chinese Words Segmentation Utilities" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -233,7 +234,7 @@ python-versions = "*" name = "mecab-ko-dic" version = "1.0.0" description = "mecab-ko-dic packaged for Python" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -241,7 +242,7 @@ python-versions = "*" name = "mecab-python3" version = "1.0.5" description = "Python wrapper for the MeCab morphological analyzer for Japanese" -category = "dev" +category = "main" optional = false python-versions = "*" @@ -452,6 +453,19 @@ category = "main" optional = false python-versions = ">=3.6" +[[package]] +name = "setuptools" +version = "65.4.0" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "mock", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "toml" version = "0.10.2" @@ -520,18 +534,18 @@ optional = false python-versions = ">=3.7" [package.extras] -docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"] -testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"] [extras] -cjk = [] -jieba = [] -mecab = [] +cjk = ["mecab-python3", "ipadic", "mecab-ko-dic", "jieba"] +jieba = ["jieba"] +mecab = ["mecab-python3", "ipadic", "mecab-ko-dic"] [metadata] lock-version = "1.1" python-versions = "^3.7" -content-hash = "1ad2ba8219af7a42601d403471e402d46abfcfce4e552c97c7bee1020514b535" +content-hash = "8d9f5deaaf64be943af75731743c59ab06621fe0039fa6be73386534b0798547" [metadata.files] appnope = [ @@ -853,6 +867,10 @@ regex = [ {file = "regex-2022.3.15-cp39-cp39-win_amd64.whl", hash = "sha256:c5adc854764732dbd95a713f2e6c3e914e17f2ccdc331b9ecb777484c31f73b6"}, {file = "regex-2022.3.15.tar.gz", hash = "sha256:0a7b75cc7bb4cc0334380053e4671c560e31272c9d2d5a6c4b8e9ae2c9bd0f82"}, ] +setuptools = [ + {file = "setuptools-65.4.0-py3-none-any.whl", hash = "sha256:c2d2709550f15aab6c9110196ea312f468f41cd546bceb24127a1be6fdcaeeb1"}, + {file = "setuptools-65.4.0.tar.gz", hash = "sha256:a8f6e213b4b0661f590ccf40de95d28a177cd747d098624ad3f69c40287297e9"}, +] toml = [ {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, diff --git a/pyproject.toml b/pyproject.toml index 1e925ff..fcadc89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,10 @@ msgpack = ">= 1.0" langcodes = ">= 3.0" regex = ">= 2020.04.04" ftfy = ">= 6.1" +mecab-python3 = {version = "^1.0.5", optional = true} +ipadic = {version = "^1.0.0", optional = true} +mecab-ko-dic = {version = "^1.0.0", optional = true} +jieba = {version = ">=0.42", optional = true} [tool.poetry.dev-dependencies] pytest = "^6.2.5" @@ -27,9 +31,9 @@ types-setuptools = "^57.4.9" mypy = "^0.931" [tool.poetry.extras] -cjk = ["mecab-python3", "ipadic", "mecab-ko-dic", "jieba >= 0.42"] +cjk = ["mecab-python3", "ipadic", "mecab-ko-dic", "jieba"] mecab = ["mecab-python3", "ipadic", "mecab-ko-dic"] -jieba = ["jieba >= 0.42"] +jieba = ["jieba"] [build-system] requires = ["poetry-core>=1.0.0"]