|
OnceIWasAnOstrich posted:I taught a learning Python class once with Anaconda and I found everything to be too much work in Windows and unfortunately I never found a good way to make Windows act enough like Unix so I just skipped it and taught the entire class in the Spyder IDE that comes with Anaconda. Not my finest moment, but I wasn't getting paid and didn't want to do any more work than necessary.
|
# ? May 23, 2014 22:56 |
|
|
# ? May 30, 2024 16:47 |
|
OnceIWasAnOstrich posted:Why do you need environments at all? To teach best practices for reproducibility, e.g. listing the precise dependencies of each project, which is greatly facilitated with putting each project in its own environment.
|
# ? May 24, 2014 00:14 |
|
Dominoes posted:What in particular was too much work in Windows? Anything that wasn't in Anaconda (Hey now you get to run executables off of some random dude's website instead of using pip), any time I wanted to use awk/sed/grep to explain/show a file format to them, differences in filesystems that kept popping up, all sorts of crazy problems that pop up when people who don't really understand computers try to run something like Anaconda on Windows instead of unix-like, the really lovely terminal (why is cmd.exe so much worse than Terminal.app or pick-a-term in a Linux? (I use PuTTY on my Windows machines to SSH to localhost just to get a nicer terminal), and probably other things I don't remember because I tried to block those days out of my memory. SurgicalOntologist posted:To teach best practices for reproducibility, e.g. listing the precise dependencies of each project, which is greatly facilitated with putting each project in its own environment. Yeah, you can still do all of those without activating the environments into your shell, I honestly prefer using paths to activation scripts because then if you use IDEs or anything you don't have to figure out how to use your environment, you just use the same interpreter you always did, etc.
|
# ? May 24, 2014 03:09 |
|
OnceIWasAnOstrich posted:Yeah, you can still do all of those without activating the environments into your shell, I honestly prefer using paths to activation scripts because then if you use IDEs or anything you don't have to figure out how to use your environment, you just use the same interpreter you always did, etc. I think I'm going to teach it your way, I gave up putting a wrapper together, it's a lot of effort for not much gain. OnceIWasAnOstrich posted:Anything that wasn't in Anaconda (Hey now you get to run executables off of some random dude's website instead of using pip), any time I wanted to use awk/sed/grep to explain/show a file format to them, differences in filesystems that kept popping up, all sorts of crazy problems that pop up when people who don't really understand computers try to run something like Anaconda on Windows instead of unix-like, the really lovely terminal (why is cmd.exe so much worse than Terminal.app or pick-a-term in a Linux? (I use PuTTY on my Windows machines to SSH to localhost just to get a nicer terminal), and probably other things I don't remember because I tried to block those days out of my memory. I've been playing around on Windows all day, using msysgit as a way to get Unix-like on Windows is actually pretty nice, and there are console emulators to make cmd or msys easier to work with. Not even going to attempt anything with binaries that isn't on conda though.
|
# ? May 24, 2014 03:40 |
|
SurgicalOntologist posted:To teach best practices for reproducibility, e.g. listing the precise dependencies of each project, which is greatly facilitated with putting each project in its own environment. That's a pretty neat idea, but won't each Anaconda package come with a bunch of modules that aren't necessarily included in native Python anyway? I'd think that just having them keep track of what gets imported and identifying which modules are standard, which are 3rd party, which are theirs, etc would be good enough. I tend to group my imports into 3 line-separated sections: one for native Python modules (sys, os, etc), one for 3rd party modules (pandas, numpy, etc), and one for local modules (things that I wrote myself or by a coworker, etc) e: And I don't see what's so bad about teaching some introductory stuff in Spyder QuarkJets fucked around with this message at 04:45 on May 24, 2014 |
# ? May 24, 2014 04:28 |
|
QuarkJets posted:That's a pretty neat idea, but won't each Anaconda package come with a bunch of modules that aren't necessarily included in native Python anyway? I'd think that just having them keep track of what gets imported and identifying which modules are standard, which are 3rd party, which are theirs, etc would be good enough. I've always just used pip freeze for this purpose and am only now exploring Anaconda, but I think conda list -e can serve the same purpose for keeping track of external dependencies, including non-Python dependencies (for conda). Also, if projects aren't isolated in environments you'll eventually run into a dependency version conflict. Or am I misunderstanding? I could very well be. The only issue with Spyder seems to be that Python3 support is only in beta and therefore non-obvious to install (although the release seems to be imminent). I'm not going to be avoiding IDEs though, especially for the actual programming part. But the logistics (version control, package management, environments) I'll teach on the command-line. Maybe it's silly but I'm afraid of tying them down to any particular IDE. Once one understands the basics it's easy enough to pick up a new IDE/VC frontend and find the menu items for "install package", "switch virtualenv", "commit", etc. SurgicalOntologist fucked around with this message at 05:31 on May 24, 2014 |
# ? May 24, 2014 05:22 |
|
SurgicalOntologist posted:I've always just used pip freeze and am only now exploring Anaconda, but I think conda list -e can serve the same purpose for keeping track of external dependencies, including non-Python dependencies (for conda). Or am I misunderstanding? I could very well be. Won't that just show you all of the packages that came with your current conda environment rather than just the packages that you need for your project? By default, anaconda usually comes with a lot of stuff
|
# ? May 24, 2014 05:32 |
|
Oh, I wouldn't install the entirety of anaconda in every environment.
|
# ? May 24, 2014 05:38 |
|
http://conda.pydata.org/miniconda.html
|
# ? May 24, 2014 18:50 |
|
Anyone know a decent replacement to Mechanize for 3.4? Thinking of writing an interface to Moodle 2.5 that isn't a huge piece of poo poo and lets us do things like upload feedback sheets to students by bulk without having to follow their arcane rules that don't allow the addition of any new files, and I have to do it without any server-side changes.
|
# ? May 26, 2014 09:06 |
|
RoboBrowser?
|
# ? May 26, 2014 17:14 |
|
I'll have a look, cheers.
|
# ? May 27, 2014 08:59 |
|
I'm having to do a bunch of repetitive stuff and I was wondering if any of you had any suggestions on how to make this more pythonic or just better. I'm writing a method that does the following: code:
|
# ? May 28, 2014 19:15 |
|
Cultural Imperial posted:I'm having to do a bunch of repetitive stuff and I was wondering if any of you had any suggestions on how to make this more pythonic or just better. You can consolidate the session logic by checking all the conditions first. code:
code:
You could define one like this: code:
|
# ? May 28, 2014 19:34 |
|
That's awesome! Thanks Edison!
|
# ? May 28, 2014 20:02 |
|
I'm frequently using a pattern to read from a text "config" file with values on a single line, and want to ignore blanks and comments (lines that start with #). Examples of the config files are RSS URLs to be scraped, folders to be indexed, etc. Is there are more compact or better pattern than this generator? Python code:
|
# ? May 28, 2014 20:07 |
|
Cultural Imperial posted:That's awesome! Thanks Edison!
|
# ? May 28, 2014 22:14 |
|
To take this another step, what do you guys think of eliminating all the conditional statements and using map? I was reading this: http://www.ibm.com/developerworks/library/l-prog/
|
# ? May 28, 2014 22:30 |
|
Could you/someone else provide an example of how to use map? I haven't found a use for map that can't be done cleaner with a comprehension. Depending on what the conditions are, something like this might work: Python code:
Python code:
Dominoes fucked around with this message at 22:56 on May 28, 2014 |
# ? May 28, 2014 22:50 |
|
That article concludes with saying that the "new" list comprehensions are the perfect way to do it (the article's from 2001).
|
# ? May 28, 2014 23:16 |
|
onionradish posted:I'm frequently using a pattern to read from a text "config" file with values on a single line, and want to ignore blanks and comments (lines that start with #). Examples of the config files are RSS URLs to be scraped, folders to be indexed, etc. Depending on how your config files are set up, you might be interested in configparser. It handles some of this for you, including allowing for comments
|
# ? May 28, 2014 23:53 |
|
Dominoes posted:Could you/someone else provide an example of how to use map? I haven't found a use for map that can't be done cleaner with a comprehension. I was barking up the wrong tree. What I really wanted was to use getattr to call a method from a library dynamically based upon input arguments, possibly presented in a list. So for example code:
|
# ? May 29, 2014 00:39 |
|
Does anyone know how to install tkinter on Ubuntu into a virtualenv? Or where I can find the version installed with the apt package python3-tk in the system, so I can symlink it? In short I'm getting this: code:
Maybe related, I seem to be having trouble install anything for 3.3, e.g. code:
code:
SurgicalOntologist fucked around with this message at 01:48 on May 29, 2014 |
# ? May 29, 2014 01:38 |
|
Generic question with a Python bent: I got sick of running my website through Wordpress and have decided to go retro and use a static site generator or something equivalent (so I can write stuff on my local computer and upload, rather than work through a web interface, etc.) So, what are my choices? Pelican is the new up-and-comer, it works with restructured text. Great, huh? But my site is pretty much arranged around pages (for software, talks, etc.) and Pelican's really for a blog, despite assurance otherwise. Alternatives? I've looked at Nikolai (too-blogish), Hyde (blogish), and several others (being blogish or needing you to write in HTML or YAML, etc.) So what I'd really like is something Pythonic, using restructured text or Markdown or the like, that handles pages not posts / blog entries. Any pointers?
|
# ? May 29, 2014 22:13 |
|
outlier posted:Generic question with a Python bent: Jekyll is the classic option, and has the benefit of letting you just host it all on github easily. It's ruby, but whatever, and uses markdown (at least by default), which is nice because restructured text is hot garbage.
|
# ? May 29, 2014 23:26 |
|
good jovi posted:Jekyll is the classic option, and has the benefit of letting you just host it all on github easily. It's ruby, but whatever, and uses markdown (at least by default), which is nice because restructured text is hot garbage. It's not nearly as popular but I used Wok for a website. It is a lot like a less well maintained and advertised Jekyll but for Python. Who knows if it is dead now.
|
# ? May 30, 2014 00:59 |
|
I'll check both of those out. There's a huge number of static site generators out there, but they're plagued by one of two things: - actually being static blog generators, which would have though was the harder, more specialised task to just generating a consistent set of pages - weird configuration details and files. Why should I have to explicitly define the create and modified dates and the slug to be used in some arcane YAML markup? I mean, just by looking at the file you should be able to work all that out.
|
# ? May 30, 2014 09:49 |
|
outlier posted:- weird configuration details and files. Why should I have to explicitly define the create and modified dates and the slug to be used in some arcane YAML markup? I mean, just by looking at the file you should be able to work all that out. Basic key-value YAML is hardly arcane. And the post date does kind of need to be explicit somewhere. You can't use the file's mtime/ctime, as that could easily just be whenever your repo was checked out on whatever host is actually compiling the html. And you should be able to make edits without possibly affecting the page's URL (ie blog posts with the date in the URL).
|
# ? May 30, 2014 14:43 |
|
outlier posted:
I don't remember if Wok is for blogs primarily, but I used it entirely for a static-site that gets new pages about twice a year if that and is not in the least blog-like, and I remember that feeling pretty natural.
|
# ? May 30, 2014 15:30 |
|
It feels like you should be able to glue together some libraries to make your own task-specific static HTML generator in short order. Of course, I've learned to be wary of any project where I think that as about 70% of the time it actually takes me forever.
|
# ? May 30, 2014 15:34 |
|
outlier posted:Alternatives? I've looked at Nikolai (too-blogish), Hyde (blogish), and several others (being blogish or needing you to write in HTML or YAML, etc.) So what I'd really like is something Pythonic, using restructured text or Markdown or the like, that handles pages not posts / blog entries. I got quite far with Pandoc. The problems you'll face are that: markdown is clumsy for syntax extensions and every tool speaks a different dialect, rst is good for longer structured text, but crap for smaller things and a bit clunky in places, and every single one of the tools will probably break in mysterious ways. Enjoy!
|
# ? May 30, 2014 16:19 |
|
I have a regex with named groups and a string whose pattern to match can be repeated multiple times. Example: code:
code:
code:
I could just take the match object, look at its 'end' method and compare it with the length of the string to match, and slice it from that index, and run the pattern match again on the substring; but I imagine there is a better way to accomplish this. edit: did just that. salisbury shake fucked around with this message at 22:18 on May 30, 2014 |
# ? May 30, 2014 19:57 |
|
Thermopyle posted:It feels like you should be able to glue together some libraries to make your own task-specific static HTML generator in short order. ended up with a ~40 line script using python markdown that does exactly what I wanted. it's brittle as all hell but who cares it's just for me.
|
# ? May 30, 2014 21:30 |
|
Alligator posted:yeah I went down the static site generation road a while ago for a blog with with some extra stuff and most of them seemed much more complex than they needed to be. I just started looking into this for one of my projects and found http://metalsmith.io. Node.js so fits in with the rest of my front end build processes without adding any system dependencies, and I sort of like the barebones approach to static site generators that doesn't try to tell you what you want.
|
# ? May 30, 2014 22:02 |
|
I'm having trouble understanding how to implement a workaround for Tkinter not having control over key holds vs. repeated key presses. As I understand it, the workaround is something like this:code:
|
# ? May 31, 2014 03:25 |
|
I didn't get any responses on this the first time around, and this kind of design has come up again and I'm thinking about it. Isn't this fairly common when you use composition, to "outsource" a protocol to an attribute? I find myself doing this a lot, and while I've never tried to do something tricky like the loops in this quote, I can't help but think there's some O-O concept I'm missing, or if not then there's an opportunity for syntactic sugar. SurgicalOntologist posted:Is there a way to define an attribute of a class, and say "when something tries to use an arithmetic operation on me, use this" or "when someone tries to use the sequence protocol on me, use this". gently caress it... let's try a class decorator: Python code:
|
# ? Jun 2, 2014 20:29 |
|
Welp, made it into an afternoon project and even uploaded it to PyPi. https://github.com/hsharrison/smartcompose Good thing, bad thing?
|
# ? Jun 3, 2014 01:35 |
|
I need to validate the a ton of csv files before they get converted to JSON and passed to an API. I was going to use csvvalidator, but is there something better I should look at? Edit: I guess that I'm going to also be receiving XML too if that changes anything. EAT THE EGGS RICOLA fucked around with this message at 00:15 on Jun 4, 2014 |
# ? Jun 4, 2014 00:00 |
|
Would you like to play a game?code:
code:
|
# ? Jun 4, 2014 12:27 |
|
|
# ? May 30, 2024 16:47 |
|
Try upgrading pip
|
# ? Jun 4, 2014 13:53 |