Skip to content


Repository files navigation


Build Status

Current BuildingSync version: 2.5.0.


pip install bsyncpy


  • poetry install
  • poetry run pre-commit install
  • Download, copy, or curl a BuildingSync schema into bsyncpy/bsyncpy
    • curl -L -o bsyncpy/BuildingSync-2.5.xsd
  • cd into bsyncpy/bsyncpy
  • Run generator: poetry run python BuildingSync-2.5.xsd
  • Go back to the root bsyncpy and run tests: poetry run pytest
  • Make sure formatting is good: poetry run pre-commit run --all-files
  • On commit, pre-commit should run again

Simple example


from lxml import etree
from bsyncpy import bsync

# Create a root and set the version attribute
root = bsync.BuildingSync()
root.set('version', '2.5.0')

# Valid element attributes can also be passed in as kwargs
f = bsync.Facilities(bsync.Facilities.Facility(ID='Facility-1'))

# Add the facilities.facility elements to the root
root += f

# write the document to disk
with open('output.xml', 'wb+') as f:
    output = etree.tostring(root.toxml(), pretty_print=True, doctype='<?xml version="1.0" encoding="UTF-8"?>')


<?xml version="1.0" encoding="UTF-8"?>
<BuildingSync version="2.5.0">
    <Facility ID="Facility-1"/>

Comprehensive example

Check out our example Jupyter Notebook here.

Updating Version

  • See the notes above on downloading and generating the new file.
  • Bump version in pyproject.toml file
  • Add/update CHANGELOG entry
  • Update (or add) generator test in .github/ci.yml
  • Update this README with the latest version of testing.

Releasing New Version

  • Bump version using poetry by calling poetry version X.Y.Z
  • Make sure is up to date
  • Create pull request to merge develop to main
  • git tag <version>. Version in the form of vX.Y.Z.
  • git push --tags.
  • Go to GitHub and convert the tag to a release.
  • poetry build
  • poetry publish. Login via pypi account.