Re: code-quality Digest, Vol 120, Issue 1
do you know what this line does? ``` skip_install = true ``` On Mon, Feb 17, 2025 at 12:01 PM <code-quality-request@python.org> wrote:
Send code-quality mailing list submissions to code-quality@python.org
To subscribe or unsubscribe via the World Wide Web, visit https://mail.python.org/mailman3/lists/code-quality.python.org/ or, via email, send a message with subject or body 'help' to code-quality-request@python.org
You can reach the person managing the list at code-quality-owner@python.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of code-quality digest..."
Today's Topics:
1. Getting tox dependencies from pyproject.toml? (Skip Montanaro)
----------------------------------------------------------------------
Message: 1 Date: Mon, 17 Feb 2025 10:20:48 -0600 From: Skip Montanaro <skip.montanaro@gmail.com> Subject: [code-quality] Getting tox dependencies from pyproject.toml? To: code-quality@python.org Message-ID: <CANc-5Uxcb3Jjo6Uxo9izxBXpMiyuAwm4_ZkpP=vFvAi1Wztdqw@mail.gmail.com> Content-Type: multipart/alternative; boundary="000000000000ecdfd4062e58e964"
I have a small package with several dependencies. From pyproject.toml:
dependencies = [ "atpublic>=3.1", "matplotlib>=3.5.2", "numpy>=1.22", "pandas>=1.5.2", "python-dateutil>=2.8.2", "scipy>=1.15.1", "unum>=4.2.1", "xlrd>=2.0.1", "xlwt>=1.3.0", "openpyxl>=3.1.5", ]
I created a skeletal tox.ini file which allowed me to run my unit tests against several Python versions, as one does. Then I added a lint env:
env_list = py{310,311,312,313},lint
Unfortunately, the virtual environment constructed for the "lint" environment had none of my dependencies. (All the other envs are stable and have all run this package before, so have the necessary dependencies baked in.) To get pylint to shut up about import failures, I had to duplicate that dependency list:
[testenv:lint] description = run linters skip_install = true deps = atpublic>=3.1 matplotlib>=3.5.2 numpy>=1.22 openpyxl>=3.1.5 pandas>=1.5.2 pylint python-dateutil>=2.8.2 scipy>=1.15.1 unum>=4.2.1 xlrd>=2.0.1 xlwt>=1.3.0 commands = pylint csvprogs
Question: Is it possible to avoid this duplication, maybe by having tox stuff in pyproject.toml or at least have tox.ini get dependencies from that?
Thanks,
Skip
do you know what this line does?
``` skip_install = true ```
Sorry, I can't tell if this is a rhetorical question or not. On the off-chance you want an answer, I'll refer you to the tox documentation <https://tox.wiki/en/stable/config.html>: skip_install <https://tox.wiki/en/stable/config.html#skip_install> with default value of False 📢 added in 1.9 Skip installation of the package. This can be used when you need the virtualenv management but do not want to install the current package into that environment. This is as much as I know about it. Apparently it suppresses installation of the package being tested. Since I was skipping the package install, tox didn't know my dependencies (which are embedded in the wheel file), so I had to explicitly mention them. By allowing tox to install my package (skip_install = false), it also installed the package dependencies. Skip
participants (2)
-
Anthony Sottile -
Skip Montanaro