Feeds

PyCon Pune: The Registration for the PyCon Pune 2018 is now open.

Planet Python - Sat, 2017-10-14 06:44
PyCon Pune, the conference that started its journey in 2017, has opened up the registrations for the 2018 version now. You have the following ticket options for the conference which you can purchase from the registration page in our website: The Conference Ticket for ₹1700 grants you access to the main conference, 8th & 9th of February 2018. This ticket also includes a t-shirt of your preferred size. The Conference & Developer Sprints Ticket come at a price of ₹2500.
Categories: FLOSS Project Planets

Codementor: Building a Spotify-Lyrics GUI application for Linux

Planet Python - Sat, 2017-10-14 01:38
A basic GUI application to display the lyrics of the song being played on the Spotify app for Linux systems
Categories: FLOSS Project Planets

Norbert Preining: ScalaFX: ListView with CellFactory

Planet Debian - Sat, 2017-10-14 01:29

I had a bit hard time to get ScalaFX to display a list of items in a scrollable space, and each item can be clicked. I use this in TLCockpit to display the list of documentation files in a TeX Live package, and open it directly from the application. Unfortunately there is not a huge amount of examples using ScalaFX out there in the web, so it took me a bit. My first try was using a VBox with various Labels in there, but this is not scrollable.

In other areas I have used TreeTableView, so in this case using ListView should be fine. What I finally came up is the following code:

import scalafx.application.JFXApp import scalafx.application.JFXApp.PrimaryStage import scalafx.collections.ObservableBuffer import scalafx.geometry.Orientation import scalafx.scene.control.{ListCell, ListView} import scalafx.scene.input.MouseEvent import scalafx.scene.{Cursor, Scene} import scalafx.scene.paint.Color import scalafx.Includes._ object ApplicationMain extends JFXApp { val SomeStrings: Seq[String] = Seq("Hello", "World", "Enjoy") stage = new PrimaryStage { title = "ListViewExample" scene = new Scene { root = { new ListView[String] { orientation = Orientation.Vertical cellFactory = { p => { val cell = new ListCell[String] cell.textFill = Color.Blue cell.cursor = Cursor.Hand cell.item.onChange { (_, _, str) => cell.text = str } cell.onMouseClicked = { me: MouseEvent => println("Do something with " + cell.text.value) } cell } } items = ObservableBuffer(SomeStrings) } } } } }

Some comments to the code, at least as far I understand it:

  • line 9: Importing scalafx.Includes._ seems to simplify some things, in particular the event handler routines can be written more straight forward.
  • line 20: Many more properties can be set here, for example the preferred height and max height, both of which I am using.
  • line 23: In my case a ListCell was enough for my needs (changing color, cursor, and allowing for mouse clicks), but if one needs something more complicated here it is bst to create an arbitrary object and asign it to the graphic field.
  • line 26: The essential part to actually fill the cells is the routine cell.item.onChange, which takes three arguments of which the last is the new value. It is used to update the cell text.
  • line 31: Last but not least one needs to assign some Observable to the items, in this case I use ObservableBuffer around the lost of strings.

Once managed, it doesn’t look so complicated, but took me some time.

Categories: FLOSS Project Planets

Full Stack Python: The Full Stack Python Blog

Planet Python - Sat, 2017-10-14 00:00

Full Stack Python began way back in December 2012 when I started writing the initial deployment, server, operating system, web server and WSGI server pages. The site has has broadly expanded out into a many other subjects outside the deployment topics I originally started this site to explain.

However, I frequently wanted to write a Python walkthrough that was not a good fit for the page format I use for each topic. Many of those walkthroughs became Twilio blog posts but not all of them were quite the right fit on there. I'll still write more Twilio tutorials, but this Full Stack Python blog is the spot for technical posts that fall outside the Twilio domain.

Let me know what you think and what tutorials you'd like to see in the future.

Hit me up on Twitter @fullstackpython or @mattmakai.

Categories: FLOSS Project Planets

Kdenlive 17.08.2 released

Planet KDE - Fri, 2017-10-13 22:11

The second minor release of the 17.08 series is out adding a rotate from image center option in the Transform effect among other usability improvements. In other news the dev team continues making progress for the much anticipated 17.12 release. Start the countdown!

Bugfixes

  • Fix autosave: work around KAutoSaveFile bug with non-ASCII chars. Commit.
  • Get ready for transform centered rotation. Commit.
  • Fix keyframes unseekable on bin effects. Commit.
  • Fix lift to handle negative values (requires latest MLT version). Commit.
  • Prefer SDL2 to SDL1 (dropped by FFmpeg and so MLT). Commit.
Categories: FLOSS Project Planets

Gbyte blog: Creating Drush 9 commands and porting legacy commands

Planet Drupal - Fri, 2017-10-13 19:05
Upgrading to Drush 9 Drush should be installed and updated through composer. There is no stable Drush 9 version yet, so the development version must be used. Updating to the development version of Drush 9 is a simple as typing: composer require drush/drush:dev-master Porting your Drush commands to Drush 9 Porting the commands is a semi-automatic process: There is a command that will generate the required files and class structure for you. To start the wizard, just type:
Categories: FLOSS Project Planets

Last Call Media: Why we're moving to component theming

Planet Drupal - Fri, 2017-10-13 17:34
Why we're moving to component theming Rob Fri, 10/13/2017 - 17:34 Why we’re changing the way we theme Drupal sites, and how we’re using Mannequin to do it.
Categories: FLOSS Project Planets

Bay Area Drupal Camp: Only a few mores sleeps until BADCamp!

Planet Drupal - Fri, 2017-10-13 15:12
Only a few mores sleeps until BADCamp! Grace Lovelace Fri, 10/13/2017 - 12:12pm

BADCamp is almost here! Just five more sleeps to go. We’d like to share some details about event logistics and making the most of your time at BADCamp.

Make Sure You Are Registered!

While BADCamp is both awesome and free, signing up for BADCamp helps us plan and ensures you receive event specific information.

 

Want to be Trained? You Need to Sign Up for Free Training

A few last minute cancellations means we have a few seats still available. Sign up soon to reserve your spot!

 

Want to Summit? You Need to Sign up for Summits

Wednesday and Thursday, we'll be hosting great summits that facilitate conversations and connections with people in specific industries or with specific skills. Come dive deep into the issues that matter and collaborate freely. Registration is open and while attendance is free, signing up will ensure you receive summit specific information for the event.

 

Want to Make A Session Schedule?

Are you a super planner? Make your session schedule in advance and then follow along on your mobile device! Take a look at the final session schedule. There are BADCamp sessions spanning the worlds of development, design, strategy, project management, technology communities and everything in between.

  Join us at the Contribution Lounge for coffee, community, and code!

This is a great chance to help make Drupal 8 bigger and better. The BADCamp Contribution Lounge is at the Hotel Shattuck. The Lounge has Internet access and an ample supply of coffee and water. We're open around the clock from Wednesday, October 18 at 9 am to Saturday, October 21 at 10 pm. Come participate!

 

Parties

BADCamp Party on Friday Night

Come to the official BADCamp party at The Marsh Theatre on Friday night.  Doors open earlier than planned at 6:30 to maximize our time on the ROOF TOP!

Please find our generous sponsors, Platform.sh, Hook42 and Lullabot. Give them a BIG thanks as this party would not have been possible without their generous support.

We will have drink tickets burning a hole in our pocket, so come early and be prepared for a good time. There will be great music, and ample space on the Dance Floor. There will also be tables and quiet areas to chat. For more info...

 

We need your help: Volunteer for BADCamp!

BADCamp is 100% volunteer driven and we need your hands! We need stout hearts to volunteer and help set up, tear down, give directions and so much more!  If you are local and can help us, please contact Manish at info@badcamp.net or sign up on our Volunteer Form.

 

Would you have been willing to pay for your ticket?  

If so, then you can give back to the camp by purchasing an individual sponsorship at the level most comfortable for you. As our thanks, we will be handing out some awesome BADCamp swag including a 2017 edition t-shirt, hoodie and stellar solar charger.

 

Sponsors

A BIG thanks to our sponsors! Without them this magical event wouldn’t be possible. An extra big thanks to Platform.sh, Pantheon & Acquia for sponsoring at the Core level to help keep BADCamp free and awesome.

Drupal Planet
Categories: FLOSS Project Planets

Alex Muntada: My Free Software Activities in Jul-Sep 2017

Planet Debian - Fri, 2017-10-13 14:47

If you read Planet Debian often, you’ve probably noticed a trend of Free Software activity reports at the beginning of the month. First, those reports seemed a bit unamusing and lengthy, but since I take the time to read them I’ve learnt a lot of things, and now I’m amazed at the amount of work that people are doing for Free Software. Indeed, I knew already that many people are doing lots of work. But reading those reports gives you an actual view of how much it is.

Then, I decided that I should do the same and write some kind of report since I became a Debian Developer in July. I think it’s a nice way to share your work with others and maybe inspire them as it happened to me. So I asked some of the people that have been inspiring me how do they do it. I mean, I was curious to know how they keep track of the work they do and how long it takes to write their reports. It seems that it takes quite some time, it’s mostly manual work and usually starts by the end of the month, reviewing their contributions in mailing lists, bug trackers, e-mail folders, etc.

Here I am now, writing my first report about my Free Software activities since July and until September 2017. I hope you like it:

  • Filed bug #867068 in nm.debian.org: Cannot claim account after former SSO alioth cert expired.
  • Replied a request in private mail for becoming the maintainer for the Monero Wallet, that I declined suggesting to file an RFP.
  • Attended DebConf17 DebCamp but I missed most of Open Day and the rest of the Debian conference in Montreal.
  • Rebuilt libdbd-oracle-perl after being removed from testing to enable the transition to perl 5.26.
  • Filed bug #870872 in tracker.debian.org: Server Error (500) when using a new SSO cert.
  • Filed bug #870876 in tracker.debian.org: make subscription easier to upstreams with many packages.
  • Filed bug #871767 in lintian: [checks/cruft] use substr instead of substring in example.
  • Filed bug #871769 in reportbug: man page mentions -a instead of -A.
  • Suggested to remove libmail-sender-perl in bug #790727, since it’s been deprecated upstream.
  • Mentioned -n option for dpt-takeover in how to adopt pkg-perl manual.
  • Fixed a broken link to HCL in https://wiki.debian.org/Hardware.
  • Adopted libapache-admin-config-perl into pkg-perl team, upgraded to 0.95-1 and closed bug #615457.
  • Fixed bug #875835 in libflickr-api-perl: don’t add quote marks in SYNOPSIS.
  • Removed 50 inactive accounts from pkg-perl team in alioth as part of our annual membership ping.

Happy hacking!

 


Categories: FLOSS Project Planets

Community Over Code: FAQ for Facebook React.js BSD + PATENTS License issue with the Apache Software Foundation

Planet Apache - Fri, 2017-10-13 14:09

(Today we’re interviewing Shane Curcuru about the recent issues reported with Facebook’s React.js software’s BSD + PATENTS file license, and what the Apache Software Foundation (ASF) has to do with it all. Shane serves in a leadership position at the ASF, but he wants you to know he’s speaking only as an individual here; this does not represent an official position of the ASF.)

UPDATE: Facebook has relicensed React.js as well as some other software under the MIT license, without the FB+PATENTS file. That’s good news, in general!

Hello and welcome to our interview about the recent licensing kerfuffle around Facebook’s React.js software, and the custom license including a custom PATENTS file that Facebook uses for the software.

You’ve probably seen discussions recently, either decrying the downfall of your startup if you use React, or noting that this is an old issue that’s just a paper tiger. Let’s try to bring some clarity to the issue, and get you some easy-to-understand information to make your own decision. To start with, Shane, can you briefly describe what the current news hype is all about? Is this a new issue, or an old one?

Well, like many things around licensing, the details are complicated, but the big picture is fairly simple. Big picture, the current news hype is only about policy at the ASF, and does not directly affect anyone else. The only recent change was made for projects already at Apache, and even that change will take a while to implement.

I’m confused — isn’t this a new change in the licensing for the React.js project?

No, actually — Facebook’s React.js project has used this license (often called BSD + PATENTS, but it’s really a Facebook-specific file) for several years, so the underlying issue with this specific PATENTS file is old. It’s just getting attention now because the ASF has made a change in their licensing policy. The current change last month was to declare that for Apache projects, the custom PATENTS clause that Facebook uses on React.JS software is now officially on the “Category-X” list of licenses that may not be shipped in Apache projects.

So the news is about the fact that Apache projects will no longer include React.js in their source or releases. This is a policy change, and only affects Apache projects, but obviously it’s gotten some news coverage and has gotten a lot of developers to really go back and pay attention to the licensing deails around React.

Many of our readers probably don’t understand what “Category X” means, unless it’s an X-Files reference. Can you explain more how the ASF determines which kinds of software licenses are acceptable in Apache projects?

Great question, yes, Category X is the ASF’s term for software licenses that, by ASF policy, may not appear in Apache software source repositories or software releases. This is an operational decision by the ASF, and doesn’t mean that various licenses are incompatible with the Apache 2.0 license — just that the ASF doesn’t want it’s projects shipping code using these licenses.

The rationale is this: the ASF wants to attract the maximum number of inbound contributions. Thus, we use the permissive and as some say “business-friendly” Apache license for all ASF software. This allows maximum freedom for people who use Apache software to do as they please, including making proprietary software. Part of the Apache brand is this expectation: when you get a software product from the ASF, you know what to expect from the license. Besides not suing us and not using Apache trademarks, the only real restriction is including the license if you redistribute something based on Apache 2.0 licensed software.

Licenses that the ASF lists as Category X add additional restrictions on use to end users of the software, above and beyond what Apache 2.0 requires. The most obvious example are GPL* copyleft licenses, that require redistributors to provide any changes made publicly, under the GPL.

OK — So Category X isn’t a legal determination of incompatibility, it’s just a policy choice the ASF is making? Is that right?

Exactly right. Others are free to mix licenses in various ways — but the ASF chooses to not redistribute software with more restrictive licenses than Apache 2.0. So when you download an Apache product, it won’t have Category X software like React in it — but you’re free to mix Apache products with React yourself, if you like.

Aren’t there some Apache projects shipping with React today, like CouchDB?

Yes — CouchDB currently includes React in their tree and past releases, as do a few other projects. These projects will warn their users (by a NOTICE file or blog post) that their releases contain more restrictive licensed software, and are working on plans to re-design things to remove React and replace it with other, less restrictively licensed libraries.

And before you ask, yes, this is extra work for the volunteer projects at Apache, and it’s not something the ASF does lightly. But ensuring that Apache projects have clean IP that never includes any licensing restrictions beyond what the well-known Apache 2.0 license requires is critical to the broad acceptance of Apache software everywhere.

So if this recent change in ASF policy only affects Apache projects, why is it getting so much attention in tech circles these days?

Because the ASF policy announcement has made some people go back and really look at Facebook’s custom BSD + PATENTS file license used in React. This is a good thing — you should always understand the licenses of software you’re using so you follow them — and so you don’t have surprises later, like now. People using React are already bound by this license, it’s just that many people didn’t look into the details until now.

There are two conceptual issues here in terms of how open source participants decide if they want to accept Facebook’s license here. First is the addition of Facebook’s custom-written PATENTS file. Very briefly, it states that if you sue Facebook over (almost any) patent issues, you loose your license to Facebook patents. The first issue is that this patent termination clause — which is in a fair number of licenses — is a strict and exclusionary clause. The balance of rights granted (or taken away, if you sue) is strongly tilted to Facebook as a specific entity. It’s not the more even and generic balance of patent termination rights that are in the Apache 2.0 license.

That asymmetry in patent rights is the problem: it directly puts Facebook’s interests above everyone else’s interests when patent lawsuits around React happen. Of course, there are a lot more details to the matter, but for those questions you need to ask your own attorney — all I can say is that it’s an issue that will happen incredibly rarely, if ever, for open source projects.

So the Facebook BSD + PATENTS file license favors Facebook, even though they’re an open source project that wants your contributions. We kind of get that; patents are always tricky, but the asymmetry in rights there does seem a little odd compared to other licenses. You said there were two conceptual issues?

The second conceptual issue is simpler to explain. The Facebook BSD + PATENTS file license is not on the OSI list of open source licenses.

(pause) Um, is that it? What’s the real issue here about OSI approval?

Yup, that’s the core of the issue. Being on the OSI list is huge. The generally accepted definition of “open source” is that your software’s license is listed by OSI.

The reason OSI listing is key is because enough lawyers in many, many companies have vetted the OSI list licenses that the ecosystem knows what to expect. The OSI has a strong reputation, so to start with people know basically what to expect in terms of overall license to OSI listed licenses. More importantly, these licenses have been vetted over and over by counsel from a wide variety of companies.

A lot of law work is risk management: ensuring your rights are preserved when doing business or using licenses. OSI-listed licenses are well known, so lawyers can quickly and confidently express the level of risk in using them. Non-OSI licenses mean the lawyers have to read them in detail, and do a new and comprehensive review of risks. It’s not just the work, it’s the uncertainty with something new that typically translates into saying “This new license has more risks than those well-used ones.”

Now I get it — OSI licenses are popular and frequently reviewed, so people are comfortable with them. A new license — like the Facebook PATENTS file — might not be bad, but might be — people don’t know it well enough yet.

Exactly right. I can’t think of any good reason for companies that want to work with open source groups to ever use a non-OSI listed license. People keep thinking so, but license proliferation is not worth it. Successful open source projects need new contributors from a variety of places. Keeping barriers to entry low — like unusual licenses — is one of the easiest ways to turn users into potential contributors.

If the Facebook PATENTS license is unusual enough to turn off other projects from using it, like Apache, why won’t Facebook consider changing the license to an OSI-approved one?

That’s a question you’ll need to ask Facebook. The ASF already asked Facebook to consider changing the license, and they said no. Facebook also wrote an explainer for their license that’s been widely shared.

We have one listener asking: Is the Facebook PATENTS license viral? That is, if you use React.js in your software, must you use the same Facebook PATENTS license?

No, the PATENTS clause is not “viral”, or rather, it’s not copyleft. So you are free to use whatever license you want on any software you write that uses or incorporates React.js.

Note that the actual patent grant from Facebook to anyone using React.js software — even if it’s inside of your software project — is still there. The PATENTS terms apply to anyone who’s running the React.js software, and are between Facebook and all the end users. So that patent licensing issue doesn’t affect you as an application builder directly, but it might affect your users.

Great, well we’ve covered a lot of ground in this interview. What else should readers know about, so they can make up their own mind about the licensing risks around React — that were always there, but they might not have understood.

TL;DR: the only short-term question is if you’re thinking about donating your project to Apache. If so, start planning now to migrate away from React, because you won’t be able to bring it with you.

For everyone else, this is a non-issue in the short term. Longer term, it’s something you should make your own mind up about, by considering all the aspects of any change: legal risk (probably low, but it’s patents so who knows), technology (several replacements out there, but none yet as strong as React), and community (what development capacity do you have, and does your community of contributors care?)

I wrote a brief guide about the legal, technical, and community aspects of deciding to use or not use React earlier.

Also — if you have strong opinions about this, let people — and Facebook — know! I have to say a some open source types were quite surprised when Facebook refused the ASF’s request to relicense. Facebook has some great open source projects, including some open governance ones. I’m personally a little surprised they aren’t using an OSI license for this kind of stuff.

Thanks for reading along with Shane’s interview of Shane on the React licensing issue! Good luck to your project whichever licenses you choose.

For More Information About React Licensing

The ASF’s publishes their Licensing policies, including the Category X list, and some rationale for policy decisions on licenses at Apache.

UPDATE! Automattic, the company behind WordPress, will be moving away from React:

“We’ll look for something with most of the benefits of React, but without the baggage of a patents clause that’s confusing and threatening to many people

Simon Phipps’ timeline and discussion about how Apache moved the PATENTS license to the Category X list:

https://meshedinsights.com/2017/07/16/apache-bans-facebooks-license-combo/

A popular post here on Medium focused on CTOs, with a balanced view, including a discussion on one patent lawsuit between Facebook and Yahoo!:

https://medium.com/@ji/the-react-license-for-founders-and-ctos-b38d2538f3e5

Detailed (long)discussion of “what does this mean for my project” from an engineer’s perspective:

Brain dump: notes and questions arising from “Facebook’s BSD-3 + strong patent retaliation” license
This is a living document and I will keep updating it as necessarymedium.com

An Apache CouchDB developer’s take on React and the license:

Understanding the Facebook vs Apache Software Foundation License Kerfuffle
Translation: French by @gnieh_ Disclaimers: I am not a lawyer. I’m not speaking for Facebook, the ASF, or CouchDB. This…writing.jan.io

If you’re a startup, you should not use React (community/startup aspects):

If you’re a startup, you should not use React (reflecting on the BSD + patents license)
That is, if you ever hope to be acquired by a larger companymedium.com

Don’t over-REACT to the Facebook Patents License (legal aspects)

Don’t Over-REACT to the Facebook Patents License
Recently, Apache re-classified code under Facebook’s “BSD+ Patents” license to “Category X,” effectively banning it…blog.fossa.io

Why the Facebook Patents License Is A Paper Tiger (legal aspects)

React, Facebook, and the Revocable Patent License. Why It’s a Paper

Peter Bengtsson: Concurrent Gzip in Python

Planet Python - Fri, 2017-10-13 11:27

Suppose you have a bunch of files you need to Gzip in Python; what's the optimal way to do that? In serial, to avoid saturating the GIL? In multiprocessing, to spread the load across CPU cores? Or with threads?

I needed to know this for symbols.mozilla.org since it does a lot of Gzip'ing. In symbols.mozilla.org clients upload a zip file full of files. A lot of them are plain text and when uploaded to S3 it's best to store them gzipped. Basically it does this:

def upload_sym_file(s3_client, payload, bucket_name, key_name): file_buffer = BytesIO() with gzip.GzipFile(fileobj=file_buffer, mode='w') as f: f.write(payload) file_buffer.seek(0, os.SEEK_END) size = file_buffer.tell() file_buffer.seek(0) s3_client.put_object( Bucket=bucket_name, Key=key_name, Body=file_buffer ) print(f"Uploaded {size}")

Another important thing to consider before jumping into the benchmark is to appreciate the context of this application; the bundles of files I need to gzip are often many but smallish. The average file size of the files that need to be gzip'ed is ~300KB. And each bundle is between 5 to 25 files.

The Benchmark

For the sake of the benchmark, here, all it does it figure out the size of each gzipped buffer and reports that as a list.

f1 - Basic serial def f1(payloads): sizes = [] for payload in payloads: sizes.append(_get_size(payload)) return sizes

f2 - Using multiprocessing.Pool def f2(payloads): # multiprocessing sizes = [] with multiprocessing.Pool() as p: sizes = p.map(_get_size, payloads) return sizes

f3 - Using concurrent.futures.ThreadPoolExecutor def f3(payloads): # concurrent.futures.ThreadPoolExecutor sizes = [] futures = [] with concurrent.futures.ThreadPoolExecutor() as executor: for payload in payloads: futures.append( executor.submit( _get_size, payload ) ) for future in concurrent.futures.as_completed(futures): sizes.append(future.result()) return sizes

f4 - Using concurrent.futures.ProcessPoolExecutor def f4(payloads): # concurrent.futures.ProcessPoolExecutor sizes = [] futures = [] with concurrent.futures.ProcessPoolExecutor() as executor: for payload in payloads: futures.append( executor.submit( _get_size, payload ) ) for future in concurrent.futures.as_completed(futures): sizes.append(future.result()) return sizes

Note that when using asynchronous methods like this, the order of items returned is not the same as they're submitted. An easy remedy if you need the results back in order is to not use a list but to use a dictionary. Then you can track each key (or index if you like) to a value.

The Results

I ran this on three different .zip files of different sizes. To get some sanity in the benchmark I made it print out how many bytes it has to process and how many bytes the gzip will manage to do.

# files 66 Total bytes to gzip 140.69MB Total bytes gzipped 14.96MB Total bytes shaved off by gzip 125.73MB # files 103 Total bytes to gzip 331.57MB Total bytes gzipped 66.90MB Total bytes shaved off by gzip 264.67MB # files 26 Total bytes to gzip 86.91MB Total bytes gzipped 8.28MB Total bytes shaved off by gzip 78.63MB

Sorry for being eastetically handicapped when it comes to using Google Docs but here goes...


This demonstrates the median times it takes each function to complete, each of the three different files.

In all three files I tested, clearly doing it serially (f1) is the worst. Supposedly since my laptop has more than one CPU core and the others are not being used. Another pertinent thing to notice is that when the work is really big, (the middle 4 bars) the difference isn't as big doing things serially compared to concurrently.

That second zip file contained a single file that was 80MB. The largest in the other two files were 18MB and 22MB.


This is the mean across all medians grouped by function and each compared to the slowest.

I call this the "bestest graph". It's a combination across all different sizes and basically concludes which one is the best, which clearly is function f3 (the one using concurrent.futures.ThreadPoolExecutor).

CPU Usage

This is probably the best way to explain how the CPU is used; I ran each function repeatedly, then opened gtop and took a screenshot of the list of processes sorted by CPU percentage.

f1 - Serially


No distractions but it takes 100% of one CPU to work.

f2 - multiprocessing.Pool


My laptop has 8 CPU cores, but I don't know why I see 9 Python processes here.
I don't know why each CPU isn't 100% but I guess there's some administrative overhead to start processes by Python.

f3 - concurrent.futures.ThreadPoolExecutor


One process, with roughly 5 x 8 = 40 threads GIL swapping back and forth but all in all it manages to keep itself very busy since threads are lightweight to share data to.

f4 - concurrent.futures.ProcessPoolExecutor


This is actually kinda like multiprocessing.Pool but with a different (arguably easier) API.

Conclusion

By a small margin concurrent.futures.ThreadPoolExecutor won. That's despite not being able to use all CPU cores. This, pseudo scientifically, proves that the overhead of starting the threads is (remember average number of files in each .zip is ~65) more worth it than being able to use all CPUs.

Discussion

There's an interesting twist to this! At least for my use case...

In the application I'm working on, there's actually a lot more that needs to be done other than just gzip'ping some blobs of files. For each file I need to a HEAD query to AWS S3 and an PUT query to AWS S3 too. So what I actually need to do is create an instance of client = botocore.client.S3 that I use to call client.list_objects_v2 and client.put_object.

When you create an instance of botocore.client.S3, automatically botocore will instanciate itself with credentials from os.environ['AWS_ACCESS_KEY_ID'] etc. (or read from some /.aws file). Once created, if you ask it to do many different network operations, internally it relies on urllib3.poolmanager.PoolManager which is a list of 10 HTTP connections that get reused.

So when you run the serial version you can re-use the client instance for every file you process but you can only use one HTTP connection in the pool. With the concurrent.futures.ThreadPoolExecutor it can not only re-use the same instance of botocore.client.S3 it can cycle through all the HTTP connections in the pool.

The process based alternatives like multiprocessing.Pool and concurrent.futures.ProcessPoolExecutor can not re-use the botocore.client.S3 instance since it's not pickle'able. And it has to create a new HTTP connection for every single file.

So, the conclusion of the above rambling is that concurrent.futures.ThreadPoolExecutor is really awesome! Not only did it perform excellently in the Gzip benchmark, it has the added bonus that it can share instance objects and HTTP connections.

Categories: FLOSS Project Planets

EuroPython: EuroPython 2017: Videos for Wednesday available online

Planet Python - Fri, 2017-10-13 11:24

We are pleased to announce the third batch of cut videos for EuroPython 2017.

To see the new videos, please head over to our EuroPython YouTube channel and select the “EuroPython 2017″ playlist. The new videos start at entry 63 in the playlist.

In the coming two weeks, we will continue to release the other videos currently marked as “private”, in batches of one conference day per week. 

Enjoy,

EuroPython 2017 Team
EuroPython Society
EuroPython 2017 Conference

Categories: FLOSS Project Planets

PyCharm: PyCharm 2017.3 EAP 5

Planet Python - Fri, 2017-10-13 11:24

The latest and greatest early access program (EAP) version of PyCharm is now available from our website:

Get PyCharm 2017.3 EAP 5

New Interface for Interpreter Selection

In recent times, PyCharm has added more and more advanced ways of configuring your project interpreter. In addition to your regular system Python and virtualenvs based on it, we now also support Conda environments, interpreters on remote machines through SSH, within Docker containers, and in Vagrant boxes. This list is likely to grow in the future as the Python community adapts new ways to isolate dependencies.

The interface that we’ve used to configure these interpreters has slowly been adapting to accommodate new ways of configuring an interpreter. The time has come to overhaul it, both to make it more intuitive to use now, and to be ready for future expansion.

No More Long List

In the project interpreter settings, there is a dropdown, which contains all the virtualenvs you’ve ever used in PyCharm. If you have many projects which all have their own virtualenv, this becomes a very long list. Yet, for the project you’re working on most of them are irrelevant.

This changes in PyCharm 2017.3, the project interpreter dropdown will only have the virtualenvs you have specifically configured for that project, and virtualenvs that you’ve specifically configured to be shared between projects.

Creating New Virtualenvs Made Easy

If you want to configure a new interpreter for your project, use the gear icon, and choose either ‘Add Local’ or ‘Add Remote’. Local interpreters are those that run directly on your operating system, remote interpreters include Docker and Vagrant in addition to remote computers you connect to through SSH.

Let’s have a look at the new Add Local dialog:

This makes it very easy to configure a new virtualenv. If you’d like to reuse an existing virtualenv, you can choose it under ‘Existing virtualenv’. And if you’d like to reuse that virtualenv for further projects in the future, you can check ‘Make available to all projects’ and it will appear in the dropdown on the project interpreter page for all projects.

As we know the decision where to place virtualenvs is a choice that users like to make for themselves, we’ll remember where you placed the virtualenv the previous time. Whether that’s inside your project, or in a separate directory.

For users of virtualenvwrapper and similar tools, we’ve added some intelligence to the existing virtualenv section, and if we find a virtualenv that looks like it belongs to this project (if the name matches, either fully or partially), we’ll preselect it. That means that after setting up your project with mkvirtualenv, after opening PyCharm you’ll be prompted to configure an interpreter, and you’ll most likely only have to click ‘OK’ to confirm.

Also New in this Version

Syntax Highlighting for Function Calls

An oft-requested small improvement to our syntax highlighting: you can now customize the color of function calls in your code. By default, they’re set to black, but you can change them in the settings: Editor | Color Scheme | Python.

SSH Config File Support

If you’re using a bastion host (also referred to as a jump host), you’ll be very happy to know that PyCharm 2017.3 supports SSH config files. Even on Windows. Just write an OpenSSH style config file in ~/.ssh/config or /etc/ssh/ssh_config and choose “OpenSSH Authentication”. 

Further Improvements
  • Fast autocompletion from the command history in the Python console. For example, to import something you’ve imported recently, just type im and then use the up and down arrow keys to find the import.
  • Asynchronous evaluation of variables in the debugger, if you have large objects in your code, you will now be able to see the simple values while the large objects are still loading. Very useful if you have large DataFrames. 
  • Are you using Django together with a JavaScript framework that also uses curly braces in HTML files? You can now disable Django template autocompletion for these files, and get the proper support for the JS framework instead. To do this, right-click the folder that contains the HTML files and click Mark Directory as | Resource Files.
  • We’ve added support for Twisted Trial unit tests
  • And more, have a look at the release notes for details

If these features sound interesting to you, try them yourself:

Get PyCharm 2017.3 EAP 5

As a reminder, PyCharm EAP versions:

  • Are free, including PyCharm Professional Edition EAP
  • Will work for 30 days from being built, you’ll need to update when the build expires

If you run into any issues with this version, or another version of PyCharm, please let us know on our YouTrack. If you have other suggestions or remarks, you can reach us on Twitter, or by commenting on the blog.

Categories: FLOSS Project Planets

Lisandro Damián Nicanor Pérez Meyer: Qt 4 and 5 and OpenSSL1.0 removal

Planet Debian - Fri, 2017-10-13 10:29
Today we received updates on the OpenSSL 1.0 removal status:

<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=828522#206>
<https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859671#19>

So those removal bugs' severities will be raised to RC in aproximately a month.

We still don't have any solutions for Qt 4 or 5.

For the Qt 5 case we will probably keep the bug open until Qt 5.10 is in the archive which should bring OpenSSL 1.1 support *or* FTP masters decide to remove OpenSSL1.0. In this last case the fate will be the same as with Qt4, below.

For Qt4 we do not have patches available and there will probably be none in time (remember we do not have upstream support). That plus the fact that we are actively trying to remove it from the archive it means we will remove openssl support. This might mean that apps using Qt4:

- Might cease to work.
- Might keep working:
  - Informing their users that no SSL support is available → programmer did a good job.
  - Not informing their users that no SSL support is available and establishing connections non the less → programmer might have not done a good job.

Trying to inform users as soon as possible,

Lisandro for the Qt/KDE team.
Categories: FLOSS Project Planets

Paul Johnson: There's something missing from Drupal.org

Planet Drupal - Fri, 2017-10-13 10:25

Recently I've been thinking a lot about what is missing that could help the Drupal project achieve greater success. This was partly in preparation for the Drupal Strategy Summit but also a continuation of research I was already working on.

Many Drupal friendships a created in issue queues, over IRC, Twitter or in Google Hangouts and often across continents. I can think of many personal examples. Maybe you can too?. So it seems incongruous to me that Drupal.org has no community search feature. We are one of the world's biggest communities but no way to find one another.

There is a helpful Where is the Drupal Community?page but it lacks the ability to search of people like me, people having shared interests, shared motivations to contribute, people I can collaborate with.I feel like this is a massive missed opportunity to connect like minds, if such a tool existed new comers are far more likely to have a positive experience and find an outlet for their passion.

I have written a proposal in the Issue Queue for Drupal.org content. If you have thoughts around this feature request, I'd appreciate you joining the conversation.

File Entity module co-maintainers Devin Carlson and Dave Reid meet for the first time atfter a Media BoF at DrupalCon Portland, 2013. They live in Sudbury, Canada and Omaha, Nebraska, respectively. Thousands of similar friendships are formed though Drupal contributions. Photo by Ezra Gildesgame

Categories: FLOSS Project Planets

Michal &#268;iha&#345;: Weblate 2.17

Planet Debian - Fri, 2017-10-13 09:00

Weblate 2.17 has been released today. There are quite some performance improvements, improved search, improved access control settings and various other improvements.

Full list of changes:

  • Weblate by default does shallow Git clones now.
  • Improved performance when updating large translation files.
  • Added support for blocking certain emails from registration.
  • Users can now delete their own comments.
  • Added preview step to search and replace feature.
  • Client side persistence of settings in search and upload forms.
  • Extended search capabilities.
  • More fine grained per project ACL configuration.
  • Default value of BASE_DIR has been changed.
  • Added two step account removal to prevent accidental removal.
  • Project access control settings is now editable.
  • Added optional spam protection for suggestions using Akismet.

Update: The bugfix 2.17.1 is out as well, fixing testsuite errors in some setups:

  • Fixed running testsuite in some specific situations.
  • Locales updates.

If you are upgrading from older version, please follow our upgrading instructions.

You can find more information about Weblate on https://weblate.org, the code is hosted on Github. If you are curious how it looks, you can try it out on demo server. You can login there with demo account using demo password or register your own user. Weblate is also being used on https://hosted.weblate.org/ as official translating service for phpMyAdmin, OsmAnd, Turris, FreedomBox, Weblate itself and many other projects.

Should you be looking for hosting of translations for your project, I'm happy to host them for you or help with setting it up on your infrastructure.

Further development of Weblate would not be possible without people providing donations, thanks to everybody who have helped so far! The roadmap for next release is just being prepared, you can influence this by expressing support for individual issues either by comments or by providing bounty for them.

Filed under: Debian English SUSE Weblate

Categories: FLOSS Project Planets

Import Python: Import Python 146 - C extensions, Cleaning data with Pandas, Machine Learning and more

Planet Python - Fri, 2017-10-13 08:37
Worthy Read
GoCD - open source continuous delivery server GoCD is a continuous delivery tool specializing in advanced workflow modeling and dependency management. It lets you track a change from commit to deploy at a glance, providing superior visibility into your workflow. It’s open source, free to use and download.
advert
Performance gain by writing a C extension in python Interpreted language will never match the performance of compiled languages . Ever since I moved on to python from C/C++ , I always wanted to combine best of both worlds by extending python in C .
cpython
Introduction to data cleaning using Pandas I’ve been using Excel for data cleaning until I discovered how powerful pandas are for data analysis and data cleaning. In this article I want to go over basics of how to use pandas for cleaning data in excel files.
pandas, excel
Implementing Fisher’s LDA from scratch in Python Fisher’s Linear Discriminant Analysis (LDA) is a dimension reduction technique that can be used for classification as well. In this blog post, we will learn more about Fisher’s LDA and implement it from scratch in Python.
machine learning, LDA
Implementing Ethereum trading front-runs on the Bancor exchange in Python This post is a deep-dive into programmatically trading on the Ethereum / Bancor exchange and exploiting a game-theoretic security flaw in Bancor, a high-profile smart contract on the Ethereum blockchain.
cryptocurrency
HelloSign eSign API Embed docs directly on your website with a few lines of code. Test the API for free.

Python Method Resolution Order In Python, a class can inherit features and attributes from multiple classes and thus, implements multiple inheritance. MRO or Method Resolution Order is the hierarchy in which base classes are searched when looking for a method in the parent class.
core-python, MRO
How to serve HTTP/2 using Python The simplest way to serve HTTP/2 is to use the Quart framework, furthermore Quart is the only Python framework to support server-push.
HTTP2
How to get embarrassingly fast random subset sampling with Python Imagine that you are developing a machine learning model to classify articles. You have managed to get an unreasonably large text file which contains millions of identifiers of similar articles that belong to the same class. You are unsure whether identifiers that are close to each other are independent.
machine learning
Toptal We help companies like Airbnb, Pfizer, and Artsy find great developers. Let us find your next great hire. Get started today.

Iterators and Iterables - Agiliq Blog core-python
How I used Python to find interesting people to follow on Medium Medium has a large amount of content, a large number of users, and an almost overwhelming number of posts. When you try to find interesting users to interact with, you’re flooded with visual noise. I define an interesting user as someone who is from your network, who is active, and who writes responses that are generally appreciated by the Medium community.
scraping, codesnippets
Deep Math Machine learning.ai Explained using Python code snippets.
machine learning, math
livepython - Visually trace your Python code in real time Watch your Python run like a movie.
tracing code execution
State of Python version at Facebook tweet
K-Means Clustering in Python Clustering is a type of Unsupervised learning. This is very often used when you don’t have labeled data. K-Means Clustering is one of the popular clustering algorithm. The goal of this algorithm is to find groups(clusters) in the given data. In this post we will implement K-Means algorithm using Python from scratch.
machine learning
8 best languages to blog about web crawling

Projects
magic-the-gifening - 146 Stars, 6 Fork A Twitter bot which tweets Magic: the Gathering cards with appropriate GIFs superimposed onto them.
mailproxy - 94 Stars, 4 Fork mailproxy is a simple SMTP proxy. It receives emails through an unencrypted, unauthenticated SMTP interface and retransmits them through a remote SMTP server that requires modern features such as encryption and/or authentication. mailproxy is primarily useful for enabling email functionality in legacy software that only supports plain SMTP.
RobinhoodShell - 30 Stars, 4 Fork A command line shell for trading stocks using Robinhood
InstagramLib - 26 Stars, 4 Fork Library for interaction with Instagram web-interface. If you haven't access to Instagram API, you can use this library
CSRF-tutorial - 17 Stars, 2 Fork Use Django To Introduce CSRF and Cookies , Session
verpy - 6 Stars, 0 Fork Python application versioning tool
tably - 0 Stars, 0 Fork Python script for converting .csv data to LaTeX tables.
pythonrc - 0 Stars, 0 Fork This is a python script intended to improve on the default Python interactive shell experience.
Categories: FLOSS Project Planets

Shirish Agarwal: I need to speak up now X – Economics

Planet Debian - Fri, 2017-10-13 07:58

Dear all,

This would be a longish blog post (as most of mine are) compiled over days but as there is so short a time and so much to share.

I had previously thought to share beautiful photographs of Ganesh mandals taking out the procession at time of immersion of the idol or the last day of Durga Puja recent events around do not make my mood to share photos at this point in time. I may share some of them in a future blog post or two .

Before going further, I would like to offer my sympathies and condolences to people hurt and dislocated in Hurricane Irma , the 2017 Central Mexico Earthquake and lastly the most recent Las Vegas shooting as well as Hurricane Maria in Puerto Rico . I am somewhat nonplussed as to why Americans always want to name, especially hurricanes which destroy people’s lives and livelihood built over generations and why most of the hurricanes are named after women. A look at weather.com site unveiled the answer to the mystery.

Ironically (or not) I saw some of the best science coverage about Earthquakes or anything scientific reporting and analysis after a long time in mainstream newspapers in India.

On another note, I don’t understand or even expect to understand why the gunman did what he did 2 days back. Country music AFAIK is one of the most chilled-out kind of music, in some ways very similar to classical Indian singing although they are worlds apart in style of singing, renditions, artists, the way they emote etc. I seriously wish that the gunman had not been shot but caught and reasons were sought about what he did, he did. While this is certainly armchair thinking as was not at the scene of crime, but if a Mumbai Police constable could do it around a decade ago armed only with a lathi could do it, why couldn’t the American cops who probably are trained in innumerable ways to subdue people without killing them, did. While investigations are on, I suspect if he were caught just like Ajmal Kasab was caught then lot of revelations might have come up. From what is known, the gentleman was upwardly mobile i.e. he was white, rich and apparently had no reason to have beef with anybody especially a crowd swaying to some nice music, all of which makes absolutely no sense.

Indian Economy ‘Slowdown’

Anyways, back to one of the main reasons of writing this blog post. Few days back, an ex-finance Minister of India Yashwant Sinha wrote what was felt by probably millions of Indians, an Indian Express article called ‘I need to speak up now

While there have been many, many arguments made since then by various people. A simple search of ‘I need to speak up’ would lead to lead to many a result besides the one I have shared above. The only exception I have with the article is the line “Forty leading companies of the country are already facing bankruptcy proceedings. Many more are likely to follow suit.” I would not bore you but you ask any entrepreneur trying to set up shop in India i.e. ones who actually go through the processes of getting all the licenses for setting up even a small businesses as to the numerous hurdles they have to overcome and laid-back corrupt bureaucracy which they have to overcome. I could have interviewed some of my friends who had the conviction and the courage to set up shop and spent more than half a decade getting all the necessary licenses and approval to set up but it probably would be too specific for one industry or the other and would lead to the same result.

Co-incidentally, a new restaurant, leaf opened in my vicinity few weeks before. From the looks it looked like a high-brow, high-priced restaurant hence like many others I did not venture in. After a few days, they introduced south-Indian delicacies like Masala Dosa, Uttapam at prices similar to other restaurants around. So I ventured in and bought some south Indian food to consume between mum and me.

Few days later, I became friends with the owner/franchisee and I suggested (in a friendly tone) that why he doesn’t make it like a CCD play where many people including yours truly use the service to share, strategize and meet with clients.

The CCD joints usually serve coffee and snacks (which are over-priced but still run out pretty fast) but people come as they have chilled-out atmosphere and Wi-Fi access which people need for their smartphones, although the Wi-Fi part may soon become redundant With Reliance Jio making a big play.

I also shared why he doesn’t add more variety and time (the south Indian items are time-limited) as I see/saw many empty chairs there.

Anyways, the shop-owner/franchisee shared his gross costs including salary, stocking, electricity, rent and it doesn’t pan out to be serving Rs.80/- dish (roughly a 1US dollar and 25 cents) then serving INR Rs. 400/- a dish (around 6 $USD). One round of INR 400/- + dishes make his costs for the day, around 12 tables were there. It’s when they have two full rounds of dishes costing INR 400/- or more that he actually has profits and he is predicting loss for at least 6 months to a year before he makes a rebound. He needs steady customers rather than just walk-ins that will make his business work/click. Currently his family is bearing the costs. He didn’t mention the taxes although I know apart from GST there are still some local body taxes that they will have to pay and comply with.

There are a multitude of problems for shutting a shop legally as well as they have to again renavigate the bureaucracy for the same. I have seen more than a few retailers downing their shutters for 6-8 months and then either sell it to new management, let go of the lease or simply sell the property to a competitor. The Insolvency and Bankruptcy Code is probably the first proper exit policy for large companies. So the 40 odd companies that Mr. Sinha were talking about were probably sick for a long time.

In India, there is also an additional shame of being a failed entrepreneur unlike in the west where Entrepreneurs start on their next venture. As seen from Retailing In India only 3.3% of the population or at the most 4% of the population is directly or indirectly linked with the retail trade. Most of the economy still derives its wealth from the agrarian sector which is still reeling under the pressure from demonetization which happened last year. Al jazeera surprisingly portrayed a truer picture of the effects demonetization had on common citizen than many Indian newspapers did at the time. Because of the South African Debconf, I had to resort to debit cards and hence was able to escape standing in long lines in which many an old and women perished.

It is only yesterday that the Government has acknowledged which many prominent Indians have been saying for months now, that we are in a ‘slowdown‘. Be aware of the terms being used for effect by the Prime Minister. There are two articles which outlines the troubles India is in atm. The only bright spot has been e-commerce which so far has eluded GST although the Govt. has claimed regulations to put it in check.

Indian Education System

Interestingly, Ravish Kumar has started a series on NDTV where he is showcasing how Indian education sector, especially public colleges have been left to teachers on contract basis, see the first four episodes on NDTV channel starting with the first one I have shared as a hyperlink. I apologize as the series is in Hindi as the channel is meant for Indians and is mostly limited to Northern areas of the Country (mostly) although he has been honest that it is because they lack resources to tackle the amount of information flowing to them. Ravish started the series with sharing information about the U.S. where the things are similar with some teachers needing to sleep in cars because of high-cost of living to some needing to turn to sex-work . I was shocked when I read the guardian article, that is no way to treat our teachers.I went on to read ‘How the American University was Killed‘ following the breadcrumbs along the way. Reading that it seems Indians have been following the American system playbook from the 1980’s itself. The article talks about HMO as well and that seems to have followed here as well with my own experience of hospital fees and drugs which I had to entail a few weeks/month ago.

Few years ago, when me and some of my friends had the teaching bug and we started teaching in a nearby municipal school, couple of teachers had shared that they were doing 2-3 jobs to make ends meet. I don’t know about others in my group, at least I was cynical because I thought all the teachers were permanent and they make good money only to realize now that the person was probably speaking the truth. When you have to do three jobs to make ends meet from where do you bring the passion to teach young people and that too outside the syllabus ?

Also, with this new knowledge in hindsight, I take back all my comments I made last year and the year before for the pathetic education being put up by the State. With teachers being paid pathetically/underpaid and almost 60% teachers being ad-hoc/adjunct teachers they have to find ways to have some sense of security. Most teachers are bachelors as they are poor and cannot offer any security (either male or female) and for women, after marriage it actually makes no sense for them to continue in this profession. I salute all the professors who are ad-hoc in nature and probably will never get a permanent position in their life.

I think in some way, thanx to him, that the government has chosen to give 7th pay commisson salary to teachers. While the numbers may appear be large, there are a lot of questions as to how many people will actually get paid. There needs to be lot of vacancies which need to be filled quickly but don’t see any solution in the next 2-3 years as well. The Government has taken a position to use/re-hire retired teachers rather than have new young teachers as an unwritten policy. In this Digital India context how are retired teachers supposed to understand and then pass on digital concepts is beyond me when at few teacher trainings I have seen they lack even the most basic knowledge that I learnt at least a decade or two ago, the difference is that vast. I just don’t know what to say to that. My own experience with my own mother who had pretty good education in her time and probably would have made a fine business-woman if she knew that she will have a child that she would have to raise by herself alone (along with maternal grand-parents) is testimonial to the fact how hard it is for older people to grasp technology and here I’m talking just using the interface as a consumer rather than a producer or someone in-between who has the idea of how companies and governments profit from whatever data is shared one way or the other.

After watching the series/episodes and discussing the issue with my mother it was revealed that both her and my late maternal grandfather were on casual/ad-hoc basis till 20-25 years in their service in the defense sector. If Ravish were to do a series on the defense sector he probably would find the same thing there. To add to that, the defense sector is a vital component to a country’s security. If 60% of the defense staff in all defense establishments have temporary staff how do you ensure the loyalty of the people working therein. That brings to my mind ‘Ignorance is bliss’.

Software development and deployment

There is another worry that all are skirting around, the present dispensation/government’s mantra is ‘minimum government-maximum governance’ with digital technologies having all solutions which is leading to massive unemployment. Also from most of the stories/incidents I read in the newspapers, mainstream media and elsewhere it seems most software deployments done in India are done without having any system of internal checks and balances. There is no ‘lintian‘ for software to be implemented. Contracts seem to be given to big companies and there is no mention of what prerequisites or conditions were laid down by the Government for software development and deployment and if any checks were done to ensure that the software being developed was in according to government specifications or not. Ideally this should all be in public domain so that questions can be asked and responsibility fixed if things go haywire, as currently they do not.

Software issues

As my health been not that great, I have been taking a bit more time and depth while filing bugs. #877638 is a good example. I suspect though that part of the problem might be that mate has moved to gtk3 while guake still has gtk-2 bindings. I also reported the issue upstream both in mate-panel as well as guake . I haven’t received any response from either or/and upstreams .

I also have been fiddling around with gdb to better understand the tool so I can exploit/use this tool in a better way. There are some commands within the gdb interface which seem to be interesting and hopefully I’ll try how the commands perform over days, weeks to a month. I hope we see more action on the mate-panel/guake bug as well as move of guake to gtk+3 but that what seemingly seemed like wait for eternity seems to have done by somebody in last couple of days. As shared in the ticket there are lots of things still to do but it seems the heavy lifting has been done but seems merging will be tricky as two developers have been trying to update to gtk+3 although aichingm seems to have a leg up with his 3! branch.

Another interesting thing I saw is the below picture.

The firefox version I was using to test the site/wordpress-wp-admin was Mozilla Firefox 52.4.0 which AFAIK is a pretty recentish one and people using Debian stretch would probably be using the same version (firefox stable/LTS) rather than the more recent versions. I went to the link it linked to and it gave no indication as to why it thought my browser is out-of-date and what functionality was/is missing. I have found that wordpress support has declined quite a bit and people don’t seem to use the forums as much as they used to before.

I also filed a few bugs for qalculate. #877716 where a supposedly transitional package removes the actual application, #877717 as the software has moved its repo. to github.com as well as tickets and other things in process and lastly #877733. I had been searching for a calculator which can do currency calculations on the fly (say for e.g. doing personal budgeting for Taiwan debconf) without needing to manually enter the conversion rates and losing something in the middle. While the current version has support for some limited currencies, the new versions promise more as other people probably have more diverse needs for currency conversions (people who do long or short on oil, stocks overseas is just one example, I am sure there are many others) than simplistic mine.


Filed under: Miscellenous Tagged: #American Education System, #bug-filing, #Climate change, #Dignity, #e-commerce, #gtk+3, #gtk2, #Indian Economy 'Slowdown', #Indian Education System, #Insolvency and Bankruptcy Code, #Las Vegas shooting, #Modern Retail in India, #planet-debian, #qalculate, Ad-hoc and Adjunct Professors, wordpress.com
Categories: FLOSS Project Planets

Valuebound: Extend existing field widgets in Drupal 8 application using annotation plugin

Planet Drupal - Fri, 2017-10-13 07:55

Have you ever wondered how the text or email or entity reference field is extended in Drupal 8? Or how to create a custom field/widget/formatter so that it can match with the rest of fields in your Drupal application? This blog will cover everything required to extend existing field widgets in Drupal 8 using annotation plugin. 

Many developers, who recently started working on Drupal 8, may not be aware of an entire process so let’s take a closer look to everything step-by-step. Key comparisons between Drupal 7 and Drupal 8, what is an annotation, why annotation and sample use case from an Inline Entity Form step-by-step. After completing this post, you will be able to extend the field with your own methods/functions without…

Categories: FLOSS Project Planets

Nuvole: How to maintain Drush commands for Drush 8 and 9 and Drupal console with the same code base.

Planet Drupal - Fri, 2017-10-13 04:48
Config Split treats all the cli the same.

Drupal 8.4 and its upgrade to Symfony 3 has made the compatibility of the global Drush 8 a bit more challenging. Drush 9 works with Drupal 8.4 but it is not stable yet and the format of how third party Drush commands are made has changed significantly.

While Drush 9 comes with a command that helps porting Drush 8 commands you will still end up maintaining very similar code in two places one with calls to drush_confirm('...') and one with $this->io()->confirm('...'). If you decide to also provide your commands for Drupal console you now have three times the burden.

Because we tried to provide the commands for Config Split for both Drush and Drupal console early on we faced this problem already more than a year ago. And now it has paid off because porting the commands to Drush 9 was very quick.

The solution is actually really simple and brings the added benefit of being able to test the business logic of the commands in the absence of Drush or Drupal console. It is all about separating the command discovery from the command logic. Drush 8, 9 and Drupal console all have a bit different ways to discover and invoke commands, but the business logic you want to implement is the same so all we have to do is to extract a common "interface" our custom service can implement and then make the command definitions wrap that and keep things DRY.

The CliService

Config Split defines a config_split.cli service with the class ConfigSplitCliService with all its dependencies injected. It has the methods \Drupal\config_split\ConfigSplitCliService::ioExport and \Drupal\config_split\ConfigSplitCliService::ioImport that implement all the commands logic and delegate the actual importing and exporting to specific methods.

The method signature for both the export and import method are more or less the same: CliService::ioMethod($arguments, $io, callable $t).

  • $arguments: The arguments passed to the command.
  • $io: This is an object that interacts with the command line, in Drush 9 and Drupal console this comes from the Symfony console component, for Drush 8 we created a custom wrapper around drush_confirm and drush_log called ConfigSplitDrush8Io.
  • $t: This is essentially a t function akin to how Drupal translates strings. Because Drupal console translates things differently we had to be a bit creative with that by adding a t method to the command.
Commands wrap the service

The Drush 8 command is essentially:

<?php
function drush_config_split_export($split = NULL) {
  // Make the magic happen.
  \Drupal::service('config_split.cli')->ioExport($split, new ConfigSplitDrush8Io(), 'dt');
}
?>

For Drush 9 we can use dependency injection and the Drush 9 command becomes essentially:

<?php
class ConfigSplitCommands extends DrushCommands {
  public function splitExport($split = NULL) {
    $this->cliService->ioExport($split, $this->io(), 'dt');
  }
}
?>

And very similar the Drupal console command:

<?php
class ExportCommand extends SplitCommandBase {
  protected function execute(InputInterface $input, OutputInterface $output) {
    $this->setupIo($input, $output);
    // Make the magic happen.
    $this->cliService->ioExport($input->getOption('split'), $this->getIo(), [$this, 't']);
  }
}
?> Testing

The ConfigSplitCliServiceTest is a KernelTest which asserts that the export works as expected by exporting to a virtual file system. The test coverage is not 100% (patches welcome) but the most important aspects for the complete and conditional splitting (blacklist/graylist) is thoroughly tested. There are no limitations on what or how you can test your CliService since it is self contained in your module and does not depend on Drush or the Drupal console. For example one could write a unit test with a mocked $io object that asserts that the messages printed to the cli are correct.

Tags: Drupal 8Drupal PlanetDrush
Categories: FLOSS Project Planets
Syndicate content