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

Consider option for disabling .pyc generation #68

Closed
brejoc opened this issue Jun 7, 2013 · 9 comments
Closed

Consider option for disabling .pyc generation #68

brejoc opened this issue Jun 7, 2013 · 9 comments
Labels

Comments

@brejoc
Copy link

@brejoc brejoc commented Jun 7, 2013

Might be nicer of invoke to not generate a tasks.pyc.

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Jun 25, 2013

Can you provide a specific example of how this is problematic? We have to import/run tasks.py at some point, which is what generates the pyc.

Also not sure if one CAN tell Python not to bytecode-compile at runtime, I'm mostly used to the Python interpreter option like PYTHONDONTWRITEBYTECODE.

Loading

@brejoc
Copy link
Author

@brejoc brejoc commented Jun 25, 2013

I wouldn't go so far to call it problematic. I just think it's not nice of an build tool to save some of its own meta data (I know it's not meta data, but let's just pretend it is) persistently in the folder it just happens to be. Call me anal, but I would prefer to have a clean project/build folder.
Some projects managed with invoke might not be python projects and developers might wonder where this pyc file is coming from and whether they have to add it to the repository or should better put it on the ignore list.

But still - this is not really an issue.

You can prevent Python from generating pyc files with the following two lines in /usr/bin/invoke:

import sys 
sys.dont_write_bytecode = True

This has the downside of not generating pyc files at all. So there is no speed improvement with the second execution. It might be possible to insert this a bit later but I didn't try it, since invoke is pretty fast.

Loading

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Jul 6, 2013

I forgot all about the sys. angle - thanks. I understand your argument and right now I'm +0 on it - given pyc compilation is intended to help with speed, it's not critical for Invoke's use case. In an average use case I'd expect bytecode compilation time to be dwarfed by the runtime of the subcommands the user is triggering.

If you have time to add this as an option (so advanced users who do have a "care about speed" use case have an 'out') I'd merge it. Thanks!

Loading

@brejoc
Copy link
Author

@brejoc brejoc commented Jul 11, 2013

Okay, I'll take care of this in the next few weeks. I've got a dealine ahead, so this will have to wait a few days.

Loading

@bitprophet
Copy link
Member

@bitprophet bitprophet commented Jul 15, 2013

Sure, no rush on my part, I've had to let my OSS slide real bad lately myself :( Thanks!

Loading

@bitprophet bitprophet changed the title tasks.pyc pollute pwd Consider option for disabling .pyc generation Aug 25, 2014
@brutus
Copy link

@brutus brutus commented Apr 11, 2015

This sounds pretty neat. What's the state of it and ea93218?

Loading

@bitprophet
Copy link
Member

@bitprophet bitprophet commented May 5, 2015

Is that commit part of an actual PR somewhere? If it is, github's not telling me. @brutus

Loading

@brutus
Copy link

@brutus brutus commented May 5, 2015

I just tired it again here: brutus@e424074 and it still works for me.

Just had a quick look though. The tests run fine, expect core_help_option_prints_core_help that fails on the additional --write-pyc option in the help output as expected, but I handled that in my no-pyc branch.

Loading

bitprophet added a commit that referenced this issue Jan 13, 2016
Went a more direct route than #244 since it was more test-friendly.
Turned out to be less code too, not like it matters here...
bitprophet added a commit that referenced this issue Jan 13, 2016
@bitprophet
Copy link
Member

@bitprophet bitprophet commented Jan 13, 2016

Implemented, finally. Thanks again @brutus & @brejoc!

Loading

@bitprophet bitprophet closed this Jan 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants