Minimum Makefile and buildout.cfg to create an environment with buildout

One of the tools to create a Python box garden environment is buildout. I wrote a Makefile to create a buildout environment

At the beginning...

It is assumed that Python and virtualenv are already available.

Expected operation

The expected commands are:

make build
Create a buildout environment.
make clean
Delete the buildout environment.
make rebuild
Recreate the buildout environment.

make does make build.

Makefile and buildout.cfg

Makefile

I often use Makefiles when running buildouts. The following example describes the minimum required operations.

Makefile


# -*- coding: utf-8 -*-
# Need virtualenv
.PHONY: all clean build rebuild

all: env bin/buildout build
	echo "buildout finished..."

clean:
	rm -rf bin parts eggs develop-eggs .installed env bootstrap.py

build: bin/buildout
	bin/buildout -c buildout.cfg

rebuild: clean build
	echo

bin/buildout: env
	curl https://raw.githubusercontent.com/buildout/buildout/master/bootstrap/bootstrap.py | env/bin/python

env:
	virtualenv --no-site-packages env
	env/bin/pip install -U setuptools

buildout.cfg You need the configuration file buyout.cfg for buildout. This setting does nothing.

buildout.cfg


[buildout]
parts =

Try to move

Constitution

The file has the above Makefile and buildout.cfg in the same directory.

(py3k)$ ls
Makefile	buildout.cfg

Create an environment

Let's create a make build.

(py3k)$ make build
virtualenv --no-site-packages env
Using real prefix '/home/examples/.anyenv/envs/pyenv/versions/3.4.2'
New python executable in env/bin/python3.4
Also creating executable in env/bin/python
Installing setuptools, pip...done.
env/bin/pip install -U setuptools
You are using pip version 6.0.3, however version 6.0.6 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
DEPRECATION: --download-cache has been deprecated and will be removed in the future. Pip now automatically uses and configures its cache.
Collecting setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-11.3.1-py2.py3-none-any.whl#md5=59cd761f2f2b926313bed7f83337e4d7
  Downloading setuptools-11.3.1-py2.py3-none-any.whl (500kB)
    100% |################################| 503kB 7.3MB/s 
Installing collected packages: setuptools
  Found existing installation: setuptools 8.2.1
    Uninstalling setuptools-8.2.1:
      Successfully uninstalled setuptools-8.2.1

Successfully installed setuptools-11.3.1
curl https://raw.githubusercontent.com/buildout/buildout/master/bootstrap/bootstrap.py > bootstrap.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6501  100  6501    0     0  17982      0 --:--:-- --:--:-- --:--:-- 18008
env/bin/python bootstrap.py
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/bin'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/parts'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/eggs'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/develop-eggs'.
Generated script '/home/examples/ng/var/src/develop/examples/buildout/simple/bin/buildout'.
bin/buildout -c buildout.cfg
(py3k)$    

Let's check inside the working directory.

(py3k)$ ls
Makefile	bin		buildout.cfg	develop-eggs	eggs		env		parts
Makefile
Makefile for manipulating buildout. I created it myself earlier.
bin
This is the directory where the commands installed in the buildout environment are installed. Created when you build build.
buildout.cfg
Configuration file for buildout. This config file will be used if you build build.
develop-eggs
This is the directory where your own packages under development will be installed. Since it is installed in the same state as it was put in with pip -e, A link for the Python package will be created in this directory.
eggs
The directory where packages are installed.
parts
Files that become parts such as package settings and tools are placed.

Delete the environment

(py3k)$ make clean
rm -rf bin parts eggs develop-eggs .installed env bootstrap.py

Confirm that you have deleted it.

(py3k)$ ls
Makefile	buildout.cfg

At this time, the environment created by virualenv is also used. It's already rooted.

Delete and create the environment

Now let's run build rebuild.


(py3k)$ make rebuild
rm -rf bin parts eggs develop-eggs .installed env bootstrap.py
virtualenv --no-site-packages env
Using real prefix '/home/examples/.anyenv/envs/pyenv/versions/3.4.2'
New python executable in env/bin/python3.4
Also creating executable in env/bin/python
Installing setuptools, pip...done.
env/bin/pip install -U setuptools
You are using pip version 6.0.3, however version 6.0.6 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
DEPRECATION: --download-cache has been deprecated and will be removed in the future. Pip now automatically uses and configures its cache.
Collecting setuptools from https://pypi.python.org/packages/3.4/s/setuptools/setuptools-11.3.1-py2.py3-none-any.whl#md5=59cd761f2f2b926313bed7f83337e4d7
  Downloading setuptools-11.3.1-py2.py3-none-any.whl (500kB)
    100% |################################| 503kB 3.4MB/s 
Installing collected packages: setuptools
  Found existing installation: setuptools 8.2.1
    Uninstalling setuptools-8.2.1:
      Successfully uninstalled setuptools-8.2.1

Successfully installed setuptools-11.3.1
curl https://raw.githubusercontent.com/buildout/buildout/master/bootstrap/bootstrap.py > bootstrap.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6501  100  6501    0     0  16741      0 --:--:-- --:--:-- --:--:-- 16755
env/bin/python bootstrap.py
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/bin'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/parts'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/eggs'.
Creating directory '/home/examples/ng/var/src/develop/examples/buildout/simple/develop-eggs'.
Generated script '/home/examples/ng/var/src/develop/examples/buildout/simple/bin/buildout'.
bin/buildout -c buildout.cfg
echo

(py3k)$ 

All I'm doing is do make clean and then make build.

Recommended Posts

Minimum Makefile and buildout.cfg to create an environment with buildout
Create an environment with virtualenv
Prepare an environment to use OpenCV and Pillow with AWS Lambda
How to create an NVIDIA Docker environment
Create an API to convert PDF files to TIF images with FastAPI and Docker
I tried to create an environment to check regularly using Selenium with AWS Fargate
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
An easy way to create an import module with jupyter
Create an OpenAI Gym environment with bash on Windows 10
Create an environment for test automation with AirtestIDE (Tips)
Building an environment to use CaboCha with google colaboratory
How to pass args or environment variables with Makefile and make command on #Linux
Steps to quickly create a deep learning environment on Mac with TensorFlow and OpenCV
Create an API with Django
Create an environment for "Deep Learning from scratch" with Docker
Create an LCD (16x2) game with Raspberry Pi and Python
I'm trying to create an authentication / authorization process with Django
Create an authentication feature with django-allauth and CustomUser in Django
Create a Todo app with Django ① Build an environment with Docker
[Python Kivy] How to create an exe file with pyinstaller
How to create dataframes and mess with elements in pandas
[Django] Memo to create an environment of Django + MySQL + Vue.js [Python]
Overview of Python virtual environment and how to create it
I tried to create an article in Wiki.js with SQLAlchemy
I came up with a way to create a 3D model from a photo Part 01 Creating an environment
I tried to create an environment of MkDocs on Amazon Linux
Try to create an execution path diff viewer with angr + bingraphvis
Try to create a python environment with Visual Studio Code & WSL
How to create a heatmap with an arbitrary domain in Python
Create an environment for Django x Apache x mod_wsgi with Vagrant (Ubuntu 16.04)
I tried to create Bulls and Cows with a shell program
Create an arbitrary machine learning environment with GCP + Docker + Jupyter Lab
Create a C ++ and Python execution environment with WSL2 + Docker + VSCode
Create a simple Python development environment with VS Code and Docker
How to build Python and Jupyter execution environment with VS Code
Create folders from '01' to '12' with python
Create an Excel file with Python3
How to create an email user
Create an age group with pandas
Environment construction with pyenv and pyenv-virtualenv
[For beginners] How to create an Alexa custom skill and link your account with Cognito's user pool
Challenge to create time axis list report with Toggl API and Python
Steps to create a Python virtual environment with VS Code on Windows
[Python] Create a linebot to write a name and age on an image
Prepare an environment to touch grib2 format files with python (Docker edition)
Create a Python3 environment with pyenv on Mac and display a NetworkX graph
I want to create an Ubuntu chrome User Profile with Colab only
(Note) A web application that uses TensorFlow to infer recommended song names [Create an execution environment with docker-compose]
How to prepare an environment with different python version and package for each project with pyenv-virtualenv on Amazon Linux
Create an application by classifying with Pygame
[Python] Building an environment with Anaconda [Mac]
Change Python 64bit environment to 32bit environment with Anaconda
Create an image processing viewer with PySimpleGUI
Note when creating an environment with python
[Python] Create a virtual environment with Anaconda
Quickly create an excel file with Python #python
Fractal to make and play with Python
Create Python + uWSGI + Nginx environment with Docker
Create and decrypt Caesar cipher with python
Create a virtual environment with Python_Mac version
Create an update screen with Django Updateview