1

Hello.
Well I'm working very hard to learn python. I couldn't get pip to work at first but now I've got it working. I'm not a beginner programmer or advanced, I'm somewhere in the middle if that means anything. I understand syntax and how I would code basic things.
So I wanted to create this topic to learn about what fellow programmers find are good or useful python packages. Like I said I have pip working so I can install packages easily, I just don't know what kinds of things i will need from the python package index. I want to make audiogames but I'm definitely willing to try designing other pieces of software. Please tell me about any modules that you find helpful, or easy to use, or just packages that do fun stuff with python.
Thanks I'm eager to see where this topic goes.
I did have a question though, I tried to install pyaudiogame with pip and it says can't find or satisfy requirements. Is this because pyaudiogame was taken off the package index? Is pyaudiogame still being developed at all?

Guitarman.
Playing music and coding, are kinds of real world magic.

Thumbs up

2 (edited by pauliyobo 2017-10-02 09:53:35)

wich version of py are you using?
if you're interested in developing audiogames there are 3 packages created for this purpose
pyaudiogame, i don't know if is longer continued though, and there are few issues with libraries
AGK both of those are for py2.7

for py3, there is
AGK3

or if you want to start them by your own you can learn pygame, pyglet, and sound libraries like soundlib or libaudioverse
i hope this reply could help you  smile

...

Thumbs up

3

Hello,

Try Django. This is an advanced and fast Web framework for Python.

It is a MVC framework primarily designed to make CMS applications, but you can do almost anything.

Cheers,

Thumbs up

4

Hi. Woops sorry, I did forget to mention that, I'm using python 2.7 latest. Thanks for the suggestions so far!

Guitarman.
Playing music and coding, are kinds of real world magic.

Thumbs up

5

just remembered now, you can try to use even flask, wich is a micro web framework.

...

Thumbs up +1

6

Hi.
I'm going through learn python the hard way and i'm on exercise five. I typed the code exactly and compared mine with the book's code and they match up. Python tells me invalid syntax or that I need parens after print. What is wrong? I remember I had this problem last time when I did this exercise but I don't remember how I fixed it.
Here is my code-
# This is a variable that tells my name, the next variable tells my age.
my_name = 'Cfb'
my_age = 26
my_height = 74 # inches
my_weight = 240 # lbs
my_eyes = 'Blue'
my_hair = 'Brown'

print ("Let's talk about %s.") % my_name
print ("He's %d inches tall.") % my_height
print ("He's %d inches heavy.") % my_height
print ("He's %d pounds heavy." % my_weight
print ("Actually, that's not too heavy.")
print ("He's got %s eyes and %s hair.") % (my_eyes, my_hair)
print ("His teeth are usually %s depending on the coffee.") % my_teeth
    print ("If I add %d, %d, and %d I get %d.") % (
    my_age, my_height, my_weight my_age + my_height + my_weight)

I know it must be something simple that I'm missing but I can't figure what it is.
Thanks.

Guitarman.
Playing music and coding, are kinds of real world magic.

Thumbs up

7

if you're using python 2.7 you might want to remove parenteses from print
here's your code, try now

my_name = 'Cfb'
my_age = 26
my_height = 74 # inches
my_weight = 240 # lbs
my_eyes = 'Blue'
my_hair = 'Brown'
print "Let's talk about %s." % my_name
print "He's %d inches tall." % my_height
print "He's %d inches heavy." % my_height
print "He's %d pounds heavy." % my_weight
print "Actually, that's not too heavy."
print "He's got %s eyes and %s hair." % (my_eyes, my_hair)
print "His teeth are usually %s depending on the coffee." % my_teeth
    print "If I add %d, %d, and %d I get %d." % (
    my_age, my_height, my_weight my_age + my_height + my_weight)
or if this is not the error can you paste the traceback?

...

Thumbs up

8

@6
The problem is with this line:

print ("He's %d pounds heavy." % my_weight

I'm pretty sure you can figure it out from there.
@7
This shouldn't matter. In fact, I'd leave it this way for cross compatibility

You can follow me on twitter @cartertemm

Thumbs up +1

9

A few useful packages:

requests - the quintessential library for making http requests of all kinds. The standard library has urllib but requests is much nicer.

boltons - various decorators and utilities that are useful. Some of them are advanced, so they may not be immediately useful to you.

pyglet - a library for game development, includes a publish / subscribe pattern, keyboard hooks, basic sound playback, advanced visual stuff through open GL, etc. If your making audio games and actually want to learn how libraries like AGK and AGK3 do things behind the scenes, you'll probably want this.

pygame - It's similar to pyglet, but I haven't personally used it much so I can't really recommend it; I'm just including it here for completeness of packages you might be interested in.

libaudioverse - an advanced audio library. Coded in c++, but with python bindings, so it's on pypi. Again, if you want to really understand and have full control over audio in games you might make, use this.

twisted - a full-featured networking library. If you need to write a server, a client, a proxy, etc, this is something worth considering. You can use 'socket', which is low-level and from the standard library, but twisted is nicer.

sqlalchemy - an awesome database toolkit. If you need an app to use a database, this is my personal favorite for the job. It has an orm, an object relational mapper, which maps python classes to database tables. A specific class you code represents a table in a database, and an instance of that class represents one row in that db table. In this way you can really easily define a database schema just by defining what a class looks like. I use it all the time in web applications, my game, mud bots, etc. It also supports a bunch of different databases so you can use sqlite when testing locally, and mysql or postgresql when testing on the server and running your app in production.

flask and django - As has been mentioned before, flask is a micro web framework. Normal websites are just a collection of assets that a server reads from disk and streams to clients, which then do things like run javascript, retrieve and apply css, etc. A site can also run a program, (passing in things like the URL, the headers, the client's IP address, etc) and return the response that program came up with to the client. All of this is known as the wsgi, or web server gateway interface (the protocol a server uses to talk to a web app, and vice versa). Packages like django and flask support this out of the box, so all you need to do is tell the framework about a URL you want to have and make a function that returns what you want that URL to return. Both packages have template engines, which let you define html pages that support variables, for loops, macros, etc. If you need to write a web application, either of these would work just fine, though flask is smaller and gives you more freedom as to the pieces you want to use (database, login system, etc).

geocoder - a package to get coordinates from an address or city, or a general location from an IP address.

mbf - Just gonna throw this in. It's a library I wrote for making mud bots. It isn't on pypi yet (one of these days I'll put it up), but it is on my git hub. It still needs some polishing up, but you can define triggers (with regular expressions of course, or not if your lame), timers (using an interval or at a specific time), and it handles connecting and logging into a mud, as long as you provide a few pieces of information. In the future I'll update it so you can register multiple bots on one framework object, as well as giving it the ability to proxy your mud connections (so you can connect to a server running mbf and play as normal, while bots are controlled from your server).

click - If you need to make a command-line program or script that takes more than 1 or 2 options, click lets you easily define what options and arguments you want. If your program is more complex and needs subcommands (think git commit - where commit is a subcommand of git), that's pretty easy to do as well.

wx - If you need to make accesible UIs, wx is pretty much the standard.

cryptography - If you find yourself needing to do light or serious crypto stuff, the cryptography library most likely has what you want.

These were just the ones I could think of off the top of my head. There are a lot more out there, and if one doesn't do quite what you want, you can always make your own.

Regards,
Blademan
Twitter: @bladehunter2213

Thumbs up

10

You can add Numpy to that list. Its a scientific computing library that provides a number functions written in C for crunching numbers and manipulating arrays of data. Its great if you need to do any heavy lifting or greater flexibility with large amounts of data. Its part of a larger collection of scientific libraries like Matplotlib, scipy, etc. among others for machine learning or genetic sequencing.

There's also PyAL which is a thin OpenAL wrapper, and with a little tweaking Pyglet's OpenAL bindings can also provide advanced audio functions.

-BrushTone v1.2.8: Accessible Paint Tool

Thumbs up