Skip to content
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

MNT: Update doc about setup.py and py.test #10756

Merged
merged 5 commits into from
Sep 29, 2020
Merged

Conversation

pllim
Copy link
Member

@pllim pllim commented Sep 22, 2020

Description

This pull request is to address mentions of outdated setup.py and py.test usage.

I am still not so sure about milestoning doc changes. I am guessing this should go in bug fix for 4.1? If not, feel free to re-milestone.

Close #10752

p.s. There was also a previous effort to replace py.test in #10722, which seemed to have missed the files I edited here.

Copy link
Contributor

@saimn saimn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few comments.

@@ -334,7 +334,7 @@ def coverage(self, coverage, kwargs):
warnings.warn(
"The coverage option is ignored on run_tests, since it "
"can not be made to work in that context. Use "
"'python setup.py test --coverage' instead.",
"'pytest --coverage' instead.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--coverage is an option specific to setup.py test, and since this is a warning specific to the test runner it should not be changed ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we don't allow setup.py test anymore. I am confused.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think this should be pytest --cov here not --coverage

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saimn made me undo the changes, so --cov doesn't apply no more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning is emitted when you run setup.py test, so it seems weird that it then refers to pytest instead.
And I'm not sure if setup.py test is actually deprecated ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not deprecated, it outright won't work anymore as far as this package is concerned.

Note: running tests is no longer done using 'python setup.py test'. Instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test command is still used by downstream packages that use astropy helpers

@@ -378,7 +378,7 @@ def test_path(self, test_path, kwargs):

if ext in ('.rst', ''):
if kwargs['docs_path'] is None:
# This shouldn't happen from "python setup.py test"
# This shouldn't happen from "pytest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -124,7 +127,7 @@ by ``CHANGES.md`` in the instructions.
all pass, you can proceed on.

#. If you did the previous step, do ``git clean -fxd`` again to remove anything
you made there. Run ``python setup.py build sdist --format=gztar`` to
you made there. Run ``python -m pep517.build --source .`` to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be replaced by python-build in the short term (https://python-build.readthedocs.io/en/latest/). I'm not sure exactly what's the status of this, but pep517.build is going to be replaced by python-build soon.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Until python-build is shipped officially everywhere, we cannot recommend it yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's a bit of urgency to make pep517.build disappear, see discussion pypa/pyproject-hooks#83

If this bit of documentation is going to stick around in a stable version for some months, I'd say it's risky

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can install python-build already, so I don't think there is an issue with recommending it now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we should mention python-build here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why? Isn't it too soon? I tried using it in one of my packages and it doesn't work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all python build is, is a CLI for pep517 it should work fine. What trouble did you run into?

Copy link
Member Author

@pllim pllim Sep 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't install the build package 😉 Also, have you considered using https://github.com/OpenAstronomy/azure-pipelines-templates I hear some really awesome people maintain it 😛

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh... You would think Python would install it automatically since it is like so essential. Thanks! I'll try that.

Re: Azure -- I would have just switched to Actions. I just don't have time to refactor the CI for that package. 😬

docs/development/workflow/command_history.sh Show resolved Hide resolved
@pllim
Copy link
Member Author

pllim commented Sep 22, 2020

@saimn , I think I have addressed your comments. How does it look now?

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow so much outdated stuff, thanks for catching it all! A few comments below.

``./setup.py test`` distutils command.
"""

"""Implements the wrapper for the Astropy test runner."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a note that this is just here for backward-compatibility for other packages and can be removed once astropy-helpers is no longer supported?

@@ -57,6 +57,9 @@ by ``CHANGES.md`` in the instructions.

python -m pep517.build --source .

All following instructions will assume you have ``pyproject.toml``, so
please adjust accordingly if that is not the case yet.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about linking to the 4.0 docs for projects that don't have this file?

@@ -124,7 +127,7 @@ by ``CHANGES.md`` in the instructions.
all pass, you can proceed on.

#. If you did the previous step, do ``git clean -fxd`` again to remove anything
you made there. Run ``python setup.py build sdist --format=gztar`` to
you made there. Run ``python -m pep517.build --source .`` to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree we should mention python-build here

#
# Check setup by running tests
#
cd astropy/coordinates/tests # get ready to run coordinate tests
py.test # test
pytest # test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of these two lines, pytest astropy/coordinates would be better because it will load the pytest config in setup.cfg and will also run doctests not in the tests directory.

ls # what is here?
#
# Write a test in test_arrays.py to expose this bug
#
# After edit, re-test
#
py.test test_arrays.py # Hopefully this succeeds
pytest test_arrays.py # Hopefully this succeeds
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest astropy/coordinates/tests/test_arrays - etc for the rest of the instructions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think updating the actual instruction is out of scope here. The whole thing is way outdated. The log shows Python 2, etc etc. Maybe @mwcraig can update it when he has time. I am not even sure where this info is displayed. I just modify it for consistency in regards to "py.test" since grep found it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had completely forgotten about this. It probably needs to be re-written from the ground up if we want it to stay around. I agree this is outside the scope of this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we can follow-up over at #10777 . Thanks!

@@ -305,7 +303,7 @@ accuracy/test_icrs_fk5.py .

# So far, so good, now check ALL tests
$ cd ../../.. # up to the top level to check all of the tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again we should basically always run pytest from the root of the repo

@pllim
Copy link
Member Author

pllim commented Sep 23, 2020

I have applied the comments except the following:

  • python-build (see convo above).
  • fixing stale shell scripts -- out of scope

@pllim
Copy link
Member Author

pllim commented Sep 23, 2020

Okay, what about now?

Copy link
Contributor

@saimn saimn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @pllim 👍
I will leave the final approval to @astrofrog.

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@astrofrog astrofrog merged commit 4f18f9c into astropy:master Sep 29, 2020
@pllim pllim deleted the no-setup-py branch September 29, 2020 15:13
eteq pushed a commit to eteq/astropy that referenced this pull request Oct 12, 2020
MNT: Update doc about setup.py and py.test
eteq pushed a commit that referenced this pull request Oct 13, 2020
MNT: Update doc about setup.py and py.test
@bsipocz bsipocz modified the milestones: v4.1.1, v4.2 Nov 25, 2020
@bsipocz
Copy link
Member

bsipocz commented Nov 25, 2020

This has been already released, but milestone hasn't been updated accordingly, fixing it now.

@bsipocz bsipocz modified the milestones: v4.2, v4.1 Nov 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Downstream cloud install failing (setup.py install does not install astropy wheel)
7 participants