Migrate to xlwings Server 1.0¶
This guide is for existing users upgrading from pre-1.0 versions. If you’re new to xlwings Server, follow the Quickstart instead.
Starting with v1.0, xlwings Server is distributed as a standard Python package instead of requiring you to work directly in the xlwings-server Git repository. This leads to the following improvements:
Proper support for
uvpackage manager, but flexibility to usepipor others if preferredNo more Git merge conflicts (update via
uvorpip)Simpler project structure with only the files you need
Package integrity verification via PyPI file hashes
Other key changes:
Python 3.10 is now the minimal supported version
Run the server via
uv run xlwings-serverinstead ofpython run.pypyproject.tomlcan now be used to configure the application in addition to.envand environment variables, see Settings. This is helpful for settings that are non-sensitive and the same across environments.
Migration¶
To allow for a clean migration, we leave the legacy project untouched and work with a new project.
Install uv, Python’s modern package manager. Run the following commands on a Terminal:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
curl -LsSf https://astral.sh/uv/install.sh | sh
Create a new uv project (I’ll be calling it
myprojecthere) and change into the directory (replace3.14with the Python version that you’re currently using):uv init --python=3.14 myproject cd myproject
Install
xlwings-serverandwatchfiles(for hot-reloading), then initialize xlwings-server:uv add xlwings-server uv add watchfiles --dev uv run xlwings-server init .
Run the migration command from your new project directory:
uv run xlwings-server migrate C:\path\to\old-project
Run the server to see if it starts correctly:
uv run xlwings-server
Stop the server again and go through the following list to migrate the additional items that affect you.
Additional Migration Steps¶
If you have custom static files other than
css/style.css,js/main.js, andimages/, copy them over fromapp/statictostatic.If you use Azure functions for deployment, run:
uv run xlwings-server add azure functions, then copy overlocal.settings.jsonfrom your old to your new project. Note that Azure functions require a traditionalrequirements.txtfile in the root of your project. If you useuv, run the following command before deploying (ideally, this is done automatically as part of your CI/CD pipeline):uv export --format requirements.txt -o requirements.txt.If you are using a custom
Usermodel: Runuv run xlwings-server add model user, then add back the logic fromapp/models/user.pytomodels/user.py. Note, there’s no need to inherit fromBaseUseranymore and the model has been simplified (no more properties).If you were using custom configuration in
app/config.py, runuv run xlwings-server add configand editconfig.pyaccordingly.If you are using custom authentication, copy
app/auth/custom/__init__.pyto/auth/custom/__init__.pyandapp/static/js/auth.jstostatic/js/auth.js.If you have custom FastAPI endpoints (e.g., added to
app/routers/taskpane.py), runuv run xlwings-server add routerand add them torouters/custom.py.If you have customized
app/auth/entraid/jwks.py, runuv run xlwings-server add auth entraidand replace the function inauth/entraid/jwks.pywith that fromapp/auth/entraid/jwks.py.If you use custom
Usermodels, authentication, or custom endpoints, make sure to change the imports into these:from xlwings_server.models import CurrentUserfrom xlwings_server.dependencies import Userfrom xlwings_server.templates import TemplateResponsefrom xlwings_server import settings