Skip to main content

XPyCode Master - Python scripting for Excel with VBA-like interface

Reason this release was yanked:

error on mac

Project description

XPyCode

Python 3.9+ License: MIT + Commons Clause Platform: Windows Platform: Linux/macOS (experimental)

XPyCode is an Excel-Python integration platform that enables you to write, execute, and manage Python code directly within Microsoft Excel workbooks. It provides a seamless bridge between Excel and Python, featuring a full-featured IDE, custom function publishing, package management, and real-time debugging.

Project status

โš ๏ธ This version is at early stage. It is an Alpha version, almost Beta.

๐Ÿšจ Don't use for production or in sensitive environement ๐Ÿšจ

Help Keep the Project Alive

โญ Add a star in GitHub to promote the project

๐Ÿ’ต Donate (for instance 3โ‚ฌ per month)

๐Ÿ’ฌ Join the XPyCode Slack community to ask questions, share feedback, and connect with other users: ๐Ÿ‘‰ Invite link ๐Ÿ‘‰ Workspace

Features

  • ๐Ÿ Python Execution in Excel - Run Python code with full access to Excel objects
  • ๐Ÿ“ Integrated IDE - Monaco-based code editor with IntelliSense, syntax highlighting, and debugging
  • ๐Ÿ“ฆ Package Manager - Install and manage Python packages per workbook with dependency resolution
  • ๐Ÿ”ง Custom Functions (UDFs) - Publish Python functions as Excel formulas
  • ๐ŸŽฏ Event Handling - React to Excel events (worksheet changes, selections, etc.) with Python
  • ๐Ÿ” Object Management - Save and re-use objects in python kernel
  • ๐Ÿ› Debugger - Set breakpoints, step through code, and inspect variables
  • ๐ŸŽจ Theming - Customizable dark/light themes for the IDE

Requirements

  • Operating System: Windows 10/11 (64-bit) / Other platforms are enabled but not tested
  • Python: 3.9 or higher
  • Microsoft Excel: 2016 or later (with Office.js Add-in support)

Installation

pip install xpycode_master

Quick Start

  1. Install XPyCode:

    pip install xpycode_master
    
  2. Start the XPyCode Master server:

    python -m xpycode_master
    
  3. The Excel Add-in will be automatically registered.

    Open Excel and look for the XPyCode in Add-Ins -> More Add-Ins -> Shared Folder

  4. Launch in Excel:

    [Open Console] --> [<> Editor ]
    
  5. In XPyCode Editor

    • Add a python module: Right click on the workbook -> New Module
    • Start coding, using xpycode module:
    def updateExcelFromPython():
       import xpycode
       ws=xpycode.worksheets.getActiveWorksheet()
       rA1=ws.getRange("A1")
       rA1.values="Hello"
       rA1.format.fill.color="yellow"
    

Running as a Service

XPyCode can run as a system service for automatic startup:

# Install and start as a service
python -m xpycode_master service install

# Check status
python -m xpycode_master service status

# Stop service
python -m xpycode_master service stop

Supported on Windows, Linux (systemd), and macOS (launchd). See Service Management for details.

Upgrading

Check for and install updates:

# Check if an update is available
python -m xpycode_master --upgrade --check

# Upgrade interactively
python -m xpycode_master --upgrade

# Upgrade without confirmation
python -m xpycode_master --upgrade --yes

If XPyCode is running as a service, the upgrade process will automatically stop and restart the service.

Addin Hosting Modes

XPyCode supports two modes for running the Excel add-in:

External Mode (Default)

The add-in UI is served from https://addin.xpycode.com. This is the default mode and requires no certificate management.

python -m xpycode_master

Local Mode

The add-in UI is served from a local HTTPS server on your machine. Requires self-signed certificates.

python -m xpycode_master --use-local-addin

!!! warning "Mode Switch Cache Clearing" When switching between local and external modes, XPyCode will automatically clear the Office add-in cache. This affects all Office add-ins, not just XPyCode. You may need to restart Excel after switching modes.

Usage

Running Python Code

  1. Open a workbook in Excel
  2. Click "Open Console" in the XPyCode ribbon
  3. Open Editor with "<>" button
  4. Right click on the workbook name and add a python module
  5. Write Python code in the editor
  6. Press F5 or click "Run" to execute

Publishing Custom Functions

# In your module, define a function
def add_numbers(a: float, b: float) -> float:
    """Add two numbers together."""
    return a + b

Then use the Function Publisher in the IDE to expose it as an Excel formula: =ADD_NUMBERS(A1, B1)

Package Management

  1. Open the Package Manager panel in the IDE
  2. Search for a package (e.g., "pandas")
  3. Select version and optional extras
  4. Click "Install/Update" to install for the current workbook

Configuration

Configure themes, pypi urls, console preferences, ... in File/Settings menu

Excel Sample

You will find an Excel workbook sample in xpycode_master\excel_sample.

Dependencies

Core Dependencies

  • fastapi >= 0.100.0 - Web framework for the Business Layer API
  • uvicorn >= 0.22.0 - ASGI server for FastAPI
  • websockets >= 12.0 - WebSocket client/server implementation
  • aiohttp >= 3.8.0 - Async HTTP client for package index queries
  • packaging >= 21.0 - Version parsing and specifier handling
  • PySide6 >= 6.5.0 - Qt bindings for the IDE GUI (includes WebEngine for Monaco Editor embedding)
  • jedi >= 0.19.0 - Python autocompletion and static analysis
  • orjson >= 3.9.15 - Fast JSON serialization (recommended)
  • keyring >= 24.0.0 - Secure credential storage for AI providers
  • unearth >= 0.14.0 - Enhanced package discovery

Architecture

XPyCode consists of several interconnected components:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Excel Add-in  โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚  Business Layer โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚   Python IDE    โ”‚
โ”‚   (Office.js)   โ”‚     โ”‚    (FastAPI)    โ”‚     โ”‚   (PySide6)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                        โ”‚  Python Kernel  โ”‚
                        โ”‚  (per workbook) โ”‚
                        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • Excel Add-in: Office.js-based add-in providing the Excel interface
  • Business Layer: FastAPI server acting as message broker between components
  • Python Kernel: Per-workbook Python execution environment
  • Python IDE: PySide6-based development environment with Monaco Editor

License

This project is licensed under the MIT License with Commons Clause.

You are free to use, modify, and distribute this software for any purpose. However, you may not sell the software or include it as a substantial part of a commercial product or service.

See the LICENSE file for full details.

Author

BGE Advisory

Feedbacks

Contributions are welcome! Please feel free to submit issues.

Support

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xpycode_master-0.1.17.tar.gz (67.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

xpycode_master-0.1.17-py3-none-any.whl (67.5 MB view details)

Uploaded Python 3

xpycode_master-0.1.17-cp314-cp314t-win_amd64.whl (28.9 MB view details)

Uploaded CPython 3.14tWindows x86-64

xpycode_master-0.1.17-cp314-cp314t-win32.whl (28.5 MB view details)

Uploaded CPython 3.14tWindows x86

xpycode_master-0.1.17-cp314-cp314-win_amd64.whl (28.5 MB view details)

Uploaded CPython 3.14Windows x86-64

xpycode_master-0.1.17-cp314-cp314-win32.whl (28.3 MB view details)

Uploaded CPython 3.14Windows x86

xpycode_master-0.1.17-cp313-cp313-win_amd64.whl (27.9 MB view details)

Uploaded CPython 3.13Windows x86-64

xpycode_master-0.1.17-cp313-cp313-win32.whl (27.7 MB view details)

Uploaded CPython 3.13Windows x86

xpycode_master-0.1.17-cp312-cp312-win_amd64.whl (27.9 MB view details)

Uploaded CPython 3.12Windows x86-64

xpycode_master-0.1.17-cp312-cp312-win32.whl (27.7 MB view details)

Uploaded CPython 3.12Windows x86

xpycode_master-0.1.17-cp311-cp311-win_amd64.whl (28.0 MB view details)

Uploaded CPython 3.11Windows x86-64

xpycode_master-0.1.17-cp311-cp311-win32.whl (27.8 MB view details)

Uploaded CPython 3.11Windows x86

xpycode_master-0.1.17-cp310-cp310-win_amd64.whl (28.0 MB view details)

Uploaded CPython 3.10Windows x86-64

xpycode_master-0.1.17-cp310-cp310-win32.whl (27.8 MB view details)

Uploaded CPython 3.10Windows x86

xpycode_master-0.1.17-cp39-cp39-win_amd64.whl (28.0 MB view details)

Uploaded CPython 3.9Windows x86-64

xpycode_master-0.1.17-cp39-cp39-win32.whl (27.8 MB view details)

Uploaded CPython 3.9Windows x86

File details

Details for the file xpycode_master-0.1.17.tar.gz.

File metadata

  • Download URL: xpycode_master-0.1.17.tar.gz
  • Upload date:
  • Size: 67.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for xpycode_master-0.1.17.tar.gz
Algorithm Hash digest
SHA256 31d2ed6e62bdd85af1f36a3aff428306ab990ac12d832d66ce51c0e9e433e17c
MD5 95342366f84d5d711bc199c6aedb0d50
BLAKE2b-256 be9498272a91906539b82f44af0a3c70209e68669eb2b2c5ebae17a5c7e082f2

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-py3-none-any.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 9a272d6c92afc9642dc3b70ffcc268044d984751734f1bee4546d2051f6db720
MD5 d6f858e2ef01a5c147f752c2fd031395
BLAKE2b-256 b3266afc199274c4332427fbed22868e1bcc95521df0914bf0ab1b3f0dbe99d0

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 56f339a2b8ab66e58622bd840c4f19466daed96c8ca965873498910cfadc6582
MD5 ead6e686421b6d91c909fec484e7ce2d
BLAKE2b-256 17950223c46f08f21f5afbb8dda4a99ec3d202dd54c7002a54e86c00bc60bfff

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp314-cp314t-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 f554d956113a261b9b0aa28083d66d5e634c11d8ef4f330c56196c47a2e9a4ce
MD5 8426c6025371410f8e7f690d1cd54073
BLAKE2b-256 37039e7c172da1f907664f7bce4f90c527ca2cb0b951a8d7089f6fc8828b28c6

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 c5a5b1116641c0480107f354493ea1227ea415fa533e76b7d47915fdfe253b29
MD5 403d0a6b095e08c97901d8d8f7924cf2
BLAKE2b-256 8964940c7aa47bddd4cc6d4aa47dc3025705b0cad51b3daf3f58d8a9fe2606ab

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp314-cp314-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 9039d0ecf9f4a7d00dd670f18af4823835a6b69523fcfb9cdbe83655f772d7c0
MD5 1c7c28001d8bfe78a1c97aa2e8fa8057
BLAKE2b-256 da1ee40def4025d9d201749cfaf686c4128221c6b11bc89c34b18cb082fac0f0

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 33566b706517649313c70b2e585d30632ef7b17b4d5277e5f2386b2c6726ecef
MD5 48d5abb86476e3b2653138a95839d49a
BLAKE2b-256 8299a1fe9f20aa15e31848db4a416927c236c11d88d8773796ef5d9ccf471e10

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp313-cp313-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 41a57672f87141d0ef7ee4b8fbb94cb65f907d5178625548d1d8cf8eca06653e
MD5 94afaf8b0aa19cabcb339855124bca3f
BLAKE2b-256 a8b916a1931bf8d61fb4934f8f9a999c9d104a71651d5d00817eec9991a6dbdd

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 6d0032cc75a3b4fde72a9f4d3184a56470f1c883b1467846bcdd5035a4fac320
MD5 2e93c171f0b869a3647a22526e7f2fe8
BLAKE2b-256 c3a1b58316142606eef81d4b345a852bd79f72c01af77d3100dc11fdc795f7bb

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp312-cp312-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 a681dde101578c08eb9f5f9c3f3073a2e9ca864441a44555cdf2979f53160a94
MD5 b54aa9dc7199e6e68179b0a6ec7f1d2e
BLAKE2b-256 e03631bdfad75a299d7c74e7bfae36e713bc2c401ad7c245d32edd61e5a97bc7

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3d3b54773edac8017176f43ee92b044a762f89c904d1a5da44e3a01fe644b258
MD5 4feae0e5f5881b1a89fe4f0a1445cae9
BLAKE2b-256 e9f52824e82d5b0fefe5181f78b28e87e52d891bf3b72af0eb2d46e367b7a47b

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 944504cefb09bc96c3e2b147851f0e6fa955eb55e78fdc939a7104ced0240254
MD5 bb07a6ad22006f086b1652513560373c
BLAKE2b-256 bb7f01d84473a82e6443cce3c605dc3e3c48c30449b704408bbdfe656f226103

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 b15bcf7455270bde4c5945111c009b384d4a63e7c888a0d4ddd6d07ca5898a31
MD5 5a66f4525a05d8d43f6a044d506b658e
BLAKE2b-256 7904df1da6f2ef594ba5ca7a3e2df7cb38def642de18dd0316792c74db75185c

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 560f949fee26fe40bf544f2468cd7ee2a6bab01ad4d056ce2fe01a4faea8d259
MD5 c55a158571fd30ac28a668627c6acdc9
BLAKE2b-256 2a34276f1ad23dab4198964f4ca55d03f5f11887510aa2cc8be9fc0341d9d80b

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for xpycode_master-0.1.17-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4dd7670aedb77db9a57a8bf68a76e30206e57ba5dffe7ffaac5b0a3a3bb75dc8
MD5 f9b03acc73a730083c7918d0f6936f5e
BLAKE2b-256 eb8cf345073daf7389965c1190833a831587cefd445c0ace2fd7b6a6f3704339

See more details on using hashes here.

File details

Details for the file xpycode_master-0.1.17-cp39-cp39-win32.whl.

File metadata

  • Download URL: xpycode_master-0.1.17-cp39-cp39-win32.whl
  • Upload date:
  • Size: 27.8 MB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for xpycode_master-0.1.17-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 864e732762f31501ca0bf01dde58e39e68dae259da95e80dbbbe5fddbc0f09d4
MD5 c2aa2161555c9c32eb18260d141b69c5
BLAKE2b-256 ee84b19b1664f47e58cd1e990e8862c5a8f72f785e4b451cedf8929b8dbff470

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page