Skip to main content

Buildout custom Python interpreter

Menggunakan Buildout, kita boleh generate custom Python interpreter khusus untuk kegunaan projek buildout ini dengan sys.path disetkan kepada eggs dalam projek ini. Berikut contoh buildout.cfg yang digunakan:-


[buildout]
newest = false
parts = pylons python
find-links = http://pylonshq.com/download/0.9.7
develop = .

[python]
recipe = zc.recipe.egg
interpreter = python

[pylons]
recipe = zc.recipe.egg
eggs =
nose>=0.11.1
Paste>=1.7.2
PasteScript>=1.7.3
PasteDeploy>=1.3.3
Pylons==0.9.7
SQLAlchemy==0.5.5
Jinja2==2.1.1


Tapi apabila run, dapat error:-


We have no distributions for python that satisfies 'python'.
Getting distribution for 'python'.
We have a develop egg: setuptools 0.6c9
Running easy_install:
/usr/bin/python "-c" "from setuptools.command.easy_install import main; main()" "-mUNxd" "/home/kamal/webapps/clinic-pylons/eggs/tmpflXKv-" "-q" "/usr/lib/python2.5/lib-dynload"
path=/usr/lib/python2.5/site-packages

error: Couldn't find a setup script in /usr/lib/python2.5/lib-dynload
An error occured when trying to install Python 2.5.2.Look above this message for any errors thatwere output by easy_install.
While:
Installing python.
Getting distribution for 'python'.
Error: Couldn't install: Python 2.5.2


Yang buat aku bengang adalah sebelum ini tidak apa-apa masalah, menggunakan komputer yang sama. Puas Google tapi tak jumpa sebarang penyelesaian. Nampak macam aku sorang je ada masalah ini.

Hari ini, bila tengok balik buildout.cfg tersebut dan bandingkan error message yang keluar, baru aku nampak kesilapannya.


[buildout]
parts = pylons python

[python]
recipe = zc.recipe.egg
interpreter = python


Deklarasi di atas bermaksud untuk install Python, bukannya generate custom interpreter untuk projek aku. Buildout rupanya, bila kita tak nyatakan egg yang hendak di'install', akan cuba download egg dengan nama 'part-name' yang mana dalam kes ini adalah Python.

Deklarasi yang betul adalah:-


[buildout]
newest = false
parts = pylons
find-links = http://pylonshq.com/download/0.9.7
develop = .

[pylons]
recipe = zc.recipe.egg
interpreter = python
eggs =
nose>=0.11.1
Paste>=1.7.2
PasteScript>=1.7.3
PasteDeploy>=1.3.3
Pylons==0.9.7
SQLAlchemy==0.5.5
Jinja2==2.1.1


Masukkan je option untuk interpreter dalam part 'pylons', tak perlu kepada part yang khusus untuk install interpreter.

Comments

Popular posts from this blog

PHP with docker

A friend asking about a PHP library and I decided to test whether that library is working. But I don't have PHP environment setup (we're Python shop btw). But thanks to docker, that's easy these days. docker run -it --tty --rm --volume $PWD:/app --user $(id -u):$(id -g) composer require google/apiclient:^2.0 Then we just need to create the script to run, still in the same directory:- include_once __DIR__ . '/vendor/autoload.php'; $GCSE_API_KEY = "nqwkoigrhe893utnih_gibberish_q2ihrgu9qjnr"; $GCSE_SEARCH_ENGINE_ID = "937592689593725455:msi299dkne4de"; $client = new Google_Client(); $client->setApplicationName("My_App"); $client->setDeveloperKey($GCSE_API_KEY); $service = new Google_Service_Customsearch($client); $optParams = array("cx"=>self::GCSE_SEARCH_ENGINE_ID); $results = $service->cse->listCse("lol cats", $optParams); And we can run that script again using docker:- docker run -it --...

AI coding tools fragmentation

Executive Summary The discussion centers on a tweet by DHH (David Heinemeier Hansson) from January 10, 2026 , arguing against the fragmentation of AI coding tools. DHH contends that developers do not want a separate CLI for every model provider (e.g., Anthropic’s Claude Code, OpenAI’s tools). Instead, he advocates for a unified interface —specifically citing OpenCode —that allows developers to swap models within a single environment. The thread reveals a three-way tension in the developer community between convenience (unified tools), corporate control (walled gardens), and sovereignty (running local models). Key Discussion Themes 1. The Fatigue of Fragmentation The Problem: Developers are exhausted by "model choice fatigue" and the need to manage multiple CLIs. As Rob Zolkos noted, the fragmentation is absurd, leading some to write scripts just to manage their AI CLIs. The Desire: There is a strong consensus (DHH, Will McGugan, Mustafa Ergisi) that a "universal s...

How to build your own programming language

I've always fascinated in how programming languages are built and have made it into my 2017's new year resolution to learn building one myself. So here are all the notes collected along the way. My presentation at Malaysia Open Source Conference - How to build your programming language ?  I plan to extend this presentation at upcoming PyCon APAC  in this August with an example in Python. A write up in Malay - Bagaimana bahasa pengaturcaraan dibina ? A series on building simple interpreter in Python by Ruslan Plivak - Let's Build a Simple Interpreter ! A book on writing an interpreter with Go (Golang). I'm still making up my mind whether to buy this or not -  https://interpreterbook.com/ . Free book on building interpreter using Java and then C . This is not complete yet but the author also recommend Interpreter book above in his reply to my reddit's comment. (Updates 2020: It's complete now!) List of reddit's threads related to chapters in t...