adafruit / Adafruit-Raspberry-Pi-Python-Code

Adafruit library code for Raspberry Pi
1.43k stars 686 forks source link

A package for Adafruit-Raspberry-Pi-Python-Code #144

Closed s-celles closed 8 years ago

s-celles commented 8 years ago

Hello,

it will be nice to have package for Adafruit-Raspberry-Pi-Python-Code.

Kind regards

liambeguin commented 8 years ago

Hi, I don't know if it's the exact same code but a package is available.

sudo pip install Adafruit_Libraries

https://pypi.python.org/pypi/Adafruit_Libraries/0.1

mecworks commented 8 years ago

It's definitely not the same code as it was last updated in 2013. It would be nice if there were a cronjob that kept the pip version up to date.

On Sun, Jan 24, 2016 at 11:51 AM, Liam BEGUIN notifications@github.com wrote:

Hi, I don't know if it's the exact same code but a package is available.

sudo pip install Adafruit_Libraries

https://pypi.python.org/pypi/Adafruit_Libraries/0.1

— Reply to this email directly or view it on GitHub https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/issues/144#issuecomment-174329265 .

Marc Christensen http://www.mecworks.com

s-celles commented 8 years ago

A __init__.py in each directory is necessary. A setup.py file is also required.

liambeguin commented 8 years ago

the setup.py file can be taken from the current package and updated

s-celles commented 8 years ago

setuptools might be prefered instead of distutils

see http://stackoverflow.com/questions/6344076/differences-between-distribute-distutils-setuptools-and-distutils2

s-celles commented 8 years ago

A LICENCE.txt file is necessary. I also noticed that README is a Markdown file (but PyPi doesn't render them correctly...). Maybe using RST might be considered.

I also noticed that in this PyPi package most directories were renamed

from setuptools import setup, find_packages
NAME = 'Adafruit_Libraries'

setup(
    name=NAME,
    version='0.x.y',
    author='Adafruit',
    packages=find_packages(),
    url='http://www.adafruit.com/',
    license='LICENSE.txt',
    description='Libraries for using Adafruit Hardware on a Raspberry Pi or BeagleBone Black',
    long_description=open('README.md').read(),
)
s-celles commented 8 years ago

I've just send a PR which provide a package. Pinging @ladyada @tdicola Could you have a look ?

ladyada commented 8 years ago

@tdicola has a Plan to do a major cleanup of this creaky repo including pep8, py3, and pypi...its quite a pppparty :)

mecworks commented 8 years ago

I was wondering how this is coming. I checked the current project and no init.py files exist yet so I assume the package-ability is not there yet. Will these files be in the git repo or only in the package on pypi/pip? Also, is there an ETA for a pypi/pip package?

ladyada commented 8 years ago

https://github.com/adafruit/Adafruit_Python_ADS1x15 and https://github.com/adafruit/Adafruit_Python_MCP3008 are done

mecworks commented 8 years ago

So, each module will be its own package rather than one package that contains all Adafuit modules? I'm fine either way. Separate packages are easy to install just what's needed for a project, a single package that contains all of Adafruit's packages would ensure you have all packages and that they all work with each other.

ladyada commented 8 years ago

yep each package will be split off, it will make maintenance and cross-dependancies way easier. there is no ETA when they'll be done, its a lot of work, we're also fixing bugs and pulls at the same time

mecworks commented 8 years ago

Very cool. Thanks for the great work.

scanner commented 8 years ago

Not sure if this is helpful at all, but I have made two modules based on a combination of the Adafruit arduino code and the Adafruit Python GPIO module for the TSL2561 and HDC100x modules:

https://github.com/scanner/HDC100X_Python https://github.com/scanner/TSL2561_Python

s-celles commented 8 years ago

If you make one repository per module I suggest to use a template like cookiecutter https://cookiecutter.readthedocs.org/en/latest/

So you could make a project template with features such as PEP8 testing enabled when commit / PR occurs. https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/issues/146

mecworks commented 8 years ago

Cookiecutter looks pretty cool. There's already defined cookiecutter templates for pip projects and python projects.

On Wed, Feb 17, 2016 at 12:42 PM, scls19fr notifications@github.com wrote:

If you make one repository per module I suggest to use a template like cookiecutter https://cookiecutter.readthedocs.org/en/latest/

— Reply to this email directly or view it on GitHub https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/issues/144#issuecomment-185371365 .

Marc Christensen http://www.mecworks.com

caternuson commented 8 years ago

I would've voted for a single package. While it may make maintenance more difficult under the hood, the user experience would be a little cleaner.

A simple example:

from adafruit import GPIO
GPIO.output(23, GPIO.HIGH)

Another example:

from adafruit import Matrix8x8
m = Matrix8x8.Matrix8x8()
m.setPixel(4, 2, m.ON)
ladyada commented 8 years ago

@caternuson we tried an it was simply not tractable for our developers. we wanted to keep working on it without going insane :) also, since we did it and its done, we'll be closing this issue. thx!