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

Support for __main__.py #59

Closed
monospacedmagic opened this issue Apr 21, 2020 · 3 comments · Fixed by #115
Closed

Support for __main__.py #59

monospacedmagic opened this issue Apr 21, 2020 · 3 comments · Fixed by #115
Labels
bug Something isn't working enhancement New feature or request

Comments

@monospacedmagic
Copy link

monospacedmagic commented Apr 21, 2020

I plan to adopt pyflow early in a production environment despite how young it is simply because it's that good. However I can't seem to be able to even run my project. Here's my (simplified) project structure:

__pypackages__
    [...]
myproject
    __main__.py
pyproject.toml

Here's what I've tried so far:

  • pyflow -m myproject

error: Found argument '-m' which wasn't expected, or isn't valid in this context

  • pyflow myproject

Problem running the CLI tool myproject. Is it installed?

  • pyflow python -m myproject

error: Found argument '-m' which wasn't expected, or isn't valid in this context

  • __pypackages__\3.7\.venv\Scripts\activate.bat followed by python -m myproject

ModuleNotFoundError: No module named 'click'

(main.py tries to import click but it fails.)

I'm out of ideas. Any help is appreciated!

Edit: I've now moved __main__.py out of myproject and renamed it to run.py, and I run it with pyflow run.py. It would be better if pyflow supported the standardized __main__.py in some way, though.

@monospacedmagic monospacedmagic changed the title [Windows] Issues trying to run my project Support for __main__.py Apr 21, 2020
@David-OConnor David-OConnor added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Apr 24, 2020
@David-OConnor
Copy link
Owner

As you've discovered, this is due to limitations on Pyflow's CLI. I think it would be nice to support the flow you tried, since it's intuitive, and consistent with existing python syntax. I'll add it.

@monospacedmagic
Copy link
Author

Possibly related: It seems that pyflow just tries to consume all flags, even those that were intended for the python script I'm trying to run.

myproject>pyflow run.py --test
error: Found argument '--test' which wasn't expected, or isn't valid in this context

USAGE:
    pyflow [script]... [SUBCOMMAND]

For more information try --help

@David-OConnor David-OConnor added the bug Something isn't working label Apr 27, 2020
@David-OConnor
Copy link
Owner

I can confirm this. There's something wonky with the arg parsing handling. I think I need to re-organize that section of the code; making the initial change should have been easy, but I ran into trouble. May switch off the structopt dependency, which manages this.

tanj added a commit to tanj/pyflow that referenced this issue May 27, 2021
resolves David-OConnorgh-59

Needs work to get `pyflow --help` to once again show help for the removed
subcommands. I currently don't know how to make structopt display help
for external_subcommands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants