Description
openedon Jan 6, 2022
Bug description
Pylint does not have a src folder
Led me into problems developing and test at least from time to time.
Here an exmplaination stolen why this a good idea:
Why does PyScaffold ≥ 3 have a src
folder which holds the actual Python package?
This avoids quite many problems compared to the case when the actual Python package resides in the same folder as
your configuration and test files.
A nice blog post by Ionel gives a thorough explanation why this is so. In a nutshell, the most severe
problem comes from the fact that Python imports a package by first looking at the current working directory and then
into the PYTHONPATH
environment variable. If your current working directory is the root of your project directory
you are thus not testing the installation of your package but the local package directly. Eventually, this always
leads to huge confusion ("But the unit tests ran perfectly on my machine!").
Moreover, having a dedicated src
directory to store the package files, makes it easy to comply with recent standards
in the Python community (for example PEP 420
).
Please notice that PyScaffold assumes all the files inside src
are meant to be part of the package.
Configuration
No response
Command used
cd <other pylint dev folder> && pytest
Pylint output
some strange stuff, as pytests test the pylint in the other folder while I have also pylint installed as -e from the other -venv
Expected behavior
no problem because src folder prevents them
Activity