TESScience / SPyFFI

Spiffy Python for TESS Full Frame Images
MIT License
6 stars 7 forks source link

Scripts have module call and relative import #21

Closed doctormo closed 8 years ago

doctormo commented 8 years ago

The scripts in ./scripts/ all use a relative import from ..Operation import thing which only works if you import the script as if it were a module. This negates the bang line that appears in several scripts.

Changed local scripts to import from SPyFFI.Operation import thing and they then would run using the install from pip without issue. I have these changes locally, but didn't want to merge request without knowing why the project might have chosen this way of writing scripts over the typical binary bang line method.

xcthulhu commented 8 years ago

I did the relative import stuff when I was going through this trying to find broken code using my IDE (in this case PyCharm).

I tried to fix relative imports everywhere to appease the linter and so I could find other problems with the static analysis tools I have available.

We can fix the ./scripts directory, but TBH I don't know what's really used and what's code rot. Also note that it's not installed by setup.py currently.

I'll make a PR today to fix this, thanks for brining it up.

doctormo commented 8 years ago

Do you know what scripts are best to confirm the installation is working? The demonstration script (once fixed) took 6GB of ram and was fairy aggressive with the machine. So hearing that there might be code rot raises some questions about what might and might not be a good test.

I think the plan is to have a module based plugin extra in the deep future anyway, so maybe this just needs to evolve into something more plugin orientated with a single simple calling script which can be installed in /usr/local/bin by setup.py and run from the command line e.g. spyffi my_module_command [other options] a bit like a few other python packages (or even git itself really)

xcthulhu commented 8 years ago

@doctormo Yeah, @noqsi and I usually test with a much smaller simulation. You can run it by just going into test/ and typing make (this is what TravisCI is doing).

This installs SPyFFI in a virtual environment sandbox.

If you would like to test against SPyFFI installed globally, you can try:

SPYFFIDATA=<where ever your data files reside> python test/scripts/smallone.py

...which takes ~20 seconds on my machine.