-
Notifications
You must be signed in to change notification settings - Fork 399
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
move src/examples to examples #70
Conversation
Oh... I think this is more tricky (since the examples depends on the examples package). I'll mark it as a draft. |
'..', | ||
'..',)) | ||
sys.path.append(project_root) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems, to me, like a lot of boilerplate to need to add to every sample. Is this normal in Python repos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added a comment about this. The other option is for the user to set PYTHONPATH
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. I actually prefer the PYTHONPATH
approach, but for some reason I went with the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a line to the README. Something like:
To run the example you need to set PYTHONPATH.
export PYTHONPATH=`pwd`
....
....
@Moishe @chadbailey59 With these changes we don't make To do that, since the
WDYT? |
323560a
to
b033808
Compare
I've updated the PR with the |
I don't love setting PYTHONPATH either, because it's gonna require extra setup steps to run the examples inside VSCode (or whatever other IDE). What if we just put a copy of the runner.py file in (I tried using relative imports with no luck, maybe because it would also require a PYTHONPATH, just a different one) |
That works for me! I was also thinking of adding
Yes, I tried that as well without luck. |
Actually, this has the same problem as the relative import as you would do:
But since we don't have a package.... |
b033808
to
a970595
Compare
Alright, I have moved
|
I have also added these lines:
to each script, since this is specific to the application itself, not the library. |
I copied runner.py into the examples directory and changed the import to:
and then, from the examples directory,
that seems to work fine without adding any example-specific code to the package. Does that work for you? |
a970595
to
a573277
Compare
Duh! Of course it works. PR updated. |
I kept |
I believe this will capture users' attention better. People just click at
examples
, plus I believe it is more common to have them in the root directory.