-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Deprecate test command #1684
Comments
The pytest-runner project does subclass the test command, and there are projects actively depending on it. I do agree we want to deprecate each, and probably both together. |
A bit off-topic, but do we have an overarching issue for deprecating/replacing the various incantations of (I can create these issues if they don't already exist) |
Not to my knowledge. |
Is there, really? The feeedback there is basically that |
This is a great way to kill sdists. (why have sdists if they have the same contents as wheels) How quickly the lesson of sourceforge.net has been forgotten. Or more recently Oracle changing the Term of Use of the Java downloads. IMO setuptools should be moving in the opposite direction, automatically including in sdists the test modules found using Anyways, unless setuptools also kills its plugin mechanism, someone will recreate the |
Let me see if I can clarify/illustrate. There are two main concerns of
Tox happens to do both of these in a user-friendly, declarative way, which is what makes it a recommended replacement. The user-experience of "run tox" is comparable to "run setup.py test".
Users are welcome to seek out other solutions. I wrote pip-run as one such attempt. It has a different behavior in that it always installs dependencies, so doesn't have the second-run speed improvements seen with setup.py test.
You're welcome to consider that. The biggest issue with
I'm not sure I follow. Can you elaborate on what the risks are?
I don't think you want to bundle any dependencies, even those for tests, for the same reasons as you don't want to bundle dependencies (you don't want to have to re-release your sdists every time a dependency updates). You want a lightweight, declarative means to declare dependencies. If bundled dependencies are valuable, a higher-level tool should build on the fundamental building blocks (independent packages) to produce and publish those bundles (similar to how Dockerhub works to host materialized environments). |
To be clear, this would change nothing about the distinction between sdists and wheels. I personally still recommend that you include your test code in your sdist, but not in the wheel. I also recommend that your
|
The reason to include tests in sdists, or even create sdists, becomes less obvious if the existing declarative syntax to describe them causes a deprecation warning. This will obviously mean packages with existing working metadata which describes their tests to sdist recipients will need to remove that metadata to be compatible with the latest setuptools. And the latest setuptools wont run the tests any more ... ? So again, why would those package maintainers bother with including tests in the sdist. Add to that there are members of PyPA who were already pushing projects to not include tests in sdists (because GitHub!), who will use this deprecation as additional justification for being more vocal and aggressive in their stance. These are not direct outcomes of this issue. However, they are fairly predictable side-effects.
Great, but you are not the typical package maintainer. Unfortunately most sdists these days are not testable, usually missing test configuration or test data, until someone from a distro tries to get the sdist working, and then has to try to convince the package maintainer because the Python Packaging Guide says almost nothing about tests. Rather than trying to use @pypa resources and products to address that growing problem, it seems the developers are washing their hands of the problem, and write so many conflicting PEPs that replace each other before a significant segment of the user base has adopted the previous one usually because the implementations were all only partial completed before the authors started writing a different PEP. Compare with the Perl ecosystem, where running the tests is an automatic default part of the package installation experience, and buildbots can (and do!) run the tests of almost every package because they all use consistent metadata for finding and running the tests - packages unmodified for 10 years still build. Tox manages creating virtualenvs and running python(OS-agnostic) commands in them. It does not declaratively describe the test modules nor the test runner (I dont consider the |
This comment has been minimized.
This comment has been minimized.
If you are going to drastically reduce the
Likewise, if the real reason to deprecate it is that for all practical purposes, it has long been broken (which is true), and you have no desire to fix it, stating that openly is going to remove a whole lot of misunderstanding. A fix would be to delegate "superseded" stuff to whatever it was superseded by -- to
How would I get
Perl is much less scalable than Python and a a result, CPAN modules tend to be very small in comparison. I can't name a single Perl module whose tests consume a few gigabytes and take a few hours to run, making it impractical to run them as a part of every installation. |
I don't think we've ever tried to disguise this. For several years now we have been actively warning people not to invoke
Yes, we fully intend to remove |
Could you reference some overarching issue on this initiative in the top post then? That would work much better as justification than "some agreement" in some close-circle discussion.
Raising a warning only if it's invoked via public interface should address that. |
I am not suggesting that Python packages should run tests by default when installing packages (, or that anyone should use Perl). Sure, PyPI hold entries for much larger codebases than are typically in CPAN modules. Large Perl codebases are often not in CPAN at all, and while there are noble attempts like PDL and BioPerl, most people working on large datasets have moved from Perl to R or Python, so there is more Python development occurring now when data sizes considered almost impossible 10 years ago are common place now. fwiw, R has tests also occurring during installation, and CRAN has similar buildbots, and there are some large R testsuites - not sure if there are any as big as opencv . So it is likely more useful to contrast with R instead of Perl. It would be nice if there was a new "standard" way to discover tests for any Python packages before setuptools deprecates the existing mechanism that packages are exposing that metadata. Deprecation in software engineering usually means there is a documented replacement which is (roughly) fit for purpose. |
The problem that I think most people in this thread are having is that there currently is no standard way to execute tests in Python. To the extent that To the extent that we could fix the problems with In any case, pretending that |
Failing that,
It works very well for lots of packages. It doesnt work well for all packages, of course, but that isnt reason to break it for all packages before there is a good replacement. setuptools should keep supporting its existing user-base, keep them working correctly, with all of the features they rely on. With PEP 517/8, new build systems can flourish. The goal should be for setuptools to be deprecating itself, and the deprecation notice provide a list of all high quality replacement PEP 517/8 build systems which have implemented drop-in solutions for the many varied types of projects which setuptools has supported for the last decade or more. That would be in the spirit of PEP 517, and would avoid setuptools existing near-monopoly implicitly preventing other build systems from being used and supported. |
status quo is setuptools maintaining legacy things with a really thinly stretched set of maintainers, all while nobody actually steps up to make things better from my pov a "working" solution is the main impediment for having someone step up and do a better/good solution |
Any volunteers? |
This is also something that we considered, but at the end of the day I think it would be much better to just deprecate these functions because we want to train people to use the right tool for the job, and invoking If we continue supporting these things instead of just warning and eventually erroring out with a message that tells you about the migration path, people will continue with the erroneous belief that executing |
This replaces `tests_require` with a pattern that seems to have popped up since pypa/setuptools#931 and pypa/setuptools#1684. It allows test dependencies to be installed by adding `[test]` to the end of the package name.
This replaces `tests_require` with a pattern that seems to have popped up since pypa/setuptools#931 and pypa/setuptools#1684. It allows test dependencies to be installed by adding `[test]` to the end of the package name.
This replaces `tests_require` with a pattern that seems to have popped up since pypa/setuptools#931 and pypa/setuptools#1684. It allows test dependencies to be installed by adding `[test]` to the end of the package name.
This replaces `tests_require` with a pattern that seems to have popped up since pypa/setuptools#931 and pypa/setuptools#1684. It allows test dependencies to be installed by adding `[test]` to the end of the package name.
setuptools has [deprecated] the test command for the past five years and recently removed it. This caused [quite a stir] since many people's build broke. Our build of [pywb] failed because surt is still using setuptools.test. I thought perhaps this would be a good time to removing that dependency and given adoption of [PEP-621] perhaps now is a good time to switch over to using a `pyproject.toml` file? [deprecated]: pypa/setuptools#1684 [quite a stir]: pypa/setuptools#4519 [pywb]: https://github.com/webrecorder/pywb [PEP-621]: https://peps.python.org/pep-0621/
`setup.py test` has been deprecated for years. See: - pypa/setuptools#1684 - pypa/setuptools#4522
The setup.py test command and pytest-runner have been deprecated for several years and are no longer recommended. The pytest documentation no longer recommends pytest-runner and their own documentation recommends against it. - pypa/setuptools#1684 - pytest-dev/pytest#5534 - pytest-dev/pytest-runner#50 Changes made: - Removed pytest-runner: Eliminated the use of pytest-runner from `setup.py`. - Moved test dependencies to the `extra-dependencies`, which can be used by tox as well as for manual installation. - Updated the documentation to recommend using tox as the default test runner. Alternatively, users can manually run tests with the `py.test` command. These changes will also make an eventual migration to `pyproject.toml` easier, as the `extras_require` can be copied to the `project.optional-dependencies` section.
The setup.py test command and pytest-runner have been deprecated for several years and are no longer recommended. The pytest documentation no longer recommends pytest-runner and their own documentation recommends against it. - pypa/setuptools#1684 - pytest-dev/pytest#5534 - pytest-dev/pytest-runner#50 Changes made: - Removed pytest-runner: Eliminated the use of pytest-runner from `setup.py`. - Moved test dependencies to the `extra-dependencies`, which can be used by tox as well as for manual installation. - Updated the documentation to recommend using tox as the default test runner. Alternatively, users can manually run tests with the `py.test` command. These changes will also make an eventual migration to `pyproject.toml` easier, as the `extras_require` can be copied to the `project.optional-dependencies` section.
The setup.py test command and pytest-runner have been deprecated for several years and are no longer recommended. The pytest documentation no longer recommends pytest-runner and their own documentation recommends against it. - pypa/setuptools#1684 - pytest-dev/pytest#5534 - pytest-dev/pytest-runner#50 Changes made: - Removed pytest-runner: Eliminated the use of pytest-runner from `setup.py`. - Moved test dependencies to the `extra-dependencies`, which can be used by tox as well as for manual installation. - Updated the documentation to recommend using tox as the default test runner. Alternatively, users can manually run tests with the `py.test` command. These changes will also make an eventual migration to `pyproject.toml` easier, as the `extras_require` can be copied to the `project.optional-dependencies` section.
* Switch to the PEP517 build framework and remove py-pytest-runner as a build time dependency while I'm here, because upstream of it has archived the project with the following notice: pytest-runner depends on deprecated features of setuptools and relies on features that break security mechanisms in pip. For example 'setup_requires' and 'tests_require' bypass pip --require-hashes. See also pypa/setuptools#1684 * Bump PORTREVISION due package change.
* Switch to the PEP517 build framework and remove py-pytest-runner as a build time dependency while I'm here, because upstream of it has archived the project with the following notice: pytest-runner depends on deprecated features of setuptools and relies on features that break security mechanisms in pip. For example 'setup_requires' and 'tests_require' bypass pip --require-hashes. See also pypa/setuptools#1684 * Bump PORTREVISION due package change.
I think there's at least some agreement in #931 that we want to remove the test command. I think we should start by raising deprecation warnings pointing people at
tox
, the same way we've done for theupload
andregister
commands.The most likely stumbling block that I see is that I think a huge number of people have created their own
test
command that invokes their preferred test runner,pytest
or whatever. Ideally we'd want to get the deprecation warning to them as well. Hopefully most of them are usingTestCommand
as their base class, though if we want to get really aggressive about it we could try parsingsys.argv
directly.I think we need to warn in the following situations:
setup.py test
command is executedtests_require
is specifiedaliases.test
is specified insetup.cfg
It's likely that at least two of these will be specified, but I think two separate warnings would be useful.
CC: @gaborbernat @RonnyPfannschmidt @nicoddemus
The text was updated successfully, but these errors were encountered: