Skip to content

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

Merged
astrofrog merged 5 commits into
astropy:masterfrom
pllim:no-setup-py
Sep 29, 2020
Merged

astrofrog merged 5 commits into
astropy:masterfrom
pllim:no-setup-py

Conversation

@pllim

@pllim pllim commented Sep 22, 2020 •

Copy link
Copy Markdown
Member

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.

@saimn saimn left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread astropy/tests/runner.py Outdated
"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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

Comment thread astropy/tests/runner.py Outdated
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here.


#. 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@pllim pllim Sep 23, 2020 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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
Copy Markdown
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. 😬

@pllim

pllim commented Sep 22, 2020

Copy link
Copy Markdown
Member Author

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

@astrofrog astrofrog left a comment

Copy link
Copy Markdown
Member

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.

Comment thread astropy/tests/command.py Outdated
``./setup.py test`` distutils command.
"""

"""Implements the wrapper for the Astropy test runner."""

Copy link
Copy Markdown
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?

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
Copy Markdown
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?


#. 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
Copy Markdown
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

#
cd astropy/coordinates/tests # get ready to run coordinate tests
py.test # test
pytest # test

Copy link
Copy Markdown
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.

# After edit, re-test
#
py.test test_arrays.py # Hopefully this succeeds
pytest test_arrays.py # Hopefully this succeeds

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

pllim commented Sep 23, 2020 •

Copy link
Copy Markdown
Member Author

I have applied the comments except the following:

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

@pllim

pllim commented Sep 23, 2020

Copy link
Copy Markdown
Member Author

Okay, what about now?

@saimn saimn left a comment

Copy link
Copy Markdown
Contributor

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.

@astrofrog astrofrog left a comment

Copy link
Copy Markdown
Member

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

bsipocz commented Nov 25, 2020

Copy link
Copy Markdown
Member

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