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
cinci zoo sniper
Mar 15, 2013




PyCharm starts into a previously opened, mostly empty, project in like 5 seconds for me (8700K, NVMe SSD, not sure if RAM clock matters here). My loading time bane for IntelliJ is DataGrip - I make a real mess of open consoles and have like 20 global data sources with rather hefty schemas so that takes a bit to chug through on each startup, loading 10-20-whatever tabs I left before clocking out the day before.

Adbot
ADBOT LOVES YOU

Hed
Mar 31, 2004

Fun Shoe
Does PyCharm still include the features from Webstorm that are good? In other words if I want to dork around with React and Django is it PyCharm or get the full Monty?

I tried PyCharm back in 2011 for purely Python and didn’t stick with it but I have a different flow now and I’m interested.

cinci zoo sniper
Mar 15, 2013




All the web, db, and remote stuff is in pro edition. https://www.jetbrains.com/pycharm/features/editions_comparison_matrix.html

Fluue
Jan 2, 2008
When does it make more sense to create an object (or serialize a dict) vs creating a new dictionary with remapped fields from a source? I'm working with the Jira REST API and it returns things like customfield_1389235 for any fields created in the Jira admin panel.

I only need a subset of the fields, and there is a way to get only a subset of the fields from a Jira Issue resource, but I need to handle a handful of Issue types that have different field requirements (e.g. TicketTypeA needs favorite_color and user_locale, but TicketTypeB needs car_make. Both have a core set of fields like user_id, status, etc).

If I made objects there wouldn't be any special methods on them because my application is mostly reading data from the Issue or adding data to fields that come in empty and then calling back to Jira to update the Issue.

cinci zoo sniper
Mar 15, 2013




I don’t think I understand your question fully, but the task itself looks like the use case data classes primarily exist for.

mbt
Aug 13, 2012

Fluue posted:

When does it make more sense to create an object (or serialize a dict) vs creating a new dictionary with remapped fields from a source?

In your case I'm not sure theres a difference besides how you're calling them?

E. Classes might make more sense organizationally though

Extortionist
Aug 31, 2001

Leave the gun. Take the cannoli.

mr_package posted:

I'm writing a CRUD app and need to decide on my data storage format. I've started with XML but both native xml and lxml are really bad to work with. I've read the XPATH docs for lxml a hundred times and still cannot search the tree for a specific node. Should I just use JSON instead? YAML? I've used Python's json library before and IIRC converting to a dictionary was really easy, and once you have that working with the data is really easy.

It's frustrating because the data I'm working with formats well into XML. But my productivity is in the toilet fighting with lxml. Is there a point where it clicks, if I keep at it?
If you have to use XML for some reason, use BeautifulSoup--it's mainly for working with HTML, but works just as well with xml. It wraps all the functionality of lxml/etc in a pretty intuitive package, like finding specific nodes can be as easy as 'target_node = document.parent_node.target_node' or 'target_node = document.find("target_node")'.

If you aren't getting anything out of using XML over something else, just use JSON.

NinpoEspiritoSanto
Oct 22, 2013




cinci zoo sniper posted:

I don’t think I understand your question fully, but the task itself looks like the use case data classes primarily exist for.

Yeah I'd probably be breaking attrs out for this

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

cinci zoo sniper posted:

PyCharm starts into a previously opened, mostly empty, project in like 5 seconds for me (8700K, NVMe SSD, not sure if RAM clock matters here). My loading time bane for IntelliJ is DataGrip - I make a real mess of open consoles and have like 20 global data sources with rather hefty schemas so that takes a bit to chug through on each startup, loading 10-20-whatever tabs I left before clocking out the day before.

Hmm, I'll have to do more troubleshooting on this. It used to open just as quick for me, but now it takes 30+ seconds.

On the other hand, the good part of having 32GB of RAM is that I basically never close PyCharm or any other program so startup time is rarely an issue.


Hed posted:

Does PyCharm still include the features from Webstorm that are good? In other words if I want to dork around with React and Django is it PyCharm or get the full Monty?

I tried PyCharm back in 2011 for purely Python and didn’t stick with it but I have a different flow now and I’m interested.

Yes, I've been doing lots of React and Django work in PyCharm Pro for the past couple years.

PyCharm is almost a strict superset of WebStorm. The only time WebStorm has something that PyCharm doesn't is when WebStorm gets a new feature release and PyCharm hasn't yet done a new release pulling in those new features.

cinci zoo sniper
Mar 15, 2013




Yeah same, both computers I use Pycharm on primarily have 16 GB RAM so the only cases when I have to restart it during the work day is if I accidentally hard lock or OOM myself especially well, which hasn’t happened in a year by now.

I’d probably check what my plugins are doing if I had your problem - my setup is rather light on those and the only heavy/complicated thing enabled is SonarLint.

Fluue
Jan 2, 2008

Meyers-Briggs Testicle posted:

In your case I'm not sure theres a difference besides how you're calling them?

E. Classes might make more sense organizationally though

I might be overthinking it then. I do have a sort of "single table inheritance" going on with my classes that deal with the Jira API (which returns everything unless explicitly filtered with query params) because the application is highly dependent upon the ticket types that come in from Jira. I'll need to rethink this, but classes are probably the way to go.

Thanks!

cinci zoo sniper
Mar 15, 2013




Cruious - what do you guys think of PEP 572?

the yeti
Mar 29, 2008

memento disco



cinci zoo sniper posted:

Cruious - what do you guys think of PEP 572?

I just glanced at it but my off the cuff thought is that facilitating code density isn’t admirable in itself.

I’ll read over in detail after work.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

cinci zoo sniper posted:

Cruious - what do you guys think of PEP 572?

Ehh, I don't think it was necessary and its ugly and I agree with a lot of the detractors points, but I can think of situations where I'd use it over the alternatives.

There was/is a lot of vitriol over it, but...get a life people!

I've already used it in some demo programs on 3.8.

mbt
Aug 13, 2012

cinci zoo sniper posted:

Cruious - what do you guys think of PEP 572?

:= is off-centered on 99% of typefaces which gives me anxiety

OnceIWasAnOstrich
Jul 22, 2006

There are some situations where it will be very handy, and a whole bunch of examples that make me angry to look at.

breaks
May 12, 2001

OnceIWasAnOstrich posted:

There are some situations where it will be very handy, and a whole bunch of examples that make me angry to look at.

I think they took a few of the more egregious examples out of the pep but early on there was sure some wow really!? stuff in there.

It does clean up some situations real nice though. :shrug:

Loving Africa Chaps
Dec 3, 2007


We had not left it yet, but when I would wake in the night, I would lie, listening, homesick for it already.

I like that it's called the walrus :3:

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

cinci zoo sniper posted:

Cruious - what do you guys think of PEP 572?

I feel like it's a terrible idea but I'll surely use it sometimes, it's a feature I abuse a lot in C anyway so...

It'll be just like how I use for-else sometimes. It's terrible and dumb but sometimes while typing code I just don't give a poo poo. If the python devs wish to enable my inner perl coder then gently caress the police.

edit: https://twitter.com/symbolicbutt/status/1024783816186060800

Symbolic Butt fucked around with this message at 09:43 on Mar 27, 2019

the yeti
Mar 29, 2008

memento disco



Re Tim Peters’ ‘essay’ at the bottom of the PEP, my spicy take is that if he or anyone are hurting for vertical line space in 2019 then they have problems that Python can’t fix.

cinci zoo sniper
Mar 15, 2013




PyCharm 2019.1 is out. Summary - revamped Jupyter integration; improvements for data classes, debugging, type checking, pytest.

Furism
Feb 21, 2006

Live long and headbang
I have a stupid question. I published a pip package and installed it on my machine (from pip). But when I try to use it, Python can't find it ("No module named 'cyberfloodClient'"). I'm sure I'm doing something really stupid, as I'm very new to Python and don't understand half of what I'm doing.

The package is here: https://pypi.org/project/cyberfloodClient/
The source is here: https://github.com/acastaner/cf-py-cfclient/blob/master/cyberfloodClient.py

And I try to import by doing

code:
import cyberfloodClient
Also tried

code:
from cyberfloodClient import CfClient
I have confirmed that it's installed:

code:
PS C:\Users\acastaner\Git\cf-py-cfclient> pip list
Package           Version
----------------- ----------
[blah]
cyberfloodClient  0.1
[blah]
Am I missing something?

mbt
Aug 13, 2012

Did you run the setup.py

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
I had a situation where I installed 3.8 from source and had 3.7 installed with apt, and pip would install packages for 3.7 instead. Try doing
code:
python3 -m pip install cyberfloodClient
instead.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

cinci zoo sniper posted:

PyCharm 2019.1 is out. Summary - revamped Jupyter integration; improvements for data classes, debugging, type checking, pytest.

The jupyter changes look good. Jupyter notebooks being better in firefox reallydecreased my use of pycharm even though, for .py files, I really liked pycharm.

https://www.youtube.com/watch?v=TIZH4aPSN2E

Furism
Feb 21, 2006

Live long and headbang

Meyers-Briggs Testicle posted:

Did you run the setup.py

I did :(

dougdrums posted:

I had a situation where I installed 3.8 from source and had 3.7 installed with apt, and pip would install packages for 3.7 instead. Try doing
code:
python3 -m pip install cyberfloodClient
instead.

I only have Python 3.7 installed :(

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I spent a dozen hours working on something that works better than pyautogui for Windows machines.

Then while Googlin' something else I found that pywinauto exists and incorporates 90% of what I wanted to do.

gently caress.

Aquarium of Lies
Feb 5, 2005

sad cutie
:justtrans:

she/her
Taco Defender

I believe setuptools.find_packages() only works with packages, so it's not actually finding and installing your .py file. Try either converting cyberfloodClient.py to a package (cyberfloodClient/ dir + cyberfloodClient/__init__.py) or using py_modules in your setup.py:
code:
setuptools.setup(
    ...
    py_modules=['cyberfloodClient'],
    ...
)

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
Don't update to PyCharm 2019.1 if you use a non-US/English keyboard or if you like the way your fonts are currently rendered in 2018.X

The new update breaks (seems like) every single keyboard layout that uses AltGr making it impossible to type in characters like # or brackets like {} and/or []. I had this happen to me and also if you look at JetBrains's issues site then it's just full of duplicated entries about this same problem.

Also another super annoying thing is that font rendering is completely different now. Using the same font, same settings, the font just looks super thin in the new version and it's doing this weird flickering thing where it goes from thin to not thin (but not as thick as 2018.x) which makes this program not useable. This was reported months ago in the EAP but apparently it's an intended feature. Now that the release version is out though and people are complaining they are "looking into it."

I’m really curious how the keyboard issue made it through review. I know most people use a US keyboard layout for programming but apparently JetBrains had absolutely zero people who used something different, despite being an Italian(?) company?

E: Czech not Italian.

Boris Galerkin fucked around with this message at 13:54 on Mar 28, 2019

the yeti
Mar 29, 2008

memento disco



What the gently caress how could that font nonsense be intended

vikingstrike
Sep 23, 2007

whats happening, captain

cinci zoo sniper posted:

PyCharm 2019.1 is out. Summary - revamped Jupyter integration; improvements for data classes, debugging, type checking, pytest.

Are you having any issues viewing DataFrames when working with a notebook? All other variable types open up fine for me except frames and it feels odd and most likely unique to me.

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!

the yeti posted:

What the gently caress how could that font nonsense be intended

I think I was too loose with my words. The new rendering is the feature, the flickering seems to be a bug (maybe? it didn't happen before I updated, and it went away after I downgraded). Not sure if they are related, but for the font rendering a dev said this in January.

quote:

This is expected behavior of the performance fix (JRE-1008). LCD shaders were used to render a ​grayscale bitmaps

From here.

Also it looks like it's only affecting macOS, and the workaround is to either downgrade back to 2018.x or to jump through some extra hoops to use a different version of Java.

Proteus Jones
Feb 28, 2013



Boris Galerkin posted:

Also it looks like it's only affecting macOS

Thank you for your sacrifice. I was going to install this later today. I guess I'll stick with 2018 until they roll out a fix.

cinci zoo sniper
Mar 15, 2013




vikingstrike posted:

Are you having any issues viewing DataFrames when working with a notebook? All other variable types open up fine for me except frames and it feels odd and most likely unique to me.

I haven’t tested 2019.1 yet, I’ve been stuck in database audit hell for 3 days straight, going schema to schema, table to table, field to field as this garbage does not have a written documentation. :v: Besides, not a fan of notebooks and haven’t used them in a long rear end while even for one off analytics.

Furism
Feb 21, 2006

Live long and headbang

Aquarium of Lies posted:

I believe setuptools.find_packages() only works with packages, so it's not actually finding and installing your .py file. Try either converting cyberfloodClient.py to a package (cyberfloodClient/ dir + cyberfloodClient/__init__.py) or using py_modules in your setup.py:
code:
setuptools.setup(
    ...
    py_modules=['cyberfloodClient'],
    ...
)

Cool thanks, will try!

What, uh, is the difference between a package and a module?

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
A package is a directory with at minimum a __init__.py module. A module is a python file.

Edit:

Proteus Jones posted:

Thank you for your sacrifice. I was going to install this later today. I guess I'll stick with 2018 until they roll out a fix.

Thanks for volunteering to give macOS users the a'ok to install it :v:

Boris Galerkin fucked around with this message at 08:57 on Mar 29, 2019

Furism
Feb 21, 2006

Live long and headbang
My project is just a Class that implements the actions of a REST API as functions. Is it it better to make it a package or a module? I'm not sure what the best practices are here :/

QuarkJets
Sep 8, 2008

it's up to you and how you feel like managing your code; you probably don't want 10,000 lines of code in 1 file and you also probably don't want to define a separate file for every 3 line function that you write, so just go with whatever feels right to you.

what feels right to me tends to work out to ~1000 line soft cap on single files but that could be higher or lower for someone else and i don't put any effort into enforcing that number, if a file looks too big then I think about whether it makes sense to split some of it up and if I know that I'm working on a project that will probably have a lot of code in it then I plan around that

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I almost completely ignore line counts for what goes in one file.

Think of modules and packages as just higher levels on the code-organization hierarchy that includes functions and classes.

In other words, you need to add a module or a package for many of the same reasons you'd use new functions and classes...to help you and others think about your code.

Adbot
ADBOT LOVES YOU

cinci zoo sniper
Mar 15, 2013




Same, my rule of a thumb for a file is to be able to coherently explain what’s in it using a single sentence.

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