Skip to content

python/stathat.py improvements (onboarding instructions broken) #15

@dkuebric

Description

@dkuebric

In your example you provide the following sample:

from stathat import StatHat
stathat.ez_post_value('some@email', 'sign in - age of user', 27.0)

If followed faithfully, this example fails for two reasons:

  1. StatHat class is capitalized, and module not imported -- the second line doesn't resolve symbol properly
  2. If I assume I ought to have capitalized the class in 2nd line (that's what I imported), I'd find that non-instance class members should be decorated with @classmethod or @staticmethod in python -- calling ex_post_value on the class directly rather than an instance of the class will fail

I'd recommend wrapping these in a class that you can initialize with an API key so you don't have to pass the API key to every method call, and amending the instructions to instantiate the class. Or you could use static/class methods, or skip the class entirely.

Additionally, I noticed you provide a ruby gem. It's easy to do similar packaging with pypi for python: https://packaging.python.org/en/latest/distributing/#uploading-your-project-to-pypi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions