Pytest: Remove use of attrs

Created on 10 Apr 2018  路  12Comments  路  Source: pytest-dev/pytest

So I'm having an issue with this https://github.com/pytest-dev/pytest/commit/07b2b18a01a3ba12757a4eb1c0e082922f5299e5

My project is stuck in a little dependency hell caused by attrs and it's lack of stability. One release removes some stuff, one month later another release adds some other stuff and so on. Some package depends on removed behavior (like accessing attributes via class), pytest depends on new features (converters or something).

Can we revert 07b2b18a01a3ba12757a4eb1c0e082922f5299e5 - I really don't see what it improves.

question

Most helpful comment

So now I ate something and I'm feeling better. I think at the very least pytest should have bold note in the readme: "don't upgrade pytest on an empty stomach".

All 12 comments

GitMate.io thinks possibly related issues are https://github.com/pytest-dev/pytest/issues/3080 (Remove pytest_namespace), https://github.com/pytest-dev/pytest/issues/1229 (Remove plugins_index from docs?), https://github.com/pytest-dev/pytest/issues/3083 (Remove metafunc.addcall), https://github.com/pytest-dev/pytest/issues/3079 (Remove yield tests), and https://github.com/pytest-dev/pytest/issues/3379 (remove markinfo and their apis).

I think the plan is to use attrs more over time.

So now I ate something and I'm feeling better. I think at the very least pytest should have bold note in the readme: "don't upgrade pytest on an empty stomach".

well - attrs does away with bad things over time - which is infinitely better than trying to keep broken things intact while desperately trying to layer less broken things on top

for stability control we might want to do sometihng about how it is imported and used tho -> but NEVER AGAIN vendoring as is

It is unfortunate that the API has not been as solid as we expected, the problem is that we are using more and more attrs (specially in features) so removing it is not something trivial to do at this point.

API instability and dependency issues with other libraries is something that we should watch closely and perhaps decide to take some action in the future if this becomes a bigger problem, but I think it is early to say that attrs API is unstable and not suitable to be used in an upstream tool like pytest.

Having said all this, @ionelmc can you describe which versions are in conflict and if you solved it somehow, how you did it?

@RonnyPfannschmidt , @nicoddemus After looking into attrs, I believe it is good to use in pytest because its use is for only one aspect, class declaration. Although it "obscures" explicit definitions of classes, I believe it makes code more readable, because if a dunder (__method__) is overridden it shows that it has been overridden for a reason, and isn't boilerplate.

Although I am not anywhere as deep in the code as either of you are, I recognize the value attrs brings and just wanted to voice what I thought of it.

@hynek would you like to comment as well?

I鈥檓 not sure what to say. Every dependency inevitably leads to conflicts in Python. We鈥檙e not loose with breaking compatibility and if possible, leave a year between deprecation and actual break.

Which totally happened in the mentioned case of accessing Attributes on classes.

Only suggestion I have that pytest probably should delay implementing changes like the convert/converter thing until last minute, so people have the full deprecation cycle to fix their software?

@hynek as always this would be far less troublesome if python didn't have such a limiting module system, i'd like to keep attrs entirely as a implementation detail, but python forces to leak it ^^

FWIW in qutebrowser, I try to keep compatibility with e.g. Debian stable's system-installed packages, which means attrs 16.3 (but I still want to support the newest version, of course).

There I just use whatever subset of attr features I can without getting into trouble, and find some other solution for the rest (for pytest, that'd probably mean not using converters). It still makes my life a lot easier and there's little I'm missing. Usually it's possible to do (almost) the same thing differently, like in https://github.com/qutebrowser/qutebrowser/commit/9d360f80cfe1cc0590736433a2e54c12dac4d190

To be clear: you can use converters. You just have to live with deprecation warnings. Maybe silence them specifically?

I believe we can close this?

Was this page helpful?
0 / 5 - 0 ratings