Back to home

blog/

python-pipenv

Version: 0.7.1

Last Updated: Unknown


Basic Lift Template

Use this tempalate to generate new lift projects.

Required

VariableData TypeInfo
namestringName of the blog post

Module files

1---
2basedir: content/blog
3---
4---
5date: "<%= name.split('-').filter((_data, index) => index < 3).join("-") %>"
6image: https://cdn.dennisokeeffe.com/assets/<%= name %>/main-image.png
7title: <%= _.startCase(name.split('-').filter((_data, index) => index >= 3)) %>
8description: <%= description %>
9tags: "beginner,python,100daysofpython"
10icons: "dok,python"
11series:
12 - "100 Days of Python": 0
13---
14
15> This is Day TODO of the #100DaysOfPython challenge.
16
17This post will use the ... library to ... .
18
19The final code can be found on my GitHub repo [`okeeffed/<%= name.split('-').filter((_data, index) => index >= 3).join("-") %>`](https://github.com/okeeffed/<%= name.split('-').filter((_data, index) => index >= 3).join("-") %>).
20
21## Prerequisites
22
231. Familiarity with [Pipenv](https://pipenv.pypa.io/en/latest/). See [here](https://blog.dennisokeeffe.com/blog/2020-07-04-abcs-of-pipenv) for my post on Pipenv.
242. Familiarity with [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/gettingstarted/install.html). See [here](https://blog.dennisokeeffe.com/blog/2021-07-19-hello-jupyter-notebook) for my post on JupyterLab.
253. ...
26
27## Getting started
28
29Let's create the `hello-world` directory and install Pillow.
30
31```s
32# Make the `hello-world` directory
33$ mkdir hello-world
34$ cd hello-world
35# Create a folder to place your icons
36$ mkdir icons
37
38# Init the virtual environment
39$ pipenv --three
40$ pipenv install pillow
41$ pipenv install --dev jupyterlab
42```
43
44At this stage, ...
45
46Now we can start up the notebook server.
47
48```s
49# Startup the notebook server
50$ pipenv run jupyter-lab
51# ... Server is now running on http://localhost:8888/lab
52```
53
54The server will now be up and running.
55
56## Creating the notebook
57
58Once on http://localhost:8888/lab, select to create a new Python 3 notebook from the launcher.
59
60Ensure that this notebook is saved in `hello-world/docs/<your-file-name>`.
61
62We will create four cells to handle four parts of this mini project:
63
641. ...
65
66## ...
67
68This section simply loads the image in var `base_img` (assuming you are following the directory structure where the notebook is in the `docs` folder).
69
70```py
71from PIL import Image
72# Concatenating an image
73base_img = Image.open('../base_img.png')
74```
75
76## Summary
77
78Today's post demonstrated how to use the `Pillow` package to add text and icons layers to an image programmatically.
79
80This will be the technique I use for helping to build out my blog post main images (including this one!).
81
82## Resources and further reading
83
841. [The ABCs of Pipenv](https://blog.dennisokeeffe.com/blog/2020-07-04-abcs-of-pipenv)
852. [Hello, JupyterLab](https://blog.dennisokeeffe.com/blog/2021-07-19-hello-jupyter-notebook)
863. [Pipenv](https://pipenv.pypa.io/en/latest/)
874. [`okeeffed/<%= name.split('-').filter((_data, index) => index >= 3).join("-") %>`](https://github.com/okeeffed/<%= name.split('-').filter((_data, index) => index >= 3).join("-") %>)
88
89_Photo credit: [`user`](https://unsplash.com/@user)_

Install


Lift generate


Repository

https://github.com/okeeffed/pkg-lift-blog

Sections