Skip to content

DOC: Update dev workflow example - #10849

Merged
mhvk merged 2 commits into
astropy:masterfrom
pllim:doc-fix-git
Oct 15, 2020
Merged

mhvk merged 2 commits into
astropy:masterfrom
pllim:doc-fix-git

Conversation

@pllim

@pllim pllim commented Oct 13, 2020

Copy link
Copy Markdown
Member

Address the outdated doc part of #10841 . I could not reproduce the errors reported, however. I used Windows 10 + Git Bash + Miniconda setup.

Also deleted outdated command history and terminal case.

@pllim pllim added this to the v4.2 milestone Oct 13, 2020
@pllim
pllim requested review from Cadair and bsipocz October 13, 2020 18:53

@bsipocz bsipocz 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.

Huge thanks @pllim for the cleanup

@mhvk mhvk 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.

Good to give this a clean-up. A smaller comment about git commands, but a larger one about testing - I think we should get people used to tox, but this implies that we should let it handle virtual environments too...

git push --set-upstream origin fix-1761 # tell my github acct about it
git checkout astropy/master -b fix-1761 # branch based on latest from GitHub
# and switch to this branch
git push your-user-name fix-1761 # tell my GitHub acct about it

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.

I'm confused why this is here (and in the original). If you do it later, when the work is ready, then github will give you a nice web link to copy & paste to do the PR.

Also, if you keep it here, I would keep the --set-upstream...

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.

for what it's worth, I never manually say --set-upstream. Otherwise I agree that it might be better to push only once some work is done to get the github pop-up for opening the PR (maybe it also works when pushing for an existing branch?, I've never tried).

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 never use --set-upstream. In fact, I think a plain old git push is dangerous (personal opinion) and prefer to be explicit when I do the push. If there is a strong preference to add it back, I will.

Sure, I can also delay git push till the end. I wasn't questioning why this tutorial was pushing so often.

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.

oh, git push, just as is, is only asking for the troubles, I don't think should advocate for it anywhere.

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.

I do use -u (I find I'm more likely to push to the wrong branch if I have to enter a name, even with auto-completion...), but for the dev workflow example, I agree it is better not to - keep things as simple as possible. And really it is only useful if one keeps on pushing. So, if you are up for it, I would remove the git push until after the user has done the testing. After all, the whole point of git is to enable asynchronous development - there is no reason to keep github in the loop.

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.

@mhvk - I use gitprompt that decorates my bash prompt (there are way more fancy solutions, too, I just never got to the point of switching), so I always see which branch I'm at. It gives a very convenient double check for names, as well as branch status compared to upstream/origin. And I just got into the habit of double checking with a git gui whenever I need to force push to a branch (in those cases I usually just see the hash as normally I don't bother to create a branch when working with other people's forks).
Overall I find this a highly efficient, but also a quite safe setup.

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 am not sure if we want to get in the weeds on setting up custom git prompt etc. But I did remove all the extraneous git push commands.

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.

Oh, I'm not saying we should do anything about git prompt, it's on the same level of arbitrary personal preferences as the choice of editor. It was only a pointer to Marten's point that helps to avoid pushing to the wrong branch, in case he doesn't use it or something similar.


Change to that directory and run the current tests with::

cd astropy/coordinates/test

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.

Ouch, this is quite bad!!! Doesn't even install things beforehand. I'd say this should be tox -e test -- -P coordinates...

Or, after all, suggest setting up with tox --develop.....

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.

It should work to run pytest directly, but yeah for a first time contributor I would suggest tox, no develop etc.

@mhvk

mhvk commented Oct 13, 2020

Copy link
Copy Markdown
Contributor

p.s. Since it is much better than it was, also OK to just follow @bsipocz's approval and merge...


+ Install our branch in this environment with::

pip install -e .

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.

Later in the tutorial we ask people to run pytest, we should have them install it here. You could argue for a [all,test] here if you want to be able to run the full suite.

Suggested change
pip install -e .
pip install -e .[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.

@bsipocz This is my current leading theory for the issues the new astroquery contributor ran into fyi.

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.

@mhvk's suggestion below to turn the pytest into a call to tox is way better. Although arguably we should have them install the test extra anyway.

Comment on lines 101 to 102
cd astropy/coordinates/tests
pytest

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.

This should really be:

Suggested change
cd astropy/coordinates/tests
pytest
pytest astropy/coordinates/tests

or via tox.

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 removed instructions to keep changing directories, so they all run from top-level now.

@Cadair

Cadair commented Oct 14, 2020 •

Copy link
Copy Markdown
Member

Having spent a while investigating issues from people using this tutorial this week, I strongly think we should have people use tox, it's more likely to work, it sets up a virtualenv without them having to do anything and it will be updated and use our pins to not use known bad versions of deps.

@pllim

pllim commented Oct 14, 2020

Copy link
Copy Markdown
Member Author

@Cadair or @mhvk , do you want to push commits on top of this PR to use tox?

pllim added 2 commits October 15, 2020 15:07
Delete outdated command history and terminal case.

[ci skip]
@pllim

pllim commented Oct 15, 2020

Copy link
Copy Markdown
Member Author

I strongly think we should have people use tox

Funny timing given ContinuumIO/anaconda-issues#12094 . I never found tox convenient myself. It seems like overkill when all I want to do is to run a single test. And I am not at all convinced that it will always play nice with conda, which people tend to use, especially on Windows (ask @adrn).

So, if you really want to change this to use tox, I humbly propose that one of you, who are very familiar with tox, take over this PR, or we merge this and then you can open a follow-up PR.

@bsipocz

bsipocz commented Oct 15, 2020

Copy link
Copy Markdown
Member

I would suggest to merge this as is, now, rather than keep iterating over it in this PR for tox. That can be done in a follow-up. There are a large number of incoming people for Outreachy right now, who are using this guide and this current form is way better than what is currently offered to them.

@mhvk mhvk 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.

This is very nice now! I agree that we can leave tox for follow-up, pip install -e .[test] is a good thing to know too.
Will merge so that it can be seen by the outreachy fellows!

@mhvk
mhvk merged commit 35eb45f into astropy:master Oct 15, 2020
@pllim
pllim deleted the doc-fix-git branch October 15, 2020 21:08
@pllim

pllim commented Oct 15, 2020

Copy link
Copy Markdown
Member Author

Thank you!

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.

4 participants