|
Empress Brosephine posted:So I finished Python Crash Course and loved it; what should I read next to improve my skills? Get a job using it.
|
# ? Jun 4, 2019 01:50 |
|
|
# ? May 27, 2024 21:03 |
|
Empress Brosephine posted:So I finished Python Crash Course and loved it; what should I read next to improve my skills? Is it worth learning more than the blade level of skills with Flask? Find a project you want to do to solve some problem and do it.
|
# ? Jun 4, 2019 02:24 |
|
I like Click but I don't like stacking up ten different decorators. Are there any good examples of Click based interfaces but created programatically without decorators?
|
# ? Jun 4, 2019 10:20 |
|
Boris Galerkin posted:I like Click but I don't like stacking up ten different decorators. Are there any good examples of Click based interfaces but created programatically without decorators? You can write a decorator that applies decorators.
|
# ? Jun 4, 2019 17:43 |
|
Thermopyle posted:You can write a decorator that applies decorators. New thread title?
|
# ? Jun 4, 2019 20:42 |
|
(Mis?)Using Jenkins to automate non-build manual processes e.g, refreshing tables, monitoring tasks with python. Should I shrug, clone down the repo, let pipenv or poetry or whatever install packages from scratch, just to run a script every half an hour?
|
# ? Jun 5, 2019 14:17 |
the yeti posted:(Mis?)Using Jenkins to automate non-build manual processes e.g, refreshing tables, monitoring tasks with python. Come again? And yeah that's an okay-ish use for Jenkins, we deliberated to do the same at my company too.
|
|
# ? Jun 5, 2019 15:53 |
|
cinci zoo sniper posted:Come again? And yeah that's an okay-ish use for Jenkins, we deliberated to do the same at my company too. Sorry, I mean to say it seems like extra complexity or convolution to have Jenkins rebuild a python virtual environment from scratch every time it goes to execute a script.
|
# ? Jun 5, 2019 16:38 |
|
the yeti posted:Sorry, I mean to say it seems like extra complexity or convolution to have Jenkins rebuild a python virtual environment from scratch every time it goes to execute a script. Like when it's making a build which will be deployed or make a virtual env literally each time you run butts_check.py? I use the concept of the virtual environment to limit all the bullshit cruft years of python use does to an OS. If you rebuild the virtual env and do the jenkin pulls for the bare minimum libraries it needs to run the package, then you are getting rid of debug/testing/just bullshit libraries that really should not be in production
|
# ? Jun 5, 2019 16:48 |
|
EVIL Gibson posted:Like when it's making a build which will be deployed or make a virtual env literally each time you run butts_check.py? I was thinking of your latter example— I might be misunderstanding how Jenkins works as it was literally just dropped in my lap to figure out, but I understood that each time it ran a task it was in a clean, isolated work area, hence the need to rebuild the virtual environment each time.
|
# ? Jun 5, 2019 16:57 |
|
Rebuilding it is fine. Virtualenvs are at their best when they're ephermal.
|
# ? Jun 5, 2019 20:18 |
|
Thermopyle posted:Rebuilding it is fine. Those who've used Poetry: What do you think compared to Pipenv? Any warts like Pipenv's slow locking and dependency-resolution probs? Dominoes fucked around with this message at 21:28 on Jun 5, 2019 |
# ? Jun 5, 2019 21:25 |
|
Dominoes posted:Those who've used Poetry: What do you think compared to Pipenv? Any warts like Pipenv's slow locking and dependency-resolution probs? The thing I really dislike about poetry right off the bat is that if you search for a package like sqlalchemy during the init process, you max out the search result list with every random fork out there and seemingly have no way to pick the right one. It also crashes if you try to guess the actual package name 3 times.
|
# ? Jun 5, 2019 21:37 |
|
Dominoes posted:I think the intent behind Poetry, Pipenv, and related features in PyCharm is to abstract them. I don't like directly micromanaging them; feels like a hassle. The only information required to set up a project's dependencies should be a config file that mainly lists dependencies, like pipfile, pyproject.TOML etc. Shouldn't have to manually create/destroy/activate/deactivate environments. Yeah. All this manually creating, activating, deactivating environments and installing packages is all kind of bullshit that I don't want to have to care about. What I'd like is if I could have a config file in a project directory and then anything run from that directory uses the packages and interpreter version specified in the config file. I don't care how it does it behind the scenes, just take care of it for me. If I type the command to "install" a package the main point of that command should be to add that package to the config file. Whether it installs it at that time or not is not very important to me. If I specify an interpreter that is not on my system, then it should set that up. The python command should really be just a script that checks the config file in the current working directory and sets the environment up as required. No one has done this completely yet and it makes me sad.
|
# ? Jun 5, 2019 22:29 |
|
Thermopyle posted:The python command should really be just a script that checks the config file in the current working directory and sets the environment up as required. I have a run.sh script that I copy around from project to project that does almost exactly this. Sometimes I add in a few project specific environment variables, but other than that been pretty much unchanged since I originally wrote it like 7 years ago. Not the most elegant solution but it works for me.
|
# ? Jun 5, 2019 22:46 |
|
Thermopyle posted:No one has done this completely yet and it makes me sad. Nippashish posted:I have a run.sh script that I copy around from project to project that does almost exactly this.
|
# ? Jun 6, 2019 03:01 |
|
Dominoes posted:What do you suppose the technical limitations on this are? I haven't looked into it in detail, but just from various things I've read over the years I think it's like a lot of open sores software... It's not exactly technical limitations that are the blockers here. It's more that no one has taken a lead on idea, investigated all the edge cases, done a bunch of experimentation, done advocacy to get stakeholders on board, etc. Doing all of that is not always enough to get stuff done, sometimes technical limitations rear their head whilst in the process of all of that (see Larry Hastings and his work on the GIL), but all that stuff is really the first blocker on most of the things we think python (and not just python) should do or have but does not. I don't want to dismiss the technical side, but my understanding is not that there are insurmountable obstacles that require The Master Programmer to solve, just that there are a bajillion edge cases to address. I mean, look at the tools that are kinda similar to what I propose. pipenv and poetry both have been worked on for years and still are kinda clunky in a lot of ways. Now that I write it down it kinda makes me want to take the lead. On the other hand, I always get irritated when I have to start delving into the guts of python packaging for whatever reason... Nippashish posted:I have a run.sh script that I copy around from project to project that does almost exactly this. Sometimes I add in a few project specific environment variables, but other than that been pretty much unchanged since I originally wrote it like 7 years ago. It's funny you say that and really that this whole subject has come up now. I've recently been really customizing my powershell prompt (based on oh-my-posh), environment, aliases, etc and it's gotten me thinking about tackling this whole issue.
|
# ? Jun 6, 2019 03:51 |
|
Thermopyle posted:Pipenv and poetry both have been worked on for years and still are kinda clunky in a lot of ways. quote:Now that I write it down it kinda makes me want to take the lead. Dominoes fucked around with this message at 11:19 on Jun 6, 2019 |
# ? Jun 6, 2019 03:56 |
|
The PEP for a local packages directory at least seems like a promising step forward.
|
# ? Jun 6, 2019 04:00 |
|
skull mask mcgee posted:The PEP for a local packages directory at least seems like a promising step forward.
|
# ? Jun 6, 2019 04:03 |
|
I have a form on a site that I would like to be able to swipe a credit card and then use the data to auto fill the forms (first name last name expir etc). Is this possible? I wrote the code that can decipher the data of the card swipe and assign it to variables I just can’t figure out a way to auto fill a form without submitting it. Thanks goons
|
# ? Jun 6, 2019 23:56 |
|
Oh man, it sounds like you're opening yourself to a large host of legal and financial troubles. Just integrate Stripe or BrainTree into your frontend. Handling credit card data yourself opens you to PCI audits and all sorts of headaches.
|
# ? Jun 7, 2019 01:49 |
|
It’s actually for employee ids, I think credit card just made it make more sense? Does that sound right? Lol. E; to clarify the cards store full name and worker ID, it would just be a way for them to “log In “ easier Empress Brosephine fucked around with this message at 01:55 on Jun 7, 2019 |
# ? Jun 7, 2019 01:52 |
|
Empress Brosephine posted:It’s actually for employee ids, I think credit card just made it make more sense? Does that sound right? Lol. Basically you need a mag-stripe reader? Or are they RFID? Either way, have you checked with the reader manufacturer? They may have an API you can use to read data events from the reader.
|
# ? Jun 7, 2019 02:35 |
|
Empress Brosephine posted:It’s actually for employee ids, I think credit card just made it make more sense? Does that sound right? Lol. Oh. Well, this will be a javascript thing, not a python thing, since it will have to be done in the browser. You'll have to check with the reader manufacturer for API documentation.
|
# ? Jun 7, 2019 02:50 |
|
Most mag stripe/swipe readers/barcode scanners pretend to be keyboards and spit out characters really fast on a successful read - is that the case here? Open up notepad and swipe an ID. If so your job is handling input, which is probably a heck of a lot easier than integrating with device drivers/API Regardless it would still be javascript as Thermopyle said, since this is all happening client-side.
|
# ? Jun 7, 2019 05:27 |
|
I’ll check out javascript then. Yeah it’s just taking the keyboard read from the usb card swiped.
|
# ? Jun 7, 2019 10:59 |
|
The reader can probably also be programmed to throw in arbitrary keyboard signals or characters after a successful swipe, things you can then listen directly for in javascript to process events.
|
# ? Jun 7, 2019 16:03 |
|
Ahz posted:The reader can probably also be programmed to throw in arbitrary keyboard signals or characters after a successful swipe, things you can then listen directly for in javascript to process events. Is this something you can set? So you could have it emit a pair of UTF-8 poop emojis at the end of a swipe and then check for that?
|
# ? Jun 7, 2019 20:19 |
|
QuarkJets posted:Is this something you can set? So you could have it emit a pair of UTF-8 poop emojis at the end of a swipe and then check for that? Depends on the vendor. Most scanners I see which emulate a keyboard have docs on how to do so.
|
# ? Jun 7, 2019 20:31 |
|
Type hinting! I have: def myfunc() -> Dict[str, Tuple[pendulum.Date, pendulum.Datetime, pendulum.Datetime]]: #blah The tooltip when I mouse over it in pycharm gives: def myfunc() -> Dict[str, Tuple[Date, Any, Any]] How do I tell if I’m not doing that correctly, or if it’s a quirk in pycharm, or in pendulum?
|
# ? Jun 11, 2019 14:43 |
|
You’re doing it correctly, assuming your dict maps a string to a tuple of 3 things. The type hunter in pycharm just doesn’t know what those pendulum types are, probably because the pendulum author(s) haven’t included a file with that information.
|
# ? Jun 11, 2019 15:48 |
|
Thanks, yeah I’m not too familiar with grownup packaging, so there’s a file the package should feed the type hinter for those things ?
|
# ? Jun 11, 2019 16:07 |
|
the yeti posted:Thanks, yeah I’m not too familiar with grownup packaging, so there’s a file the package should feed the type hinter for those things ? It's just that pendulum hasn't specified types for the stuff. You can fix it yourself by creating type stubs if you want.
|
# ? Jun 11, 2019 17:10 |
|
Using third-party packages in optionally-typed languages raises inconveniences like this.
|
# ? Jun 11, 2019 17:47 |
|
I may have been hit by a pip typesquatting attack. I only just noticed it. There was a file in my home called "typesquating-attack" with that spelling. The contents said something like "You have been hacked since" followed by the date and time. April 4th. I just shut it down after seeing that. I have a suspicion it may have been from a package I accidentally installed and removed shortly after called "tensoflow". Any tips on this? e: looks like the package was removed from pypi e: again. It's supposed to be typosquatting. A typo in typosquatting for a post about a typosquatting attack with a typo in typosquatting. General_Failure fucked around with this message at 01:21 on Jun 21, 2019 |
# ? Jun 17, 2019 02:34 |
|
General_Failure posted:I may have been hit by a pip typesquatting attack. Thanks for posting about this, I didnt know this was a thing.
|
# ? Jun 17, 2019 02:55 |
|
CarForumPoster posted:Thanks for posting about this, I didnt know this was a thing. Neither did I until today. I'm going to be a bit more observant with my typing in the future.
|
# ? Jun 17, 2019 03:54 |
|
CarForumPoster posted:Thanks for posting about this, I didnt know this was a thing. I swear I've posted warnings about this multiple times in this thread! THANKS FOR NOT READING MY WORDS! (or maybe I'm dreaming and only thought about posting this)
|
# ? Jun 17, 2019 18:41 |
|
|
# ? May 27, 2024 21:03 |
|
Looking into the easiest way to make a headerless window appear as an overlay on key press. I'm thinking just make two separate threads and have the window check a global for keypress every so often. I've done this with pyfirmata updating a graph on pulse trigger but that was more of a time factor thing Tkinter I think can do it, I've considered qt5 but that introduces a lot of complexity for a tiny 100x300 window. I started going down the ctypes route to just draw an overlay directly but that's probably a bit too much. Anyone ever made something like this? Edit: I take that back. I used matplotlib and in my loop paused every 0.001 to poll keypress info and redraw accordingly. That worked well and is reasonably intuitive Edit2: yeah tkinter is fine I just gave it a thread and used the always amazing lib called keyboard mbt fucked around with this message at 20:30 on Jun 17, 2019 |
# ? Jun 17, 2019 19:50 |