-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Linting build not working #327
Comments
Prospector tries to do |
Hi @LourensVeen , thanks for looking into this. I added a line to run that:
And I see no error. Do you think this error is related to something else that is not the installation of pyroma? |
Ah no, this should do the trick, and it does work. So that's weird. The error seems to come from https://github.com/PyCQA/prospector/blob/v1.8.3/prospector/tools/__init__.py, which tries to import https://github.com/PyCQA/prospector/blob/v1.8.3/prospector/tools/pyroma/__init__.py, which runs that statement and presumably raises an ImportError, except it seems to work if you run it separately. What does |
Seems like there is no error:
|
Ah, that's weird. Maybe try from the other side with |
DIANNA had this issue as well, perhaps it is the same: dianna-ai/dianna#423 |
Interesting. It seems that the Prospector issue linked from the DIANNA issue only fixes the problem that pyroma doesn't install automatically, but user volans also mentions that it doesn't run correctly, and that's what we're seeing here as well. So I did some more investigating and found the problem, only to discover that it was found by someone else four days ago, and that a fix had been in the repo for an hour already! So it should work again from 1.8.4 onwards. Meanwhile, the solution is to limit the prospector version to <1.8.0; I cannot reproduce this on 1.7.7 at least. |
I tried with version 1.7.7 and now I get a different error.
So I ran it with
This seems to be deep inside prospector right? Any ideas? |
Haha, van de regen in de drup :). Seems like this has been fixed in prospector-dev/prospector#530, so if you upgrade to Prospector 1.8.0 or later, then it should work again! |
(prospector-dev/prospector#539 says that downgrading pylint to 2.15.6 also works.) Maybe we should just get rid of prospector? I just call flake8 and sometimes pydocstyle from tox and call it a day... On the other hand, it seems that this 1.8 release is just botched, so maybe in the coming weeks they'll fix the teething issues and it'll all be fine again. |
@LourensVeen and @egpbos , Following up on Lourens proposal. If I were to replace prospector with flake8 how should I go about it?
to
to
to
to
Do we need to replace it with an equivalent for flake8? Something else is needed? |
I think I would be against replacing |
Note btw that there was a new prospector release 1.8.4 yesterday. The issues that were fixed for 1.8.4 listed here include both a pylint failure bug and a pyroma include thingy... Maybe good to try out. |
I'm trying it out in the DIANNA repo right now, see the mention above. |
The linter installs and runs without issues there, so try using 1.8.4 :) |
@egpbos it is working now but I get a similar error to the one in DIANNA regarding imports. it gives an error on importing pytest. Pytest is installed and if I run the python file it complains about, there is no error with importing pytest. This is from DIANNA:
|
@LourensVeen and @egpbos I have it working now on git (with v1.8.4). For some reason it gives the import error on my laptop (macOS). Thanks a lot for your help! |
Hm very weird! I hope the import error stays away then or that it can be fixed from the DIANNA side. Let's wait and see. |
Yay! Yes, since both issues were fixed already in prospector git, it makes sense that they got included in 1.8.4. Looking at the change log it looks like 1.8.0 was released in a quite broken state, and there's been a flurry of new releases with fixes since. That's good at least, but maybe it needs a better test suite or something... |
I have a theoretical question. Does it make sense to always force a specific version of dependencies? Or at least use <=. I say this because something may work fine on the latest version in 2021 and then in 2022 someone else uses the code and it breaks in all kinds of weird ways. In the end it is a new version of one dependency that was broken or incompatible? Just like in this case. If every year or six months we look into updating the dependencies then we know the issue is with dependencies. If a power user wants/needs to use the cutting edge version of a dependency, then they are on their own (but they also know what changed). |
@apalha that's the problem semantic versioning is supposed to solve. Major version number increases (can be / are allowed to be) incompatible ; minor version number increases (should be) backwards compatible. |
@jiskattema yes, semantic versioning informs the developper. A user that uses a code does not know if the code was written for version 1.x.y or for version 2.z.w. And at installation time there is no control over that, unless we force <2.0.0. Still, if working version 1.x.y was updated to version 1.x+1.0 there is always the possibility of introducing a bug, which was the case here. This then makes the code that requires that dependency unusable until the cause of the issue is found. I must admit I am very conservative regarding using latest releases by default, unless there are specific reasons/requirements to do so. Especially when the required ecosystem becomes more complex the possibility of unexpected incompatibilities grows exponentially. |
If you have a couple of hours, take a look at this ;) https://iscinumpy.dev/post/bound-version-constraints/ Tl;dr: https://iscinumpy.dev/post/bound-version-constraints/#tldr We also discussed it (incompletely) in Teams at some point, you can probably find it if you search for the link. |
It also has a tl;dr to the tl;dr:
I would agree this is a good default policy, except I would make it even shorter:
You can floor if users complain or if you anticipate your package's use on old systems, but in typical usecases (installing things in fresh environments on recent Python versions) you don't really need to because you'll get all the latest versions by default. |
Having said all that, you are not alone in your "conservative" view (see the Teams discussion :D) and it can be very valid in certain cases (see the article), but just be aware that there are good arguments for "liberal" dependency versioning and that this in my experience is also what a large part of the Python community practices. |
I scanned the article. A strong argument is interaction with other libraries, which you do not control. You need library A with R.A requirements, but then you need B with R.B requirements, with strict (conservative) versions the compatible intersection can (and will) be zero. |
I'm not super-strict with this, as it's all broken anyway, but I can see both sides of the equation. Numpy for example releases fairly frequently and doesn't guarantee a lot of future stability, so setting an upper bound that is guaranteed to work means you need to re-test and re-release often. Wait too long and your software won't install anymore, even though it'll probably still work. That's been an issue with MUSCLE3. For YAtiML, I heavily depend on ruamel.yaml and that is a mess, active development, no defined API, no compatibility guarantees, and broken releases fairly regularly. I have a script that tests against all releases of the last couple of years, and then put in a version constraint with lower and upper bounds and excludes for known-broken versions. I've had issues with people installing some other software that required a recent version that I hadn't tested against and getting version conflicts, but I don't dare to release the constraints either. The real solution is to finally invent NAML, but well, when I find a round tuit. Otherwise, I'm also often sloppy and don't set a version constraint at all. If the dependency is some random Python package that some dude (f/m) made years ago and hasn't touched since, then it'll continue to work anyway... |
The Build workflow fails in this line:
python-template/{{cookiecutter.directory_name}}/.github/workflows/build.yml
Line 62 in 807f751
The error is the following:
I have forced installing prospector with pyroma, adding a line
python3 -m pip install prospector[with_pyroma]
, forced the reinstall with--ignore-installed
, and confirmed that it is installing it (seems so):I still get the error. Did someone face the same problem or does anyone know what could be the issue?
Thanks!
The text was updated successfully, but these errors were encountered: