Hi Skip,

One option would be to allow tox to install the package in the lint env with 
`skip_install = false` (which is the default behaviour, so the skip_install 
line can just be deleted). Then the "deps =" for the lint env can go back to 
just pylint. It's not the most efficient, but saves on config.

I'm not so good at stuffing tox config inside pyproject.toml - but maybe 
someone else has a suggestion doing that.

Cheers,

James






On Mon, 17 Feb 2025, at 4:20 PM, Skip Montanaro via code-quality wrote:
> 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
> 
> _______________________________________________
> code-quality mailing list -- code-quality@python.org
> To unsubscribe send an email to code-quality-le...@python.org
> https://mail.python.org/mailman3/lists/code-quality.python.org/
> Member address: m...@jamescooke.info
> 
_______________________________________________
code-quality mailing list -- code-quality@python.org
To unsubscribe send an email to code-quality-le...@python.org
https://mail.python.org/mailman3/lists/code-quality.python.org/
Member address: arch...@mail-archive.com

Reply via email to