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

Some advance with setup_command #919

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
3 participants
@williamjmorenor
Copy link

commented Apr 30, 2016

Signed-off-by: William Moreno Reyes williamjmorenor@gmail.com

Some advance with setup_command
Signed-off-by: William Moreno Reyes <williamjmorenor@gmail.com>
@williamjmorenor

This comment has been minimized.

Copy link
Author

commented Apr 30, 2016

Hi I have been doing some testing with the setup_command (#918).

The comand seems to work, I can run:

setup_command.BuildDoc.run()

The build_mkdocs is visible with python setup.py --help-commands

But when I run the command I got:

python3 setup.py build_mkdocs
running build_mkdocs
Usage: setup.py [OPTIONS]

Error: Got unexpected extra argument (build_mkdocs)

I am doing something wrong with the run() module but I can not find what is.

@waylan

This comment has been minimized.

Copy link
Member

commented Apr 30, 2016

I'm just guessing here, but you are using the Click build command (from __main__.py). Click gets its arguments from reading argv and argv contains the argument build_mkdocs which is unknown to Click. In my experience, nesting one cli system inside another will almost always break without some extra steps. I would suggest searching for how to use Click with disutils commands.

@waylan

This comment has been minimized.

Copy link
Member

commented May 4, 2016

Actually, if you look at the Spinx example you pointed to in #918, you will see that they re-implement all of the options directly using disutils command tools. It may be that that is the only way it will work.

@d0ugal

This comment has been minimized.

Copy link
Member

commented May 4, 2016

I played around with this and tried to make it work. The issue you are hitting is the conflict between different command line frameworks. Click looks at the full input path python setup.py build_mkdocs command and spots build_mkdocs as an argument, but that isn't one that we have registered in the Click build command.

I think @waylan is correct, the easiest way would be to just allow build be called with no optional arguments. So, just like calling mkdocs build but don't support mkdocs build --theme... etc. I think that would be the best option.

Otherwise you would need to duplicate all the command line options and we would need to maintain them both. I don't want to do that.

@d0ugal d0ugal added the Update needed label Jun 7, 2016

@waylan

This comment has been minimized.

Copy link
Member

commented Aug 22, 2016

Click has the CLIRunner Class, intended for testing Click commands. It allows you to progmatically call a command, passing in options and args isolated from argv. Perhaps the setup_command could gather the options and args and pass them on to Click this way (perhaps the --help flag could even be passed through?). The trick would be getting setup_command to accept any arbitrary options and args without them being redefined in setuptools CLI system. If that's possible, this should be an easy fix. If not, then I wonder if there is even any value in bothering to implement a basic, option-less, command.

@waylan

This comment has been minimized.

Copy link
Member

commented Aug 22, 2016

I'm closing this as we don't need both the issue and PR open. Someone can always open a new PR.

@waylan waylan closed this Aug 22, 2016

@waylan waylan referenced this pull request Aug 22, 2016

Open

build docs from setup.py #918

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.