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

Add setuputils script for py bindings #51

Merged
merged 1 commit into from
Feb 15, 2017

Conversation

octylFractal
Copy link
Contributor

Python packages usually have a setup.py included to install the scripts.

@daniel-j-h
Copy link
Collaborator

Thanks! It's a good idea to make this properly installable!

I think we want to fill in a bit more details, e.g. license, use README.md as a readme, etc.

Could you adapt .travis.yml to install the Python module. Then break of the test script from the library

if __name__ == '__main__':
with Sweep() as sweep:
sweep.start_scanning()
speed = sweep.get_motor_speed()
rate = sweep.get_sample_rate()
print('Motor Speed: {} Hz'.format(speed))
print('Sample Rate: {} Hz'.format(rate))
# get_scans is coroutine-based generator lazily returning scans ad infinitum
for n, scan in enumerate(sweep.get_scans()):
print('{}\n'.format(scan))
if n == 3:
break

into a small example.py import sweeppy (without any sys.path tricks :P) and run the test routines.

@daniel-j-h
Copy link
Collaborator

Here's a bit more context for what we want to do in the future: eventually we want to package the pre-built shared library libsweep.so for the Python module (as a wheel). This would allow users to pip install sweep and have everything working magically. Here are some good readings:

Building these platform dependant libraries is a bit more involved, though. The common way to do it for Linux is to spawn up a Docker container with an old libc, build the library there (for compatibility), and distribute it. For macOS and Windows it may be a bit easier.

Anyway, that's just to give some context of our future plans.
For now a Setuptools based installation and requiring the user to compile libsweep.so is fine.

@octylFractal
Copy link
Contributor Author

It sounds like PyPI doesn't allow Linux wheels right now, so I don't think there's a way to include a compiled libsweep.so. I've added everything else, though.

@daniel-j-h
Copy link
Collaborator

Hm not sure where you got the information from that PyPI does not support Linux wheels. I think what we have to do is build the shared library on a "old enough" system (CentOS 5) and restrict us a bit for the wheels to be part of the manylinux1 ecosystem, see:

These wheels work happily on basically all Linux systems currently out there. At least the ones we care about having binary builds for. It would be perfect if we could let Travis CI build those wheels in a Docker container for master.

I'd like to split the wheels discussion off of your pull request, though. If that is fine with you. Can you squash and rebase your branch, then I'd like to merge it into master.

@octylFractal
Copy link
Contributor Author

It's squashed and rebased on master.

@daniel-j-h
Copy link
Collaborator

Thank you! Happily merging now! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants