-
Notifications
You must be signed in to change notification settings - Fork 144
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
Drop pint higher-bound #2741
Drop pint higher-bound #2741
Conversation
In principle this should be handled by My other concern with that approach is that it is gated by rpm build, which I wanted to avoid for debugging and using Other approaches could be:
|
Hi @LecrisUT, what is the goal here? |
To close #2740, and address https://src.fedoraproject.org/rpms/python-pint/pull-request/10 Stuck at how to do the testing though. |
Did you run unit tests with newer Pint installed? I had bad experience because of chanes Pint made, failing imports and changed internals. Would you mind blocking this on pyright coverage of |
Not sure what you mean by blocking here. I have for now disabled the generic tpye-checking on pint which did not seem to work anymore 12.
Not yet, I'll try to run them now. Didn't cross my mind that 🤔 Couldn't find any plans that I could run that includes $ tmt -c trigger=commit -vv run -a provision -h local test -n /tests/provision/hardware At least Footnotes |
Tried to do locally the tests: $ cd tests/provision/hardware/data
$ tmt plans show /plan/local
warn: /plan/local:provision - {'hardware': {'boot': {'method': 'bios'}, 'compatible': {'distro': ['rhel-7', 'rhel-8']}, 'cpu': {'sockets': '<= 1', 'cores': 2, 'threads': '>= 8', 'cores-per-socket': '= 2', 'threads-per-core': '== 4', 'processors': '> 8', 'model': 62, 'model-name': '!~ Haswell', 'family': '< 6', 'family-name': 'Skylake'}, 'disk': [{'size': '40 GiB'}, {'size': '>= 120 GiB'}], 'hostname': '~ .*.foo.redhat.com', 'memory': '8 GiB', 'network': [{'type': 'eth'}, {'type': 'eth'}], 'tpm': {'version': '2.0'}, 'virtualization': {'is-supported': True, 'is-virtualized': False, 'hypervisor': '~ xen'}}, 'how': 'local'} is not valid under any of the given schemas
/plan/local But the same issue is when I use either Edit: nvm, it works on $ tmt -vv plans show /plan/artemis
/plan/artemis
discover
provision
how artemis
api-version 0.0.69
user root
become false
provision-timeout 600
priority-group default-priority
keyname default
key
api-url http://127.0.0.1:8001
user-data {}
kickstart {}
provision-tick 60
api-retries 10
ssh-option
api-timeout 10
skip-prepare-verify-ssh false
api-retry-backoff-factor 1
log-type
arch x86_64
hardware boot:
method: bios
compatible:
distro:
- rhel-7
- rhel-8
cpu:
sockets: <= 1
cores: 2
threads: '>= 8'
cores-per-socket: = 2
threads-per-core: == 4
processors: '> 8'
model: 62
model-name: '!~ Haswell'
family: < 6
family-name: Skylake
disk:
- size: 40 GiB
- size: '>= 120 GiB'
hostname: ~ .*.foo.redhat.com
memory: 8 GiB
network:
- type: eth
- type: eth
tpm:
version: '2.0'
virtualization:
is-supported: true
is-virtualized: false
hypervisor: ~ xen
prepare
how shell
script
where
execute
how tmt
no-progress-bar false
script
where
exit-first false
interactive false
duration 1h
report
how display
display-guest auto
finish
how shell
script
where
enabled true
sources /home/lecris/PycharmProjects/tmt/tests/provision/hardware/data/main.fmf
fmf-id url: https://github.com/LecrisUT/tmt.git
ref: fix/2740
path: /tests/provision/hardware/data
name: /plan/artemis
web https://github.com/LecrisUT/tmt/tree/fix/2740/tests/provision/hardware/data/main.fmf |
I see, thanks!
I'm guessing marking this PR as being blocked by pyright tmt.hardware coverage PR. |
Yeah, but that's demonstrating the problem right away :) When I drop the inner type, and run mypy with Pint 0.19.2, which is a perfectly valid version, mypy starts reporting the following:
At least in some versions of Pint, I don't mind allowing newer Pint, I would just like to be sure
I tried to play with something else, but when executed from |
We can conditionally add the Fortunately, this does not seem to affect the actual code behavior yet.
Oh, now I see, there were the |
Lol, I like it how
Interesting though, |
That would make sense, yes.
I'd like to avoid copying implementations if at least possible, therefore I for one would prefer the version-dependant type definitions, conditional imports,
Anyway, flushed by git stash into #2742, that enables pyright. #2557 should add unit tests against system packages, which I consider even stronger check, that should prevent the most of issues from sneaking in - if our code is broken with python-pint from EPEL9, this test should reveal it. |
I'll rebase when #2742, and if all goes well, we can delay this for after #2557 to make sure we don't have any surprises. Seems neither if version.parse(importlib.metadata.version("pint")) >= version.parse("0.20"):
Size: TypeAlias = Quantity
else:
Size: TypeAlias = 'Quantity[int]' |
Hm, type aliases cannot be declared conditionally. Type checkers do have some basic support for testing Python versions, but a test like this is way too runtime-ish for their taste :/ This sucks, and I would hate to use |
To do this cleanly, no it's rather hard. At the same time, how much do we gain by doing type-checking with different versions of pint? For this one, we want to make sure it is a pint-like These are mostly development checks to make sure we don't shoot ourselves in the foot, so I think it's ok for now to relax these constraints to |
A lot, I would say, because mypy and pyright are not just about type checking, they also detect attributes that are not defined, for example. Most tmt users depend on tmt that's packaged and shipped in RPMs. Relaxing bounds on dependencies can easily lead to us, developers, using new functionality that's not available to end users. Pint 0.24 may add the
Yeah, but that's just one possible way how we could harm ourselves. This starts to suddenly feel more and more chilling and dangerous :) Frankly, I don't understand why we don't have upper bounds on other requirements, or why don't we run mypy/pyright against system packages as a dedicated test in I mean, thinking about what are we trying here, I'd say we really should extend the coverage into this area first, and I have no idea how could I missed this hole, why don't we have something like this already - yeah, Pint 0.99 in |
Fair point, but if that is the case, But going back to the failures encountered here, it is more mysterious the more we look into it: if TYPE_CHECKING:
from .facets.plain import PlainQuantity as Quantity
...
class PlainQuantity(Generic[MagnitudeT], PrettyIPython, SharedRegistryObject): The previous syntax should never have failed 🤔 |
Yeah, that's what the last two paragraphs in my previous comment were about - I think we need this to happen Soon before it bites us after a random release :)
I'll check it out after lunch, and try to understand it better. I recall seeing these new classes pop up, but that's pretty much all. |
+1 to have mypy/pyright in testing farm. As for upper bounds everywhere - We could add it but we will need to update it quite often to not block adoption of newer versions into fedora-rawhide. So I'm not sure what the benefit will be. Could we add some testing-farm installing from pipy? Maybe a weekly/nighly just to check what are the latest pypi versions and how we work with them? |
Let's wait for #2557 and figure out a design after that. The current plans are getting quite a bit messy imo, and they should be divided in more matrix-like approach, e.g. One approach I was considering for tackling that is to use jinja templating to generate the Another approach would be to use |
I read the whole discussion and also appear this is a smoking barrel that can easily blow up if we do not start runinng mypy/pyright in testing farm. Something maybe to remember for the future, how it can hide problems |
Probably not needed most of the time. There might be buggy versions or incompatible versions we'd like to avoid, ( |
No idea why pre-commit decided to fail in this PR, maybe it runs on different files in a commit vs merge. Anyway patched those up in this PR |
Those unrelated changes are really ugly... Why would they appear here and now when this morning's pre-commit output complained about nothing to me, no idea. Your patch does not even touch those files, meh. |
I'd make a patch fixing just those, I wanted to update pre-commit checks anyway, let's fix those there, then we can rebase your PR and keep the diff simpler. |
👍 Btw, regarding 1.35 milestone, since this is blocking xarray upgrade this might get patched in rawhide as soon as 1.34 is released. Let's at least get the tests running (needs |
FTR, here's the update of pre-commit checks, it does cover changes seen in this PR plus some more: #3023 |
/packit build |
I don't see
Oh, maybe touching |
tests/unit/main.fmf
Outdated
- when: initiator is not defined or distro == fedora-39 | ||
because: Enable locally or in CI on Fedora 39 | ||
- when: initiator is not defined or distro == fedora-40 | ||
because: Enable locally or in CI on Fedora 40 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greaat... We need a better approach for this.
The test is behind /plans/features/core
which was gated by:
Lines 43 to 45 in 87f2fe0
targets: | |
- fedora-latest-stable | |
- epel-9 |
That's weird, this test should be there, in the |
Ah right, I've only checked F40, F39 is indeed 👍 |
d4e8391
to
7c6bc7d
Compare
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
/packit build |
Closes teemtee#2740 Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Pull Request Checklist
Closes #2740