Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord

Oysters Autobio posted:

Thanks, yeah I think my ask is a bit too hyper specific so I'll widen my question just a bit better.

Other than SA, what other social media or platforms are people using for learning python and programming in general?

I've been really frustrated lately that my go to learning strategy is still opening up Google first.

With Google I realized that I just keep finding the same SEO-padding blogs that actually say next to nothing in terms of actually useful tutorials. Just feels like they're all either banal generalities about why x is better than y. And because of the SEO algo, every single startup, open source project or even indie devs have to min-max social media marketing with just banal blog posts about how "LoFi-SQL is totally the best new approach. LoFi-SQL is a database approach adopted in repos like <OPs_Project>".

Reddit and HN feel the same way because the useful threads are buried deep in scattered posts. Say what you want about megathreads but at least they're oriented around categories and topics. Reddit et al just feels like having to sort through endless small megathreads generated by the same repos, or on the other hand lurkers who are just trying to figure out wtf is LoFi-SQL and why it's part of the neomodern data stack.

Any good subreddits, forums, bulletin boards, or hell I'll get into listserv or mailing lists or w/e but just some places where people actually discuss how they do stuff in python.

Can't believe this dumb web 1.0 comedy forum has some of the best technical resources I've been able to find, so I'll take any suggestion even if it's a sub forum for New York renters that happens to have a decent tech community.

If you are actually in New York, there's an NYC Python meetup that used to be very active in-person. They switched over to a Discord for pandemic times, but seem to be getting back into in-person events. I got my first real job by going to one of their meetups and just talking to a guy almost a decade ago. Could be worth looking into (they do a bunch of general stuff, not primarily a job-getting group).

Adbot
ADBOT LOVES YOU

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

Zoracle Zed posted:

this poo poo sucks so bad and it's depressing how it's never going to get better

Welcome to ChatGPT which is going to make it actively worse!

The March Hare posted:

If you are actually in New York, there's an NYC Python meetup that used to be very active in-person. They switched over to a Discord for pandemic times, but seem to be getting back into in-person events. I got my first real job by going to one of their meetups and just talking to a guy almost a decade ago. Could be worth looking into (they do a bunch of general stuff, not primarily a job-getting group).

Oh hey I never thought about this; there's a branch in Puget Sound as well apparently. https://www.pspython.com/

Macichne Leainig
Jul 26, 2012

by VG

Falcon2001 posted:

Welcome to ChatGPT which is going to make it actively worse!

I've already used it to fill in a bunch of copy on an ironic shitpost website project I'm working on.

It's absolutely perfect for that useless text drivel (not to be confused with my posts)

StumblyWumbly
Sep 12, 2007

Batmanticore!
Does anyone know any examples of well put together GUIs in Python? I'm mostly a Python hack, and I've got an older wx Python program, and it feels like the presenter (wx.App object) is doing too much work. Like I'll have a separate object that keeps a list of books, and then get_scifi_books() will be defined in the Presenter object. Maybe it doesn't matter because Presenter is the only one using the function, but it feels like I could add in more testing and stuff if get_scifi_books() was defined in a separate object that keeps the books. But then that leaves Presenter mostly empty.

How far does that rabbit hole go? If I want to have 3 buttons for get sci-fi, get history, get educational books, should I just have the book object return a list of button names and the associated functions, and the Presenter just blindly puts the list of buttons together?

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

StumblyWumbly posted:

Does anyone know any examples of well put together GUIs in Python? I'm mostly a Python hack, and I've got an older wx Python program, and it feels like the presenter (wx.App object) is doing too much work. Like I'll have a separate object that keeps a list of books, and then get_scifi_books() will be defined in the Presenter object. Maybe it doesn't matter because Presenter is the only one using the function, but it feels like I could add in more testing and stuff if get_scifi_books() was defined in a separate object that keeps the books. But then that leaves Presenter mostly empty.

How far does that rabbit hole go? If I want to have 3 buttons for get sci-fi, get history, get educational books, should I just have the book object return a list of button names and the associated functions, and the Presenter just blindly puts the list of buttons together?

A lot of that comes down to the framework you're using; I started getting into SimplePYGui and it has a lot of examples, but I haven't used WX directly.

Zugzwang
Jan 2, 2005

You have a kind of sick desperation in your laugh.


Ramrod XTreme
PySimpleGUI is legit. It’s basically ergonomic wrappers for the built-in Tkinter library. Not sure if it does everything you want, but it has a lot of demos and examples here: https://www.pysimplegui.org/en/latest/cookbook/

Oysters Autobio
Mar 13, 2017
I'm guessing you're talking about GUIs without getting into any web dev right? Cause if you're willing to go the web app route, Flask is a pretty great way to use python with some basic bootstrap html and CSS (uses Jinja templates for parametizing html)

Outside web dev, I've been curious to try out kivy for this since it claims to have a bit more modern looking UI

StumblyWumbly
Sep 12, 2007

Batmanticore!
I've heard good things about Kivy but haven't tried it. PySmpleGUI sounds right up my alley for a lot of the basic, internal stuff I'm doing. This is all for running local programs so flask may not be the best.
I'm a little worried that WxPython may fall seriously behind. It didn't move to python 3 until 3.5 or something, it sounds like not many folks use it, and it just looks like Windows NT.
If I want to do fancy guis, is qt more the way to go or should I just not use python?

QuarkJets
Sep 8, 2008

Qt is probably the best gui framework I've used, its power is pretty limitless and it's in such high demand that there are 2 competing python packages.

The biggest advantage of Qt is probably Qt Designer, it's fully interactive and highly robust. It makes a lot of sense to design guis in a gui. Whenever you're happy with the result you can save off a ui file that you load in your code

Oysters Autobio
Mar 13, 2017
Yeah I've yet to see any Python based GUI not just look like a slightly more modern version of Visual Basic. Like all the examples in qt designer or tkinter all just scream Microsoft office modal box. I think unfortunately we've all been exposed to too many web based GUIs which have defined the aesthetic and UX expectations in the past decade of "everything-as-a-webapp". Though it's surprising because all that it takes is some thicker/heavier input boxes, minimal gradients/colors/container lines, some highlight responsiveness and heavy padding so that your GUI looks less like this




and more like this:



Granted the latter is a React front end but still surprising you need these godawful webpack javascript monstrosity compilers to do anything in the front end but that's the web for you 🤷. The ppl who work on this as their day job all use javascript now so it's the most supported even if it's garbage.

Only exception as far as python based that I've seen is a few front end libraries like plotly Dash and streamlit. Granted these are aimed at the data world so I dunno how useful they are for anything more complex than a demo app.

If it's just as an internal tool another bit earlier option are Jupyter notebooks with ipywidgets and other ipython based widget libraries. ipyvuetify for example looks great. Google's collaboratory makes the best looking notebooks though they're all cloud based. If you still like working out of an IDE you can get VS Code extensions for them too.

Oysters Autobio fucked around with this message at 08:45 on Mar 9, 2023

Tyshalob
Apr 10, 2008

om nom nom i eat ur town


I hope it's cool if I ask for some homework help in here. The assignment I'm working on is to basically calculate costs using a for loop for the outer loop and a while loop for the inner loop. I've got to the point where the program functions but I've messed something up somewhere causing the total_degree_credits variable is losing credits somehow.

code:
TUITION_FEE = 102.00
FACILITY_FEE = 12.00
ACTIVITY_FEE = 3.00
GRADUATION_FEE = 42.50

for semester in range(6):
     credit = 1
     total_term_credits = 0
     total_degree_credits = 0
     while credit >= 1:
         credit = float(input('Enter credits for Course (enter 0 to quit) '))
         total_term_credits += credit
         total_degree_credits += total_term_credits
         term_tuition = total_term_credits * TUITION_FEE
         term_facility = total_term_credits * FACILITY_FEE
         term_activity = total_term_credits * ACTIVITY_FEE
         term_cost = term_tuition + term_facility + term_activity
     print()
     print('************ Totals for Semester ***********')
     print(f'Credits: 'f'{total_term_credits:.1f}')
     print(f'Tuition: $'f'{term_tuition:,.2f}')
     print(f'Facility Fee: $'f'{term_facility:,.2f}')
     print(f'Student Activity Fee: $'f'{term_activity:,.2f}')
     print(f'Total Cost $'f'{term_cost:,.2f}')
     print()
degree_tuition = total_degree_credits * TUITION_FEE
degree_facility = total_degree_credits * FACILITY_FEE
degree_activity = total_degree_credits * ACTIVITY_FEE
degree_fees = degree_facility + degree_activity
total_cost = degree_tuition + degree_fees + GRADUATION_FEE
print('************** Degree Total ******************')
print(f'Credits: 'f'{total_degree_credits:.1f}')
print(f'Tuition: $'f'{degree_tuition:,.2f}')
print(f'Total Fees: $'f'{degree_fees:,.2f}')
print(f'Total Tuition Cost: $'f'{total_cost:,.2f}')
Yes I know my code is poo poo. I'm just learning. Can somebody point me in the right direction?

QuarkJets
Sep 8, 2008

Oysters Autobio posted:

Yeah I've yet to see any Python based GUI not just look like a slightly more modern version of Visual Basic. Like all the examples in qt designer or tkinter all just scream Microsoft office modal box. I think unfortunately we've all been exposed to too many web based GUIs which have defined the aesthetic and UX expectations in the past decade of "everything-as-a-webapp". Though it's surprising because all that it takes is some thicker/heavier input boxes, minimal gradients/colors/container lines, some highlight responsiveness and heavy padding so that your GUI looks less like this

Qt defaults to using the local system theme, so by default it looks Windows-like on Windows, or Mac-like on Mac, etc. That's actually a big part of the curb appeal, you get a lot of professionalism by default because that's usually what a GUI developer wants. But it's not limited to system themes, you can drop in anything you want (there are tons of cool looking themes in *nix) and make entirely custom things too.

Spyder uses Qt, I think it looks pretty good but it's pretty system-y. And then you've got Dropbox, which has a bit of a more modern look

QuarkJets
Sep 8, 2008

Tyshalob posted:

I hope it's cool if I ask for some homework help in here. The assignment I'm working on is to basically calculate costs using a for loop for the outer loop and a while loop for the inner loop. I've got to the point where the program functions but I've messed something up somewhere causing the total_degree_credits variable is losing credits somehow.

The only way I can see that happening is if the user provides a negative number of credits. That's a real potential bug - you could check for that; if credit is less than 0 just set it to 0.

Can credits really be a float? I feel like it should be an int.

Python code:
credit = int(input('Enter credits for Course (enter 0 to quit) '))
Here's another suggestion, all of those quantities that you're setting with an equals sign inside of the loop - those could be moved outside of the loop, you're overwriting them every time anyway.

Python code:
for semester in range(6):
     credit = 1
     total_term_credits = 0
     total_degree_credits = 0
     while credit >= 1:
         credit = float(input('Enter credits for Course (enter 0 to quit) '))
         total_term_credits += credit
         total_degree_credits += total_term_credits
     term_tuition = total_term_credits * TUITION_FEE
     term_facility = total_term_credits * FACILITY_FEE
     term_activity = total_term_credits * ACTIVITY_FEE
     term_cost = term_tuition + term_facility + term_activity
This should give you the same result either way

e: I think total_degree_credits should also be outside of the for loop, it feels like it's double-counting earlier credit inputs otherwise. Isn't it true that degree_cost should be equal to the sum of all of the term_costs?

QuarkJets fucked around with this message at 10:36 on Mar 9, 2023

Oysters Autobio
Mar 13, 2017

QuarkJets posted:

Qt defaults to using the local system theme, so by default it looks Windows-like on Windows, or Mac-like on Mac, etc. That's actually a big part of the curb appeal, you get a lot of professionalism by default because that's usually what a GUI developer wants. But it's not limited to system themes, you can drop in anything you want (there are tons of cool looking themes in *nix) and make entirely custom things too.

Spyder uses Qt, I think it looks pretty good but it's pretty system-y. And then you've got Dropbox, which has a bit of a more modern look

Ah okay that makes sense, though even Windows has moved away from the windows-like GUI and into something more minimalistic and modern. If I was a generalist developer (i.e. not exclusively frontend / GUI) then I could see the appeal since it just inherits the default look and therefore is functional without completely looking like a hacked together Excel VBA form.

I imagine with Qt you could do custom theming?

FISHMANPET
Mar 3, 2007

Sweet 'N Sour
Can't
Melt
Steel Beams
I'm not entirely sure how to phrase this question so my google searching is really missing the mark. I'm wondering if there's some kind of generic Python framework that will allow me to write a declarative statement about how a thing should look, and then gives me some kind of skeleton I can plug in to tell the framework how to make the changes needed. My specific usage is creating group entries in a particular tool. What I'd like is to have some definition of how the groups/folders should look, and then I can tell this "framework" how to read what exists, how to remove something, how to add something, and then I can just say "make it look like this" and the framework will figure out what needs to be deleted and what needs to be added.

Basically I'm looking for something like what Terraform or Ansible do (a declarative declaration of what the product should be, rather than an imperative declaration of how to make it) but either it doesn't exist, or I'm searching with the wrong words. "Declarative" isn't a helpful search term, because that has a specific meaning in programming that's different form what I'm looking for. Maybe there's no value in a framework that just helps decide went to create and when to delete, and anyone doing such a thing is better off just writing it all themselves. Or maybe the whole thing is a waste of time trying to make something extremely robust that only gets executed a few hundred times ever.

The Fool
Oct 16, 2003


If what you're working with is loaded into a dict would something like deepdiff work?

Tyshalob
Apr 10, 2008

om nom nom i eat ur town


QuarkJets posted:

The only way I can see that happening is if the user provides a negative number of credits. That's a real potential bug - you could check for that; if credit is less than 0 just set it to 0.

Can credits really be a float? I feel like it should be an int.

Python code:
credit = int(input('Enter credits for Course (enter 0 to quit) '))
Here's another suggestion, all of those quantities that you're setting with an equals sign inside of the loop - those could be moved outside of the loop, you're overwriting them every time anyway.

Python code:
for semester in range(6):
     credit = 1
     total_term_credits = 0
     total_degree_credits = 0
     while credit >= 1:
         credit = float(input('Enter credits for Course (enter 0 to quit) '))
         total_term_credits += credit
         total_degree_credits += total_term_credits
     term_tuition = total_term_credits * TUITION_FEE
     term_facility = total_term_credits * FACILITY_FEE
     term_activity = total_term_credits * ACTIVITY_FEE
     term_cost = term_tuition + term_facility + term_activity
This should give you the same result either way

e: I think total_degree_credits should also be outside of the for loop, it feels like it's double-counting earlier credit inputs otherwise. Isn't it true that degree_cost should be equal to the sum of all of the term_costs?

Unfortunately, yes, that has to be a float for the assignment. It's in the instructions that the credits must be stored as a float since later I have to add data validation for a range of 0 - 4.5. I'll take a peek when I get a second and give it a go with your suggestions. Thank you!

a foolish pianist
May 6, 2007

(bi)cyclic mutation

Tyshalob posted:

I hope it's cool if I ask for some homework help in here. The assignment I'm working on is to basically calculate costs using a for loop for the outer loop and a while loop for the inner loop. I've got to the point where the program functions but I've messed something up somewhere causing the total_degree_credits variable is losing credits somehow.

code:
TUITION_FEE = 102.00
FACILITY_FEE = 12.00
ACTIVITY_FEE = 3.00
GRADUATION_FEE = 42.50

for semester in range(6):
     credit = 1
     total_term_credits = 0
     total_degree_credits = 0
     while credit >= 1:
         credit = float(input('Enter credits for Course (enter 0 to quit) '))
         total_term_credits += credit
         total_degree_credits += total_term_credits
         term_tuition = total_term_credits * TUITION_FEE
         term_facility = total_term_credits * FACILITY_FEE
         term_activity = total_term_credits * ACTIVITY_FEE
         term_cost = term_tuition + term_facility + term_activity
     print()
     print('************ Totals for Semester ***********')
     print(f'Credits: 'f'{total_term_credits:.1f}')
     print(f'Tuition: $'f'{term_tuition:,.2f}')
     print(f'Facility Fee: $'f'{term_facility:,.2f}')
     print(f'Student Activity Fee: $'f'{term_activity:,.2f}')
     print(f'Total Cost $'f'{term_cost:,.2f}')
     print()
degree_tuition = total_degree_credits * TUITION_FEE
degree_facility = total_degree_credits * FACILITY_FEE
degree_activity = total_degree_credits * ACTIVITY_FEE
degree_fees = degree_facility + degree_activity
total_cost = degree_tuition + degree_fees + GRADUATION_FEE
print('************** Degree Total ******************')
print(f'Credits: 'f'{total_degree_credits:.1f}')
print(f'Tuition: $'f'{degree_tuition:,.2f}')
print(f'Total Fees: $'f'{degree_fees:,.2f}')
print(f'Total Tuition Cost: $'f'{total_cost:,.2f}')
Yes I know my code is poo poo. I'm just learning. Can somebody point me in the right direction?

You're setting total_degree_credits to 0 every semester. "total_degree_credits = 0" is what's resetting that value.

FISHMANPET
Mar 3, 2007

Sweet 'N Sour
Can't
Melt
Steel Beams

The Fool posted:

If what you're working with is loaded into a dict would something like deepdiff work?

Hmm, that might work. Unfortunately I got sucked into a different hyper-focus with this project so it might be bit before I can come back to this particular problem kicking around in the back of my head.

Falcon2001
Oct 10, 2004

Eat your hamburgers, Apollo.
Pillbug

FISHMANPET posted:

I'm not entirely sure how to phrase this question so my google searching is really missing the mark. I'm wondering if there's some kind of generic Python framework that will allow me to write a declarative statement about how a thing should look, and then gives me some kind of skeleton I can plug in to tell the framework how to make the changes needed. My specific usage is creating group entries in a particular tool. What I'd like is to have some definition of how the groups/folders should look, and then I can tell this "framework" how to read what exists, how to remove something, how to add something, and then I can just say "make it look like this" and the framework will figure out what needs to be deleted and what needs to be added.

Basically I'm looking for something like what Terraform or Ansible do (a declarative declaration of what the product should be, rather than an imperative declaration of how to make it) but either it doesn't exist, or I'm searching with the wrong words. "Declarative" isn't a helpful search term, because that has a specific meaning in programming that's different form what I'm looking for. Maybe there's no value in a framework that just helps decide went to create and when to delete, and anyone doing such a thing is better off just writing it all themselves. Or maybe the whole thing is a waste of time trying to make something extremely robust that only gets executed a few hundred times ever.

I'm not 100% grokking what you're putting down, but does https://docs.pydantic.dev/ at all line up with the sort of thing you're looking at?

nullfunction
Jan 24, 2005

Nap Ghost
Pydantic is more about data validation, not really applicable to the question as I understand it.

I'm unaware of any kind of generic declarative framework like that. The suggestion to use deepdiff is, in general, a good one -- I've used it in the past to root out differences in large dict structures and act upon those differences -- but the gap between "I want to declare how I want the world to look" and "now I have dictionaries that I can bounce against each other" is significant if you want to generalize things.

If you can't bend one of the existing tools like Ansible to your needs, you're probably going to have to build something. If you're going to build something, think really hard about whether or not you truly need it to be so flexible, especially if it

FISHMANPET posted:

only gets executed a few hundred times ever.

Slimchandi
May 13, 2005
That finger on your temple is the barrel of my raygun
For book recommendations, Fluent Python is a great point to look at. It really gets you into the nuts and bolts of the language, it was the point where I flipped around from learning Python based on using high level libraries (like pandas) and really understanding the data model from the ground up. It won't teach you a lot about design patterns though.

FISHMANPET
Mar 3, 2007

Sweet 'N Sour
Can't
Melt
Steel Beams
I'm quite familiar with Pydantic, since this is part of a project using FastAPI, which relies heavily on Pydantic. And that's not what I'm after here. As part of the application (so it can't really be some external tool) I'm managing groups and folders in this tool called Grouper (which is basically only in use at higher-ed institutions and the web API is terrible and there's nothing really in the ecosystem publicly outside the tool itself). For n departments, the application creates a structure in Grouper with about 15 groups spread out across a couple different folders. The groups needed have changed over time. So some departments have, for example, an access group to a service that no longer exists. When the tool creates a new department it doesn't create a group for that unused service, but the existing departments have those groups. And sometimes we might introduce a new service that needs a new group, and so we have to add that group to all the existing departments.

So I might define an ideal layout that's something like
code:
- dept X
    - folder 1
        - group 1
        - group 2
    - folder 2
        - group 3
        - group 4
And when I create a new department, I can implement that. But for historic reasons, maybe I've got a department that looks like

code:
- dept y
    - folder 1
        - group 1
        - group 2
    - folder 2
        - group 3
        - group 4
        - group 5
Except I've actually got 80 departments like that or something, where I want to delete all instances of group 5. Or I have a bunch of departments that don't have group 4 and I need to add it. And so I'd like to delete those "extra" groups and add the ones that aren't needed. I think the best bet is turning that structure read from Grouper into some structure that deepdiff can understand to compare against the ideal, and then use the "added" and "removed" values it outputs to figure out what to delete, and what to create.

The Fool
Oct 16, 2003


dehumanize yourself and write a terraform provider

FISHMANPET
Mar 3, 2007

Sweet 'N Sour
Can't
Melt
Steel Beams
It would be a very "me" thing to go in a couple of weeks from never touching terraform or go to learning go and writing a terraform provider.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
crossposting here because i honestly don't know the best place to ask Redis questions:

teen phone cutie posted:

i previously posted ITT about wanting to implement Redis for some paginated SQL queries and one suggestion was to request all the data and just store it as one object and just bust the cache when an item is updated or added (items cannot be removed at this time)

But i was thinking of another possible solution and i'd like to be sanity checked here. What I was thinking is:

1. create a factory function that will take page number and return a SELECT statement for a page of items
2. when calling my SELECT statements in whatever GET request, run the factory function with the requested page and store the returned query as the Redis key (if the Redis key/value doesn't already exists. if it does, just read from memory)
3. when adding/updating an item, run another SELECT query to get what page this item is going to be on and then execute the factory function again with the calculated page number to get what the SELECT statement is going to be and then nullify that Redis key/value

does this sound like it could work? am i overengineering this? i'm just really not sure how to properly use Redis with paginated data that can always be added to or updated

Twerk from Home
Jan 17, 2009

This avatar brought to you by the 'save our dead gay forums' foundation.
How much Python 2 are y'all living with? What's a sane expectation for carrying along Python 2 applications that don't have any change planned but are expected to keep working forever?

If we try and mandate Python 3 by decree but without getting everyone's hearts and minds onboard, there's going to be grumbling for all eternity. My own thoughts on it are that all code does end up being modified at some point, and the less often you encounter Python 2, the more likely you are to make mistakes in it. I'd like to port everything that runs in 2023 to Python 3, full stop.

I'm just tired. Tired of having to remember 2/3 differences, tired of collaboration failures where the two parties are on different Python versions and don't voice this at the start of a conversation, tired of ancient packages.

The March Hare
Oct 15, 2006

Je rêve d'un
Wayne's World 3
Buglord

Twerk from Home posted:

How much Python 2 are y'all living with? What's a sane expectation for carrying along Python 2 applications that don't have any change planned but are expected to keep working forever?

If we try and mandate Python 3 by decree but without getting everyone's hearts and minds onboard, there's going to be grumbling for all eternity. My own thoughts on it are that all code does end up being modified at some point, and the less often you encounter Python 2, the more likely you are to make mistakes in it. I'd like to port everything that runs in 2023 to Python 3, full stop.

I'm just tired. Tired of having to remember 2/3 differences, tired of collaboration failures where the two parties are on different Python versions and don't voice this at the start of a conversation, tired of ancient packages.

0 at work and 0 in personal projects, has been this way for many years.

Data Graham
Dec 28, 2009

📈📊🍪😋



Don't rely on "if it ain't broke don't fix it". Someday some dependency will have a critical vulnerability crop up (or SSL will break or something) and the py2-only library in your requirements.txt will not be updatable and you'll suddenly be on the hook to rewrite the entire thing in an hour.

Get out in front of everything before it happens.

Macichne Leainig
Jul 26, 2012

by VG
It's absolutely worth upgrading to Python 3, if not only for many of the recent improvements to Python 3. Besides, haven't the creators of Python practically been begging people to stop using 2 for a while now?

StumblyWumbly
Sep 12, 2007

Batmanticore!

Twerk from Home posted:

How much Python 2 are y'all living with? What's a sane expectation for carrying along Python 2 applications that don't have any change planned but are expected to keep working forever?

If we try and mandate Python 3 by decree but without getting everyone's hearts and minds onboard, there's going to be grumbling for all eternity. My own thoughts on it are that all code does end up being modified at some point, and the less often you encounter Python 2, the more likely you are to make mistakes in it. I'd like to port everything that runs in 2023 to Python 3, full stop.

I'm just tired. Tired of having to remember 2/3 differences, tired of collaboration failures where the two parties are on different Python versions and don't voice this at the start of a conversation, tired of ancient packages.
Haha, my company moved to Python3 like a year after support stopped for 2 and I thought we were way behind.

You are going to run into trouble hiring, and searching for answers will become harder and harder. You need to update. Interns should be able to do a big chunk of it, unless maybe you're doing something extra strange with low level objects or something.

QuarkJets
Sep 8, 2008

Twerk from Home posted:

How much Python 2 are y'all living with? What's a sane expectation for carrying along Python 2 applications that don't have any change planned but are expected to keep working forever?

If we try and mandate Python 3 by decree but without getting everyone's hearts and minds onboard, there's going to be grumbling for all eternity. My own thoughts on it are that all code does end up being modified at some point, and the less often you encounter Python 2, the more likely you are to make mistakes in it. I'd like to port everything that runs in 2023 to Python 3, full stop.

I'm just tired. Tired of having to remember 2/3 differences, tired of collaboration failures where the two parties are on different Python versions and don't voice this at the start of a conversation, tired of ancient packages.

0%. I forced this issue years ago and we never looked back

Don't waste another second of time on maintaining python2 code, 2to3 is a mature tool and works great. Use it, fix any lingering issues, and then drop python2 support forever.

Zugzwang
Jan 2, 2005

You have a kind of sick desperation in your laugh.


Ramrod XTreme
How reliable are modern Python-to-exe packages? I recently learned that a research tool I’ve been working on for my job might eventually need to be deployed to outside users, probably closed source. And due to IP reasons on their end, it can’t be a web app hosted on AWS or whatever because their data/results can’t be on a system outside of their company at any time.

StumblyWumbly
Sep 12, 2007

Batmanticore!

Zugzwang posted:

How reliable are modern Python-to-exe packages? I recently learned that a research tool I’ve been working on for my job might eventually need to be deployed to outside users, probably closed source. And due to IP reasons on their end, it can’t be a web app hosted on AWS or whatever because their data/results can’t be on a system outside of their company at any time.
I've used pyInstaller, there are times when it is a massive pain but once you get it working it is fine. Things to be aware of:
- Including non-Python files takes some effort, like if you need to load in some settings from a .json that you expect to be included in the EXE
- Create the exe from a venv that only has what you need, otherwise it may be huge
- It is fairly trivial to reverse "compile", the scripts are just zipped up with an Python executable, so don't expect to have any secrets there


E: ^^^ I'm curious, do you work in academia? What place has people that complain about needing to use Python 3?

StumblyWumbly fucked around with this message at 00:17 on Mar 17, 2023

CarForumPoster
Jun 26, 2013

⚡POWER⚡

StumblyWumbly posted:

I've used pyInstaller, there are times when it is a massive pain but once you get it working it is fine. Things to be aware of:
- Including non-Python files takes some effort, like if you need to load in some settings from a .json that you expect to be included in the EXE
- Create the exe from a venv that only has what you need, otherwise it may be huge
- It is fairly trivial to reverse "compile", the scripts are just zipped up with an Python executable, so don't expect to have any secrets there


E: ^^^ I'm curious, do you work in academia? What place has people that complain about needing to use Python 3?

You should never ever expect users to have a python install. Thats asking for it-works-on-my-computer hell. PyInstaller has worked well for me.

QuarkJets
Sep 8, 2008

Zugzwang posted:

How reliable are modern Python-to-exe packages? I recently learned that a research tool I’ve been working on for my job might eventually need to be deployed to outside users, probably closed source. And due to IP reasons on their end, it can’t be a web app hosted on AWS or whatever because their data/results can’t be on a system outside of their company at any time.

Is a container an acceptable answer? That may be even more secure and will definitely be easier to deploy and maintain

Foxfire_
Nov 8, 2010

StumblyWumbly posted:

I've used pyInstaller, there are times when it is a massive pain but once you get it working it is fine.

One problem with it is that CPython isn't prepared to be statically linked to things. When you package something with pyinstaller, it still uses the system's libraries for lots of things and they need to be compatible. Like on Linux, it won't try to package anything from /usr/lib or /lib. The target system needs a compatible libc

It works about as well as anything short of a container

QuarkJets
Sep 8, 2008

iirc Singularity containers are basically designed for this kind of situation, where you don't trust either the system owner or other users on the system. And you can build one from a docker container so you can get the best of both worlds

CarForumPoster
Jun 26, 2013

⚡POWER⚡

QuarkJets posted:

iirc Singularity containers are basically designed for this kind of situation, where you don't trust either the system owner or other users on the system. And you can build one from a docker container so you can get the best of both worlds

Never heard of this until now. That is fuckin' dope.

Adbot
ADBOT LOVES YOU

Zugzwang
Jan 2, 2005

You have a kind of sick desperation in your laugh.


Ramrod XTreme

StumblyWumbly posted:

I've used pyInstaller, there are times when it is a massive pain but once you get it working it is fine. Things to be aware of:
- Including non-Python files takes some effort, like if you need to load in some settings from a .json that you expect to be included in the EXE
- Create the exe from a venv that only has what you need, otherwise it may be huge
- It is fairly trivial to reverse "compile", the scripts are just zipped up with an Python executable, so don't expect to have any secrets there

CarForumPoster posted:

You should never ever expect users to have a python install. Thats asking for it-works-on-my-computer hell. PyInstaller has worked well for me.
Good to hear it's working reasonably well now. Being easy to reverse-engineer would be a dealbreaker though if I do need to make it closed-source.

QuarkJets posted:

iirc Singularity containers are basically designed for this kind of situation, where you don't trust either the system owner or other users on the system. And you can build one from a docker container so you can get the best of both worlds
That might be what I need, thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply