=====<<< Pymod for MacPorts >>>=====================================================================
==
== The following lines capture the steps I followed to install
== 'pymod' to 'MacPorts' on macOS Monterey using 'pip3'.
==
== A "KLayout Python Module" is available under '/Applications/klayout.app/Contents/pymod-dist'
== as 'klayout-*.whl' for the 'pip3' tool.
==
== Ref: https://github.com/KLayout/klayout/issues/1040
==
== File: pymod-pip3-mp313.txt
== Author: kazzz-S
== Last modified: 2025-11-03 (as of KLayout version 0.30.4)
====================================================================================================

####################
### Installation ###
####################

MacBookPro2{kazzz-s}(1)$ pwd
/Applications/klayout.app/Contents/pymod-dist

MacBookPro2{kazzz-s}(2)$ ll
:
drwxr-xr-x  3 kazzz-s staff       96 11  3 10:27 .
drwxr-xr-x 10 kazzz-s staff      320 11  3 10:27 ..
-rw-r--r--  1 kazzz-s staff 21123218 11  3 10:26 klayout-0.30.4-cp313-cp313-macosx_15_0_x86_64.whl

MacBookPro2{kazzz-s}(3)$ which python3
/opt/local/bin/python3

MacBookPro2{kazzz-s}(4)$ python3 --version
Python 3.13.9

MacBookPro2{kazzz-s}(5)$ sudo -H pip3 install klayout-0.30.4-cp313-cp313-macosx_15_0_x86_64.whl
:
Processing ./klayout-0.29.6-cp312-cp312-macosx_14_0_x86_64.whl
Installing collected packages: klayout
Processing ./klayout-0.30.4-cp313-cp313-macosx_15_0_x86_64.whl
Installing collected packages: klayout
Successfully installed klayout-0.30.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour
with the system package manager, possibly rendering your system unusable.
It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv.
Use the --root-user-action option if you know what you are doing and want to suppress this warning.

MacBookPro2{kazzz-s}(6)$ sudo -H pip3 list | grep klayout
klayout           0.30.4

MacBookPro2{kazzz-s}(7)$ pwd
/opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages

MacBookPro2{kazzz-s}(8)$ ll -rt
:
:
drwxr-xr-x  41 root wheel   1312 11  3 10:53 klayout
drwxr-xr-x   4 root wheel    128 11  3 10:53 pya
drwxr-xr-x  10 root wheel    320 11  3 10:53 klayout-0.30.4.dist-info

MacBookPro2{kazzz-s} ~ (9)% python3
Python 3.13.9 (main, Oct 18 2025, 13:09:20) [Clang 17.0.0 (clang-1700.3.19.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import klayout
>>> help(klayout)

Help on package klayout:

NAME
    klayout

PACKAGE CONTENTS
    db (package)
    dbcore
    lay (package)
    laycore
    lib (package)
    lib_ant
    lib_db
    lib_edt
    lib_gsi
    lib_img
    lib_laybasic
    lib_layview
    lib_lib
    lib_lym
    lib_pex
    lib_pya
    lib_rba
    lib_rdb
    lib_tl
    libcore
    pex (package)
    pexcore
    pya (package)
    pyacore
    rdb (package)
    rdbcore
    tl (package)
    tlcore

VERSION
    0.30.4

FILE
    /opt/local/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/klayout/__init__.py
================================================================================

####################
###   Testing    ###
####################
Visit "https://www.klayout.org/klayout-pypi/" and save the Code in the name of "sample.py".

MacBookPro2{kazzz-s}(1)$ ll
:
drwxr-xr-x    8 kazzz-s staff  256 11  3 08:51 .
drwxr-xr-x+ 138 kazzz-s staff 4416 11  3 10:57 ..
-rw-r--r--    1 kazzz-s staff 1081 10 31 21:50 sample.py

MacBookPro2{kazzz-s}(2)$ python3 sample.py
MacBookPro2{kazzz-s}(3)$ ll
:
drwxr-xr-x    9 kazzz-s staff  288 11  3 10:58 .
-rw-r--r--    1 kazzz-s staff 1081 10 31 21:50 sample.py
-rw-r--r--    1 kazzz-s staff 6316 11  3 10:58 basic.gds <=== generated

[EOF]
