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

[WIP] Quick build command #74

Closed
wants to merge 3 commits into from
Closed

[WIP] Quick build command #74

wants to merge 3 commits into from

Conversation

joerick
Copy link
Contributor

@joerick joerick commented Jun 24, 2018

This command pushes a stash of the repo to the origin remote, to avoid
needing to push loads of tiny commits while you're crafting the perfect
build config.

The stash push will trigger an Appveyor and Travis build, so the build
can be checked before committing the change.

This command pushes a stash of the repo to the origin remote, to avoid
needing to push loads of tiny commits while you're crafting the perfect
build config.

The stash push will trigger an Appveyor and Travis build, so the build
can be checked *before* committing the change.
@joerick
Copy link
Contributor Author

joerick commented Jun 24, 2018

Open to feedback on this! currently I'm thinking the interface isn't quite right, i think it should be more like a command quick-build not --quick-build but I can't figure out how to make argparse do that!!

@YannickJadoul
Copy link
Member

Hmmm, I don't have a strong opinion about it, but that's probably mainly because I haven't used it (and since I kept committing and force pushing to specific travis/appveyor branches anyway, when debugging, but maybe this ís indeed cleaner). The main problem seems that if you quickly do this one after the other, you'll end up overwriting the previous stashed 'temporary commit' on the remote branch, and Travis CI/AppVeyor will crash in the jobs that haven't started yet, because that commit is now removed from the remote.

Have you looked at https://stackoverflow.com/questions/4575747/get-selected-subcommand-with-argparse, for the subcommands? If I can find some time, I'd be interested enough to see if I can play around with that a bit :-)

@joerick joerick changed the title Quick build command [WIP] Quick build command Jul 10, 2018
@altendky
Copy link
Contributor

argparse has subparsers but... maybe click? But, within argparse, here's a thing I have.

https://gist.github.com/altendky/6a085be24502f3e2bce915fcf1db298d#file-create_venv-py-L404-L410

    rm_parser = subparsers.add_parser('rm', description='Remove the venv')
    rm_parser.add_argument(
        '--ignore-missing',
        action='store_true',
        help='Do not raise an error if no venv is present',
    )
    rm_parser.set_defaults(func=rm)

Particularly note the last line, that's how I set the function I want called to handle that subparser. You could use an enumeration or string or whatever else if you wanted dispatch based on an if or such (not recommending that though). Then I strip out ounc from the args and pass everything else on to the func.

But yeah, click...

Also, I'm not too sure about a bunch of temporary funny business being great. Builds with corresponding commits missing sounds confusing.

@joerick
Copy link
Contributor Author

joerick commented Sep 10, 2018

Thanks for the tips, that set_defaults thing might be useful.

Also, I'm not too sure about a bunch of temporary funny business being great. Builds with corresponding commits missing sounds confusing.

Yeah the temporary commit is pretty core to this idea, since we're basically pushing a stash.

But your comment makes me think there could be another approach where a branch is set up that just contains test builds - the diffs would be nonsense but at least there would be a record of what code did each build.

@altendky
Copy link
Contributor

I more meant that if I want to isolate messy exploratory commits... I'll just make a branch myself. :] But I'm sure other people would be interested in this.

@joerick
Copy link
Contributor Author

joerick commented Jan 31, 2020

Closing due to inactivity.

on reflection, this is a neat feature, but it would be better as a git alias or something.

@joerick joerick closed this Jan 31, 2020
@YannickJadoul
Copy link
Member

@joerick If you figure something out, might still be nice to add to the docs?

@joerick joerick deleted the quick-build branch March 9, 2020 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants