Quantcast
Channel: Planet Python
Viewing all 22869 articles
Browse latest View live

Matt Layman: wal-e Postgres Backups - Building SaaS #32

$
0
0
In this episode, we worked on Postgres database backups and modified the backup tool, wal-e, to use the Shiv app format. wal-e is Postgres database backup tool that works by managing the Write-Ahead Log (WAL) that a Postgres database produces. The WAL is the log of recent changes that happened in the database. If you have access to a full WAL, then you can conceivably reproduce a Postgres database’s data.

Continuum Analytics Blog: Machine Learning in Healthcare: 5 Use Cases that Improve Patient Outcomes

Mike Driscoll: Rotating Images in ReportLab

$
0
0

There are times when you want to rotate images or other objects in ReportLab while creating a PDF. For example, you might want to rotate an image by 45 degrees for watermarking purposes. Or you might need an image that runs vertically along one of the edges of the PDF.

You can rotate images by using ReportLab’s canvas methods or by using its higher level Flowables that you can find in the platypus. module. Let’s start by looking at how to do this with the canvas directly!


Rotating Images Using Canvas

Rotating images using the canvas is kind of confusing. The reason being that when you rotate the canvas, you may end up inadvertently rotating other elements on your canvas if you’re not careful.

Let’s take a look at the code:

# image_on_canvas.py 
from reportlab.libimport utils
from reportlab.lib.pagesizesimport letter
from reportlab.pdfgenimport canvas
 
 
def add_image(image_path):
    img = utils.ImageReader(image_path)
    img_width, img_height = img.getSize()
    aspect = img_height / float(img_width) 
    my_canvas = canvas.Canvas("canvas_image.pdf",
                              pagesize=letter)
    my_canvas.saveState()
    my_canvas.rotate(45)
    my_canvas.drawImage(image_path, 150, 10,
                        width=100, height=(100* aspect))
    my_canvas.restoreState()
    my_canvas.save() 
if __name__ == '__main__':
    image_path = 'snakehead.jpg'
    add_image(image_path)

Here you use ReportLab’s utils function to extract the image’s width and height. Then you create the canvas and save its current state. This will allow you to modify the canvas from this point forward and then restore it later. If you’d like to have some text or shapes before the rotated image, you would put that code before the call to saveState().

After saving the canvas state, you can use the canvas’s rotate() method to rotate the canvas 45 degrees. Then you draw the image to the canvas. Finally you use restoreState() to restore the state back to what it was before you rotated it.

Note: When rotating the canvas, the x/y position is now at a 45 degree angle, so you will have to take that into account while positioning the image on your canvas.

When I ran this code, I ended up with a document that looked like this:

Rotated image with ReportLab

You can also download the PDF here.

Now let’s find out how to do the same thing using a Flowable!


Rotating Images Using the Image Flowable

Flowables are objects in ReportLab that come from their platypus module, which stands for Page Layout and Typography Using Scripts. This module is basically a high-level interface to the canvas methods that abstracts the drawing bits away and makes creating multipage documents much simpler.

The quickest way to create a rotated image using a Flowable in ReportLab is to subclass the Image Flowable. Let’s take a look!

from reportlab.lib.pagesizesimport letter
from reportlab.platypusimport Image, SimpleDocTemplate
 
class RotatedImage(Image):
 
    def wrap(self, availWidth, availHeight):
        height, width = Image.wrap(self, availHeight, availWidth)return width, height
 
    def draw(self):
        self.canv.rotate(45)
        Image.draw(self) 
doc = SimpleDocTemplate("image_with_rotation.pdf", pagesize=letter)
flowables = [] 
img = RotatedImage('snakehead.jpg',
                   width=50, height=50)
img.hAlign = 'CENTER'
flowables.append(img)
doc.build(flowables)

Here you subclass Image and override the wrap() and draw() methods. The main piece that you will care about is in the draw() method where you call self.canv.rotate(45). The Image class has its own canvas in it that you can manipulate. In this case, you tell it that you want to always draw the image at a 45 degree angle.

Next you create a document template and create an instance of RotatedImage. Then you tell the image to be centered on the page. Finally you build() the document.

When you run this code, you should see the following:

Rotated image with ReportLab Flowable

You can get the actual PDF here if you’d rather see the file.


Wrapping Up

Now you know how to rotate images using ReportLab. You learned how to rotate an image using the low-level canvas methods and you also learned how to rotate an Image Flowable. You can use this knowledge to rotate other kinds of objects as well. For example, you can rotate text and shapes using the same methodology. You will always be rotating the canvas to get the needed effect. Have fun and happy coding!

Want to learn more about working with PDFs in Python? Then check out my book:

ReportLab: PDF Processing with Python

Purchase now on Leanpub


Related Reading

The post Rotating Images in ReportLab appeared first on The Mouse Vs. The Python.

Data School: Learn a new pandas trick every day!

$
0
0

Every weekday, I share a new "pandas trick" on social media. Each trick takes only a minute to read, yet you'll learn something new that will save you time and energy in the future!

Here's my latest trick:

Want to read the 59 tricks that I've already posted? See below 👇

Want to see the daily trick in your social media feed? Follow me on Twitter, Facebook, LinkedIn, and YouTube

Want to watch a live demo of my top 25 tricks?Watch this video🎥

Want to support daily pandas tricks? Become a Data School Insider🙏


Categories

Reading files

Creating example DataFrames

Renaming columns

Selecting rows and columns

Filtering rows by condition

Manipulating strings

Working with data types

Encoding data

Extracting data from lists

Working with time series data

Handling missing values

Using aggregation functions

Random sampling

Merging DataFrames

Styling DataFrames

Exploring a dataset

Other

Test and Code: 86: Teaching testing best practices with 4 testing maxims - Josh Peak

$
0
0

You've incorporated software testing into your coding practices and know from experience that it helps you get your stuff done faster with less headache.

Awesome.

Now your colleagues want in on that super power and want to learn testing.

How do you help them?

That's where Josh Peak is. He's helping his team add testing to their workflow to boost their productivity.

That's what we're talking about today on Test & Code.

Josh walks us through 4 maxims of developing software tests that help grow your confidence and proficiency at test writing.

Special Guest: Josh Peak.

Sponsored By:

Support Test & Code - Python Testing & Development

Links:

<p>You&#39;ve incorporated software testing into your coding practices and know from experience that it helps you get your stuff done faster with less headache.</p> <p>Awesome.</p> <p>Now your colleagues want in on that super power and want to learn testing.</p> <p>How do you help them? </p> <p>That&#39;s where Josh Peak is. He&#39;s helping his team add testing to their workflow to boost their productivity. </p> <p>That&#39;s what we&#39;re talking about today on Test &amp; Code.</p> <p>Josh walks us through 4 maxims of developing software tests that help grow your confidence and proficiency at test writing.</p><p>Special Guest: Josh Peak.</p><p>Sponsored By:</p><ul><li><a href="https://raygun.com" rel="nofollow">Raygun</a>: <a href="https://raygun.com" rel="nofollow">Detect, diagnose, and destroy Python errors that are affecting your customers. With smart Python error monitoring software from Raygun, you can be alerted to issues affecting your users the second they happen.</a></li></ul><p><a href="https://www.patreon.com/testpodcast" rel="payment">Support Test & Code - Python Testing & Development</a></p><p>Links:</p><ul><li><a href="https://joshpeak.net/posts/2019-07-22-from-zero-to-test.html" title="From Zero to Test: Turning hurdles into steps. " rel="nofollow">From Zero to Test: Turning hurdles into steps. </a></li><li><a href="https://joshpeak.net/posts/2019-06-18-Advanced-python-testing.html" title="Advanced Python Testing" rel="nofollow">Advanced Python Testing</a> &mdash; Posts</li><li><a href="https://pypi.org/project/pytest-vcr/" title="pytest-vcr" rel="nofollow">pytest-vcr</a></li><li><a href="https://vcrpy.readthedocs.io/en/latest/" title="VCR.py" rel="nofollow">VCR.py</a></li><li><a href="https://pypi.org/project/pytest-randomly/" title="pytest-randomly" rel="nofollow">pytest-randomly</a></li></ul>

TechBeamers Python: Multiline String in Python with Examples

$
0
0

This tutorial explains how to create a Python multiline string. It can be handy when you have a very long string. You shouldn’t keep such text in a single line. It kills the readability of your code. In Python, you have different ways to specify a multiline string. You can have a string split across multiple lines by enclosing it in triple quotes. Alternatively, brackets can also be used to spread a string into different lines. Moreover, backslash works as a line continuation character in Python. You can use it to join text on separate lines and create a multiline

The post Multiline String in Python with Examples appeared first on Learn Programming and Software Testing.

Wingware News: Wing Python IDE 7.1.1 - September 6, 2019

$
0
0

Wing 7.1.1 avoids slowing and dropping of remote development connections, fixes showing Pandas DataFrame and Series values, makes OS Commands work on remote hosts with Python 3, inspects remote extension modules with non-ascii characters in the interface, adds __init__ arguments to the auto-completer, allows ignoring exceptions in frozen importlib files, fixes line numbers shown in pytest exception tracebacks, and fixes other minor usability issues.


Wing 7.1.1 Screen Shot

Download Wing 7.1.1 Now:Wing Pro | Wing Personal | Wing 101 | Compare Products


Some Highlights of Wing 7.1


Support for Python 3.8

Wing 7.1 supports editing, testing, and debugging code written for Python 3.8, so you can take advantage of assignment expressions and other improvements introduced in this new version of Python.

Improved Code Warnings

Wing 7.1 adds unused symbol warnings for imports, variables, and arguments found in Python code. This release also improves code warnings configuration, making it easier to disable unwanted warnings.

Cosmetic Improvements

Wing 7.1 improves the auto-completer, project tool, and code browser with redesigned icons that make use of Wing's icon color configuration. This release also improves text display on some Linux systems, supports Dark Mode on macOS, and improves display of Python code and icons found in documentation.

And More

Wing 7.1 also adds support for Windows 10 native OpenSSH installations for remote development, and makes a number of other minor improvements. This release drops support for macOS 10.11. System requirements remain unchanged on Windows and Linux.

For details see the change log.

For a complete list of new features in Wing 7, see What's New in Wing 7.


Try Wing 7.1 Now!


Wing 7.1 is an exciting new step for Wingware's Python IDE product line. Find out how Wing 7.1 can turbocharge your Python development by trying it today.

Downloads:Wing Pro | Wing Personal | Wing 101 | Compare Products

See Upgrading for details on upgrading from Wing 6 and earlier, and Migrating from Older Versions for a list of compatibility notes.

Doug Hellmann: imapautofiler 1.8.1

$
0
0
imapautofiler applies user-defined rules to automatically organize messages on an IMAP server. What’s new in 1.8.1? Fix comparison with TZ aware datetime in TimeLimit rule (contributed by Nicolas Le Manchet)

Weekly Python StackOverflow Report: (cxciii) stackoverflow python report

$
0
0

ListenData: A Complete Guide to Linear Regression in Python

$
0
0
In this article we covered linear regression using Python in detail. It includes its meaning along with assumptions related to the linear regression technique. After completing this tutorial you will be able to test these assumptions as well as model development and validation in Python.
Table of Contents

Python : Linear Regression

Introduction to Linear Regression

Linear Regression is a supervised statistical technique where we try to estimate the dependent variable with a given set of independent variables. We assume the relationship to be linear and our dependent variable must be continuous in nature.
In the following diagram we can see that as horsepower increases mileage decreases thus we can think to fit linear regression. The red line is the fitted line of regression and the points denote the actual observations.

The vertical distance between the points and the fitted line (line of best fit) are called errors. The main idea is to fit this line of regression by minimizing the sum of squares of these errors. This is also known as principle of least squares.

Examples of Linear Regression

  • Estimating the price (Y) of a house on the basis of its Area (X1), Number of bedrooms (X2), proximity to market (X3) etc.
  • Estimating the mileage of a car (Y) on the basis of its displacement (X1), horsepower(X2), number of cylinders(X3), whether it is automatic or manual (X4) etc.
  • To find the treatment cost or to predict the treatment cost on the basis of factors like age, weight, past medical history, or even if there are blood reports, we can use the information from the blood report.
READ MORE »

Codementor: In Python How Recursion Works on Run Time

$
0
0
Photo by Martin Adams (https://unsplash.com/@martinadams?utmsource=unsplash&utmmedium=referral&utm_content=creditCopyText) on Unsplash...

Python Bytes: #146 Slay the dragon, learn the Python

Erik Marsja: How to Read & Write SPSS Files in Python using Pandas

$
0
0

The post How to Read & Write SPSS Files in Python using Pandas appeared first on Erik Marsja.

In this post we are going to learn 1) how to read SPSS (.sav) files in Python, and 2) how to write to SPSS (.sav) files using Python. 

Python is a great general-purpose language as well as for carrying out statistical analysis and data visualization. However, Python is not really user-friendly for data storage. Thus, often our data will be archived using Excel, SPSS or similar software.

How to open a .sav file in Python? There are some packages as Pyreadstat, and Pandas which allow to perform this operation. If we are working with Pandas, the   read_spss method will load a .sav file into a Pandas dataframe. Note, Pyreadstat will also create a Pandas dataframe from a SPSS file.

How to Open a SPSS file in Python

Here’s two simple steps on how to read .sav files in Python using Pandas (more details will be provided in this post):

  1. import pandas

    in your script type “import pandas as pd

  2. use read_spss

    in your script use the read_spss method:
    df = read_spss(‘PATH_TO_SAV_FILE”)

In this secion, we are going to learn how to load a SPSS file in Python using the Python package Pyreadstat. Before we use Pyreadstat we are going to install it. This Python package can be installed in two ways.

How to install Pyreadstat:

There are two very easy methods to install Pyreadstat.:

  1. Install Pyreadstat using pip:
    Open up a terminal, or windows command prompt, and type pip install pyreadstat
  2. Install using Conda:
    Open up a terminal, or windows command prompt, and type conda install -c conda-forge pyreadstat

How to Load a .sav File in Python Using Pyreadstat

Every time we run our Jupyter notebook, we need to load the packages we need. In the, Python read SPSS example below we will use Pyreadstat and, thus, the first line of code will import the package:

import pyreadstat

Now, we can use the method read_sav to read a SPSS file. Note that, when we load a file using the Pyreadstat package, recognize that it will look for the file in Python’s working directory. In the read SPSS file in Python example below, we are going to use this SPSS file. Make sure to download it and put it in the correct folder (or change the path in the code chunk below):

df, meta = pyreadstat.read_sav('./SimData/survey_1.sav')

In the code chunk above we create two variables; df, and meta. As can be seen when using type df is a Pandas dataframe:

type(df)

Thus, we can use all methods available for Pandas dataframe objects. In the next line of code, we are going to print the 5 first rows of the dataframe using pandas head method.

df.head()

See more about working with Pandas dataframes in the following tutorials:

How to Read a SPSS file in Python Using Pandas

Pandas can, of course, also be used to load a SPSS file into a dataframe. Note, however, we need to install the Pyreadstat package as, at least right now, Pandas depends on this for reading .sav files. As always, we need to import Pandas as pd:

import pandas as pd

Now, when we have done that, we can read the .sav file into a Pandas dataframe using the read_spss method. In the read SPSS example below, we read the same data file as earlier and print the 5 last rows of the dataframe using Pandas tail method. Remember, using this method also requires you to have the file in the subfolder “simData” (or change the path in the script).

df = pd.read_spss('./SimData/survey_1.sav')
df.tail()

Note, that both read_sav (Pyreadstat) and read_spss have the arguments “usecols”. By using this argument, we can also select which columns we want to load from the SPSS file to the dataframe:

cols = ['ID', 'Day', 'Age', 'Response', 'Gender']
df = pd.read_spss('./SimData/survey_1.sav', usecols=cols)
df.head()

How to Write a SPSS file Using Python

Now we are going to learn how to save Pandas dataframe to a SPSS file. It’s simpe, we will use the Pyreadstats write_sav method. The first argument should be the Pandas dataframe that is going to be saved as a .sav file.

pyreadstat.write_sav(df, './SimData/survey_1_copy.sav')

Remember to put the right path, as second argument, when using write_sav to save a .sav file.
Unfortunately, Pandas don’t have a to_spss method, yet. But, as Pyreadstats is a dependency of Pandas read_spss method we can use it to write a SPSS file in Python.

Summary: Read and Write .sav Files in Python

Now we have learned how to read and write .sav files using Python. It was quite simple and both methods are, in fact, using the same Python packages.

Here’s a Jupyter notebook with the code used in this Python SPSS tutorial.

The post How to Read & Write SPSS Files in Python using Pandas appeared first on Erik Marsja.

Mike Driscoll: PyDev of the Week: Aymeric Augustin

$
0
0

This week we welcome Aymeric Augustin (@aymericaugustin) as our PyDev of the Week. Aymeric is a core developer of Django, a Python web framework. He is also an entrepreneur and speaker at several Django related conferences. You can catch up with Aymeric over on his website or check out his FOSS contributions on Github. Let’s take a few moments to get to know him better!

Aymeric Augustin

Can you tell us a little about yourself (hobbies, education, etc):

Do you know how to spot a Frenchman? That’s always the first thing they mention! Now that’s out of the way…

These days my hobbies center around being the dad of three wonderful girls 🙂 We’re doing a lot of physical activity together: swimming, cycling, gardening, playing music, etc.

I’m managing a software engineering department of about 200 people at CANAL+, a French audiovisual media group that operates TV services in several countries.

I was trained as a generalist engineer, eventually specializing in Computer Science and Information Technology, but I learnt most of what I do on the job.

Why did you start using Python?

In 2006, a friend told me about this great, simple language called Python. At first I dismissed it: I said that PHP was simple enough for anything I wanted to do. This ranks quite high on the long list of stupid things I said 🙂

One year later, I was doing an internship at (now defunct) Zonbu, living the startup life in Palo Alto. That’s when I wrote my first Python application. It was a desktop GUI for encoding videos such that they’d play on iPods or on the just-released iPhone. I built it with PyGTK and glade. Under the hood, it ran mencoder and MP4box.

I dug out the source code from my archives for this interview. Not only did it use tabs for indentation and backslashes for line breaks, but it also sported an elegant logging system:

if __debug__:
    print("INFO: Initializing BackgroundEncoder")

Then, in 2009, in my first job, I wrote two non-trivial Python projects. I was working on an in-train entertainment portal. The first one centralized onboard communications between the web portal and the network infrastructure. The second one managed content synchronization depending on available network connectivity. I had discovered the concept of automated tests and I was very proud of my test coverage.

What other programming languages do you know and which is your favorite?

My first language was Basic, first FutureBASIC in 1995 and later TI-BASIC. Then a friend introduced me to HTML and the World Wide Web in 1997. Together, we made a website for our high school.

My Computer Science courses were mostly in Caml — a great language for the mathematically oriented but little known outside French academia, Java, and C. I also had the opportunity to try other interesting languages such as Erlang, Factor, Haskell, and Scheme.

I still enjoy writing small bits of C, mostly for Python extensions. I haven’t used Java since 1.5 was the latest and greatest. I can’t claim I still know it. I tried C# .NET around the same time. I didn’t like it because the documentation always told me what I knew already and never what I wanted to know.

Outside courses, I wrote a lot of PHP. If you’re reading this, you’re probably aware of the challenges of writing significant projects in PHP. However, I wouldn’t be here without PHP, so I’m grateful that it exists. Step by step, I went from static HTML to small dynamic bits, then to factoring out repeated sections, then to writing my own mini-framework, then to Python and Django. That was a good learning path.

Professionally, besides Python, I’ve been writing JavaScript and CSS. I taught myself modern full-stack development when I co-founded Otherwise— because being the CTO at a start-up means you’re the only developer at first. Earlier in my career, I also wrote some Ruby, but I was more comfortable with Django than with Rails.

Purely from a language perspective, I still like Caml a lot. I’m certainly romanticizing memories of when I learnt programming 🙂 Anyway, sometimes I feel like I’m a static typing fan lost in Python land!

What projects are you working on now?

I’m mostly maintaining websockets these days. That’s a good challenge in two areas where I still have a lot to learn: concurrent programming and good documentation.

Currently I’m thinking about decoupling the protocol from the I/O. I’d like to build alternatives based on trio and curio. However, this would be a large refactor of the current implementation based on asyncio. Its benefits are mostly theoretical. I’m still wondering if I really want to spend time there.

I started websockets when Guido van Rossum was building asyncio, which was called tulip then. I had a use case at work for which the WebSocket protocol seemed like a good match. Inspired by the marketing of requests, I decided to build an open source library that would become a success thanks to a great API. I missed that marketing was at least as important as API design 🙂 Still, websockets became modestly popular. I left that job a few months later. I never used websockets for anything in practice. It’s a hobby for me, which gives me a lot of freedom to experiment.

I’m struggling with an unintended consequence, though. Judging by GitHub issues, the main use case for websockets seems to be connecting to cryptocurrency trackers. I wish I wasn’t contributing, even indirectly, to this environmental disaster. (Bitcoin miners burn far too much coal and add far too much carbon dioxide to the atmosphere. I know about theoretical alternatives but I’m more interested in reality as it stands. Bitcoin consumes as much electricity as Austria and has no mainstream use case besides speculation and buying illegal goods.)

I understand why the open source ethos rejects restrictions on how software is used. Still, it’s frustrating to give my time and energy freely to people who act directly against my beliefs.

Which Python libraries are your favorite (core or 3rd party)?

I have only good things to say about whitenoise. It’s liberating to serve static files efficiently with a WSGI server and let a CDN do the rest.

I like challengers that fare better than the mainstream solution on one aspect I care about. I prefer waitress over gunicorn because it’s less vulnerable to slowloris attacks, so it doesn’t require setting up nginx. I use django-s3-storage rather than django-storages because its implementation of listdir() has decent performance. I recently started looking at trio as an alternative to asyncio and I like the design in theory. Hopefully I’ll also like it in practice.

I can’t pass this opportunity to plug one of my libraries 🙂 Check out datedelta. You’ll like it!

How did you become a core developer of Django?

I discovered Django in 2008 thanks to Jeremy Lainé. In January 2010, he asked for my opinion on a bug he was hitting and we filed a ticket. Jeremy was an experienced open source contributor already — he was a Debian Developer. He made me realize I could contribute to open source software!

On the day of my 25th birthday, I tried to contribute for the first time. A few days later, I managed to get my first patch committed — a JavaScript patch 🙂 I have no idea why I did that; I didn’t go any further. (As a side note, it’s pretty cool to have all that history preserved in public tools.)

In January 2011, when I started building the software for Autolib’, a car sharing service in Paris, I had the opportunity to choose the stack. I decided to go with Django and PostgreSQL. For the next three years, I’d work full time with Django, pushing it to its limits and beyond.

In March 2011, Stéphanie and I got married and I started contributing much more actively — hopefully a coincidence? At that time, it was hard to get a review for a patch. Django didn’t have fellows. I was frustrated by the low success rate of submitting patches.

In April 2011, Jacob Kaplan-Moss, BDFL of Django, made a 5-for-1 offer: triage five tickets and a core dev will review one. Exactly what I needed! I jumped on the opportunity and used it five times. I got the hang of triaging tickets and ended up handling 70 tickets in three weeks.

Around that time, I challenged myself to become a Django core developer. I think I was looking for the ego boost associated with the perceived prestige of that position, perhaps also for the ability to commit my own patches when no one cared. (In hindsight, I wish I’d had less selfish reasons, but that’s how it went. 2011 was a difficult year.)

So, I followed the manual. It said that would-be committers should contribute a major feature. Good. I went through the list of Google Summer of Code ideas. I looked for a feature that I could complete with minimal risks. I picked “Multiple timezone support for datetime representation”.

As a bonus, it would be useful for Autolib’. If a customer rented a car during the DST change, we couldn’t calculate the right duration and the right price. This wasn’t possible with Django 1.3 because it didn’t support timezone-aware datetimes.

I researched the issue thoroughly. In September, I sent a proposal on django-developers. That did the trick even before I wrote the code! Two weeks later, Carl Meyer proposed to add me to the core team. That’s how I became a core developer.

Finally, when the time zone support patch was ready, Luke Plant was kind enough to review it and I was thrilled to commit it by myself!

As you can see, I wouldn’t be there without a lot of luck, good advice from colleagues, help from fellow contributors, and the support of Stéphanie.

What excites you about Django?

Django grew quickly from a framework to an ecosystem to a community. Jacob Kaplan-Moss shaped the project that way. Many community members put an incredible amount of work to turn that opportunity into a massive success.

Do you know many technical communities where volunteers…

  • mentored 20k women by holding workshops in 500 cities in 100 countries?
  • fostered a local community until it was ready to organize a conference in Africa?
  • award a prize to those who welcome newcomers, freely give assistance, and help to grow the community?

And I haven’t even mentioned excellent conferences such as DjangoCon Europe and Django under the Hood.

From a technical perspective, Django is exciting because it’s boring. Who wants to spend time thinking about their framework rather than their app? Django and its ecosystem cover the needs of many web apps, large and small. It’s robust, well documented, well tested, and unfashionable. What else?

Is there anything else you’d like to say?

I find it most interesting to look at open source from an ecological perspective. There’ve been massive changes in the ecosystem over the past decade. We’re still at the beginning.

When looking at individual projects, often the picture is bleak. Most projects rely on a few key contributors who struggle with burnout. We haven’t figured out sustainability yet.

When looking at the broader picture, there’s more energy than ever. New projects get started all the time. Best practices are getting mature.

Django isn’t the hot new thing it was in 2008, but the DSF pays full-time fellows to ensure that it’s maintained well. Since 2014, I’ve been thinking the next frontier for Django was to make inroads in enterprise IT. I don’t know if that’s really going to happen, but it seems possible!

Today, volunteer time is the currency of open source. Tomorrow, money will play a bigger part. We don’t know how that will work yet. Corporate interactions with open source are often disappointing, but they’re improving as IT stakeholders get a better understanding of open source.

Open source will thrive if we keep the learning paths wide open and if we figure out how to organize larger efforts. It’s fine if millions of aspiring programmers write their own mini-frameworks: they’re building the skills to contribute to larger projects. We’ve seen a lot of progress in social norms in open source communities and in their codification. I hope we’ll develop governance practices that make it easier to scale large, community-driven open source projects!

Thanks for doing the interview, Aymeric

The post PyDev of the Week: Aymeric Augustin appeared first on The Mouse Vs. The Python.

Codementor: Conditional Execution in Python

$
0
0
A developer can set a conditional execution structure to develop into python code to manage a few kinds of Boolean and arithmetic operations.

EuroPython Society: EuroPython 2020: RFP for Venues

$
0
0

We are happy to announce that we have started the RFP for venues to host the EuroPython 2020 conference.

image

We have sent out the details to more than 40 venues.

Like last year, we also want to give the chance to other venues who were not on our list to participate in the RFP. For this purpose, we are making the details available in this blog post as well.

RFP Introduction

The EuroPython Society is the organization behind the EuroPython conference, the largest Python programming language conference in Europe, with more than 1100 professionals from IT, science and educational fields attending to learn about new developments, network and learn from experience of others in the field.

Python is a very popular open source programming language, with a large following in the web development and data science fields.

EuroPython was initiated in 2002, with the first conference in Charleroi, Belgium, and has since toured Europe for a total of 18 editions so far. For EuroPython 2020 we are looking for a new location and venue and are reaching out to potential venues.

If you’d like to participate in this process, please have a look at the RFP spreadsheet in form of an Excel spreadsheet with a quote section and list of questions, as well as our EuroPython 2019 sponsor brochure with more details about the conference, the demographics and our offerings for sponsors, to give you an idea of what we are looking for.

Please see the first tab in the spreadsheet for a description of the submission process. If you have questions, please write to board@europython.eu.

You can also check these other resources:

Timeline

This is the timeline for the RFP:

First round:

  • Start of RFP process: 2019-09-09
  • Deadline for RFP vendor questions: 2019-09-16
  • Vendor questions answered by: 2019-09-20
  • First round submission deadline: 2019-09-27
  • Second round candidates will be informed until: 2019-10-07

Second round:

  • Second round RFP questions posted: 2019-10-13
  • Deadline for RFP vendor questions: 2019-10-16
  • Vendor questions answered by: 2019-10-20
  • Final submission deadline: 2019-10-25
  • Final candidate will be informed until: 2019-10-30

RFP Resources

Many thanks,
– 
EuroPython Society Board
https://www.europython-society.org/

Catalin George Festila: Python 3.7.3 : Using the flask - part 018.

$
0
0
In this tutorial, I will show you how to fix auto increment in Flask SQLAlchemy. The old source code for the user model from the server.py was this: class User(db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) password = db.Column(db.String(120), unique=True) email = db.Column(db.String(120), unique=True) gender =

EuroPython: EuroPython 2020: RFP for Venues

$
0
0

europythonsociety:

We are happy to announce that we have started the RFP for venues to host the EuroPython 2020 conference.

image

We have sent out the details to more than 40 venues.

Like last year, we also want to give the chance to other venues who were not on our list to participate in the RFP. For this purpose, we are making the details available in this blog post as well.

RFP Introduction

The EuroPython Society is the organization behind the EuroPython conference, the largest Python programming language conference in Europe, with more than 1100 professionals from IT, science and educational fields attending to learn about new developments, network and learn from experience of others in the field.

Python is a very popular open source programming language, with a large following in the web development and data science fields.

EuroPython was initiated in 2002, with the first conference in Charleroi, Belgium, and has since toured Europe for a total of 18 editions so far. For EuroPython 2020 we are looking for a new location and venue and are reaching out to potential venues.

If you’d like to participate in this process, please have a look at the RFP spreadsheet in form of an Excel spreadsheet with a quote section and list of questions, as well as our EuroPython 2019 sponsor brochure with more details about the conference, the demographics and our offerings for sponsors, to give you an idea of what we are looking for.

Please see the first tab in the spreadsheet for a description of the submission process. If you have questions, please write to board@europython.eu.

You can also check these other resources:

Timeline

This is the timeline for the RFP:

First round:

  • Start of RFP process: 2019-09-09
  • Deadline for RFP vendor questions: 2019-09-16
  • Vendor questions answered by: 2019-09-20
  • First round submission deadline: 2019-09-27
  • Second round candidates will be informed until: 2019-10-07

Second round:

  • Second round RFP questions posted: 2019-10-13
  • Deadline for RFP vendor questions: 2019-10-16
  • Vendor questions answered by: 2019-10-20
  • Final submission deadline: 2019-10-25
  • Final candidate will be informed until: 2019-10-30

RFP Resources

Many thanks,
– 
EuroPython Society Board
https://www.europython-society.org/

Reuven Lerner: Learn and understand Python objects — with Weekly Python Exercise, starting September 17

$
0
0

I’ve found that many Python developers are confused by object-oriented programming in the language:

  • Newcomers to programming are confused by object-oriented ideas and terminology, while
  • Veteran programmers are surprised and confused by how Python objects work

No matter which camp you’re in, I have good news for you: Weekly Python Exercise will be starting a new cohort on September 17th, and it’s all about object-oriented programming in Python. Join me as we learn by doing, solving problems with objects, instances, classes, attributes, class attributes, and inheritance.

By the end of the course, you’ll understand how objects work, and will know how to use them in your own projects.

Join me and other Python developers from around the world in this upcoming cohort. To sign up, see samples, or learn more, just go to https://WeeklyPythonExercise.com/ . See you on the 17th!

The post Learn and understand Python objects — with Weekly Python Exercise, starting September 17 appeared first on Reuven Lerner.

Python Insider: Python 3.5.8rc1 is now available

Viewing all 22869 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>