I’ve been thinking of checking out PyCharm for a while, and the fact that the amazing Paul Everitt works for them now finally triggered me into doing it. This is some random notes.
- PyCharm by default adds all files in the directory to the project, forcing you to exclude everything you don’t want. That makes a bit more work upfront when starting to use it for an existing project, which is fine, but when you work with very large projects it’s sometimes less than ideal. It would be really nice if it by default excluded directories that aren’t under version control.
- “Search Everywhere”, the search box you get up by pressing <Shift> twice most definitely does not search everywhere. In fact, it seems to always find everything except the piece of code I want to find.
- PyCharm claims to have zc.buildout support and you can choose a file to pick paths from, but it doesn’t work, and PyCharm continues to incorrectly claim that your dependencies aren’t installed.
- I miss the class and method dropdown boxes in WingIDE.
- Ctrl-Y maps to yank line, not redo. Annoying (but fixable)
- Where is revert to disk?
- Why is there no way to see if a file is modified compared to the disk?
- What? It doesn’t ask if I want to save when I close the file!? ARGH! It saves to disk directly! TURN IT OFF!
- Can’t I assign live templates to keys? I have to use a macro? Weird.
- I have to name the new files I create before I edit them? Weird. And they’ll end up where they end up, which seems to be in the same directory as the file you just opened. You can create files from the file browser as well, but you can’t make a new file and then save it outside the project directory… That’s just too weird.
After a month I’ve decided to go back to WingIDE, despite that it still randomly crashes when you change projects, an annoying bug that has been a constant for ten years now.
- Hovercraft! is a tool to make Prezi-style presentations from human-readable text files. Version 2.1 fixes a bunch of bugs, drops Python 3.2 support and adds support for having multiple css-files.
- svg.path is a collection of objects that implement the different path commands in SVG, and a parser for SVG path definitions. 2.1.1 adds an error-parameter to many functions so you can specify the amount of error you need in calculations, where a higher error means faster calculations.
- Pyroma tests your Python-project’s packaging friendliness. 2.0.0 changes how data is extracted from setup.py, and now works with pbr and other tools that extends distutils to store the metadata outside setup.py.
- tzlocal returns a tzonfo oject with the local timezone information. 1.2.1 is a bugfix release.
- Spiny tests your package under multiple Python versions, like tox, but I like it better. If you can run your tests with “setup.py test” and you have specified supported versions as package classifiers, you don’t need any project configuration. Version 0.5 is the first release that is usable, really.
- Skynet is a module that doesn’t want to die. It’s purpose is to demonstrate Python’s exit hooks and signal handling.
Here are some random notes on RHEL 7.1. Mostly complaints. I think also all complaints from my Fedora 20 post remains. As usual this is posted after I actually stopped using the distro I’m talking about.
In the “Installation summary” page you must first go to the lower right to turn on the network and then go to upper left for setting date and time, or “network time” (ie sync to a time server) will not be on. I don’t know if that settings is preserved after the installation too, but I don’t want to find out.
The box where you type in your desired hostname is really in a discreet location, it’s easy to miss, and then your system is called “locahost.localdomain”. Annoying.
The partitioning screen is highly confusing. Make sure you have backups, because you are likely to not know what you are actually doing, and even if you aren’t likely to erase a hard disk by mistake, you’ll be scared to death to press the install button.
You have to set a root password, as most GUI tools does not sudo, but runs as root. And if you set it to something different that your own password you will get confused and type the wrong one.
After install make sure you don’t have beta or htb the repos selected. It was selected by default for me, possibly because I use employee subscriptions. If you have that selected and run yum update it will upgrade you to 7.1 Beta.
I ran Fedora 20 on my laptop for over 6 months, and was not happy with Gnome Shell. As a result, I installed several shells on RHEL7, to try them out. I had many recommendations for Cinnamon, so even though it is was to archaic and windows-like for me, I figured maybe I could tweak it or install extras that would give me a more modern behavior with a dash/dock/launcher. Essentially I like Unity, but the effort to run Unity on Red Hat Linuxes seems to have died.
However, Cinnamon was consistently unstable. Often the screen would not turn on when I lifted the lid to unsuspend the computer. If it had turned off the screen to save power, sometimes the screen was just garbled pixels when it came back. The login screen started behaving weirdly. I don’t know why these things happened, the login screen is shown before Cinnamon is even started, but it only happened when I uses Cinnamon as the shell session.
I also tried Xfce, but it didn’t seem to do anything I wanted at all, and I couldn’t find any information on how to make it more modern.
I the decided to make another try with configuring Gnome Shell more to my liking, and after discussions with very helpful people at the #gnome-shell IRC channel, I got to know that a complete reworking of the notifications in Gnome Shell is underway. They are getting rid of the idiotic Message Area (or whatever it’s called) and moving notifications back to where they should be: Visible. Some of the other annoyances I had was also recognized as being so, and in at least one case actually a regression bug.
Between the time of writing and the time of publishing this, the new designs are done, and available in Fedora 22. It will take a long time to get into future RHELs, but perhaps some kind soul can backport future Gnome releases. Red Hat Enterprise Linux is primarily a server OS, so that it’s desktop lags behind Fedora is not surprising. I just hope that Red Hat can incorporate a newer version of Gnome Shell quickly, so that RHEL can compete as a desktop as well.
Still, while waiting for that day to come, there are things you can do to lower the pain of Gnome Shell on RHEL as well. This is much thanks to the one area where Gnome Shell wins over Unity: It’s highly configurable, and there are many extensions.
Gnome Shell tweaks
For Gnome Shell extensions to work you must have rhel-7-workstation-optional-rpms repo enabled, and install gnome-shell-browser-plugin. I have quite a lot of extensions, but here I’ll only mention the absolutely necessary ones.
There are two System monitors, System Monitor, which works but is useless since it shows up in the message tray, so you can’t see it without opening the message tray, and system-monitor, which I used on Fedora 20 and is fantastic. But doesn’t work on RHEL7! Hey ho.
Dash to Dock is an extension that is a must-have. It’s listed as outdated on https://extensions.gnome.org/ but works fine. This may be since RHEL is running a rather old version of Gnome. There is also Simple Dock, but it silently fails with no errors, probably for the same reason.
TopIcons is another must-have. It moves status icons from the Message Tray, where you can’t see them, to the top-bar, where you can. Unfortunately it won’t move the System Monitor widget so it stays useless.
Dual screen pains
The laptop I’m using still has the same resolution as my external screen, despite being much smaller. There is no solution for this that I can find in RHEL either. Switching between a high DPI and a low DPI is very annoying as you will constantly find yourself having too large or too small texts. Using both screens in dual-screen mode is not an option.
I solved this by having both a stationary computer as my main work-machine in my office, and using the laptop at home and for traveling. That way I never switch screens and never switch screen resolution. This is a problem that needs fixing for all Linux variations, and it’s probably going to take a very long time to fix, as it means software needs to stop thinking in pixels.
You have to install the EPEL repos, of course, and the Nux! Desktop repo is absolutely essential. http://li.nux.ro/repos.html
With these two I could install xchat, KeePassX, Quod Libet, skype, and more. And of course things necessary for work, such as git, git-review, subversion, etc.
To get multimedia working (and install Quod Libet, the best music library/player I’ve found so far):
sudo yum install gstreamer gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-bad-free gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg quodlibet
RHEL was definitely tricky and quirky to use as a personal desktop for “power users” like me. But it’s main target is of course as a standardized enterprise install, where users can’t really install software at all, but everything including software selection is managed by the IT department. And in those cases even the problems of Gnome 3 isn’t a drawback, because these departments will typically install the more Windows 95-like Gnome Classic mode.
But for personal use Fedora is better, especially Fedora 22, which I’ve renecently switched to. More on that later.
This is an overview of the various date/time implementations in Python (that I know of) and why they aren’t good enough. I’m not mentioning why they are good, they may or may not be. The standard library’s datetime module has a lot going for it. This only explains why it’s not good enough. If I’ve missed a library, tell me and I’ll take a look.
The standard library modules
Too many separate modules, datetime, time, calendaring, etc, with some overlap (and omissions).
Naive and intentionally crippled timezone implementation.
Stores datetimes internally as the local time, which makes time zones overly complicated.
timedelta has a days attribute which is actually not 1 day, but 24 hours.
Except that the intentionally crippled datetime implementation makes it 23 or 25 hours on DST changes.
Arrows main criticism towards the standard library is that there is too many classes, like date, time and datetime. However, Arrow does not implement a date() replacement or a time() replacement, an Arrow() object only replaces datetime(). You can’t represent a date or a time with it, Arrow(2014, 5, 6) will return midnight that day. It also will return a timedelta if you subtract two Arrow objects. So it does not improve the situation. Even if you replace all your datetime objects with Arrows, just still need to deal with the exact same number of classes.
And how should time arithmetic work on a date? What is “The 1st of February plus three minutes”? That’s not obvious. A date is the whole day so it actually should be three minutes after midnight on February 2nd”, but if you implement that I think most people would be very surprised. They would get even more surprised that datetime(2014, 11, 2, 5) – datetime(2014, 11, 2) doesn’t return a 5 hour timedelta. (Actual elapsed time between midnight and 5 am that day is six hours). And even if you implement one object that can behave both as a date and a datetime. How can you tell the difference between a date and a datetime without asking the object if they are the same type?
I therefore think there should be separate date and datetime objects.
In addition I’m not happy about how Arrow.replace() works, with Arrow.replace(month=3) sets the month to March, but Arrow.replace(months=3) increases it with three months. The difference is to subtle, and the replace() method should replace, not add. A shift() method would have been better.
All Arrow objects are time zone aware, and default to UTC. But separating time zone aware objects and time zone naive classes are essential, as again, they can’t reliably be compared or subtracted. Just assuming that not specifying a time zone means UTC is not good enough for all cases.
- Uses Arrow as it’s implementation, so only included here for completeness.
Datetimes are mutable, and they shouldn’t be, because then you can’t use them as keys etc. Possibly there could be mutable datetimes as well, but that should not be the default.
Merges dates and datetimes into one class.
- Old, inconsistent and confusing due to being written/extended piecemeal.
- A lot of old cruft like supporting timezones named “EST”.
- No real time zone support.
Implements a relativedelta class, but uses the stdlib for everything else, so only included for completness.
A wrapper around datetime and pytz, chiefly for a more convenient API (I think).
I’m used to the Ubuntu installer, so I obviously think it’s SUPER EASY! I do wish it was smarter about the locales, I select a Swedish keyboard but an English language for the OS, it should install both the Swedish and English language packs. The Swedish is needed because I want to have international standard date times.
The overlay scrollbars
I wish I could get IBM SAA CUA Scrollbars. They were the shit. You can page up and down with them for example. Ubuntu however has invented some sort of “overlay scrollbars”. I do not like them at all. You can disable the overlay scrollbars, but the “normal” mode isn’t great either. It for example can’t page up and down.
System Load Indicator is in the standard Ubuntu repositories. The Fedora version allows having separate indicators per processor. Yes, that’s 8, but that’s much more usable than having only 1. Running one process at 100% is barely visible as it’s only 1/8th of the indicator graph.
Compiling Python on Ubuntu is a bit of a pain, generally, as you need to patch older Pythons to compile, because library files are not where they expect. However, pyenv contains “python-build” a tool to make it easy to build any Python on pretty much any Linux. As a result, this is no longer a big issue.
Issues with Unity
I like the ideas behind Unity and Gnome Shell. I like them a lot. But the move there is not always smooth. In mouse-driven UI design, corners are important. This is because you can “throw” the mouse into a corner without aiming. Move the mouse fast and vaguely in the right direction, and it ends up in the corner. Unlike Gnome shell, Unity has all the window buttons that should be there: Minimize, Maximize and Close. They are on the left, so that Unity can move them into the top bar, hence taking less space. This is one of the things I like with Unity, it leaves the screen space to the applications. This also means that throwing the mouse into the top left corner and clicking closes the window. This is a good behavior, it makes it easy and fast to close windows. But it means that to open the main Unity menu with a mouse, you have to actually aim at the menu button, as it’s up there in the top left, but not actually in the corner. The top right corner is for system settings, logging out and rebooting. The bottom corners are not used for anything, and that kinda seems like a shame. Did they choose the top left corner just to not have people call it “The Start Menu”? I don”t know, but it seems to me that bottom left was not such a bad place after all. The decision to move the window buttons into the top bar also sees the application menus moved there. This causes problems with some applications, for example in some applications the text will continue to be black, and hence invisible on the black menu background.
How it compares with Gnome Shell/Fedora 20
I stayed on Ubuntu 12.04 for a long time because I wanted to use Unity 2D, as Unity 3D was buggy. This was mostly because of driver issues. I’ve now used Unity 3D on 14.04 without a single problem for more than half a year. While Gnome Shell is an exercise in being bombarded by annoyances, Unity is smooth and friendly. The notifications work well, they show for a long time and they go semi-transparent if you hover the mouse over them, so you can still click on whatever is below the notification. Status icons show up in the icon bar, where you expect them. You can choose to auto-hide the launcher or not. With today’s modern wide screens there is plenty of space on the side, so hiding it is really not necessary. Almost any open source Unix software you can think of has repos with distributions you can install. The update manager actually works. It will show updates once a day, and ask to reboot when needed after an update. You can scale the menus and title bars separately for separate screens, that’s a real nice feature. Unfortunately of course this is not a setting of DPI, and applications themselves will ignore it. It wold be really nice if you could use both the laptop screen and an external screen without getting a headache. I have no problems with my processors running on 100% for no apparent reason. OK, fair enough, right now while typing this one core is on 100% doing “nothing”, but the process running that is qemu running some sort of virtual machine. I don’t know what THAT machine is doing that is taking 100%, but the main OS isn’t doing anything anyway.
Ubuntu 14.04 is so nice. It and OS X are the only real contenders for “Top Desktop OS” in my opinion. Much of that is thanks to Unity. Fedora, and especially Gnome 3, has a lot of catching up to do.
Related: Fedora 20
Unexpectedly and amazingly even the third €1200 goal was reached in my funding campaign! The Python community is fantastic! Thanks to everyone!
This is the last day of funding (it says 0 days left), so there is just hours to go (I’m not sure at exactly what time it closes). It’s unlikely that the last goal of €2500 will be reached, but I can find ways to put any money over €1200 to good use. For example, I could print copies to give away at PyCon in Montreal. But what to do with that money depends a lot on how much it is.
The second goal of my crowd-funding campaign to make Porting to Python 3 into a community book has been reached! This means I will rename the book “Supporting Python 3”, create a contributor licensing scheme and update the “About this book” page to reflect the books community status and contributors.
But that doesn’t have to be the end! There are more things that can be done! And although we are unlikely to reach the goal of €1200, where I also set up automated testing and PDF generation, any money donated from now on will go towards the goal of automating this. I just do not promise that I’ll finish that work unless we reach the target!
We have 6 people who have opted for a special signed funders edition of the new book, and 2 funders have opted for home made smoked sausages! Get yours too!
I’ve reached the €400 goal of my fund-raiser, which means that I will clean up the book source and move it to Github, so anyone can contribute with just a pull request!
Next up is the stage I really want to reach: Spending the time to rename the book to “Supporting Python 3”, create a contributor licensing scheme and update the “About this book” page to reflect the books community status and contributors.
Come on community, you can do it!
My book “Porting to Python 3” needs updating, but I don’t have time. So I have decided that I will make it into a community book, put it up on GitHub and give the Python Software Foundation a license to use it to make money.
To that end I have created a crowd funding campaign to fund this transformation. I only need €400 to to the basic work, but there are also stretch goals. Rewards include smoked ham and baking!
I ran some statistics on PyPI:
- 50377 packages in total,
- 35293 unmaintained packages,
- 15084 maintained packages.
Of the maintained packages:
- 5907 has no Python classifiers,
- 3679 support only Python 2,
- 1188 support only Python 3,
- 4310 support Python 2 and Python 3.
- A total of 5498 packages support Python 3,
- 36% of all maintained packages declares that they support Python 3,
- 24% of all maintained packages declares that they do NOT support Python 3,
- and 39% does not declare any Python support at all.
So: The 59% of maintained packages that declare what version they support, support Python 3.
And if you wonder: “Maintained” means at least one versions released this year (with files uploaded to PyPI) *or* at least 3 versions released the last three years.