I would think there are certain situations where a person might be compelled to lie, such as if you have a security clearance, have signed an NDA, or are acting as an informant. That is, a person may have to lie to prevent divulging classified or secret information through implication.
EDIT: One situation where the government cannot compel you to lie is if it violates your fifth amendment rights (self incrimination).
those are all things you actively agreed to, in advance, in exchange for some sort of consideration (job, not going to jail for illegal things you've already done, etc)
I have never heard any legally competent source say that the U.S. government cannot (with warrant or whatever) compel you to lie. I'm pretty sure that, in the case of a canary, they can.
That may be the case but if the cost of testing it is 5 years in jail while the case works it's way through the courts, few people will be willing to rely on it.
The US government is not compelling speech, it's compelling PyPI to accurately reveal to the US government the contents of past speech that PyPI has access to. Compelling disclosure of certain kinds of data, when it's known, is a normal part of legal actions in the US and probably elsewhere.
You seem to be describing what these subpoenas have requested. This thread is about canaries, and whether the government could compel a company to keep one updated against their will.