Current BuildingSync version: 2.5.0.
pip install bsyncpy
poetry installpoetry run pre-commit install- Download, copy, or curl a BuildingSync schema into
bsyncpy/bsyncpycurl -L -o bsyncpy/BuildingSync-2.5.xsd https://github.com/BuildingSync/schema/releases/download/v2.5.0/BuildingSync.xsd
- cd into
bsyncpy/bsyncpy - Run generator:
poetry run python bsyncpy_generator.py BuildingSync-2.5.xsd - Go back to the root
bsyncpyand run tests:poetry run pytest - Make sure formatting is good:
poetry run pre-commit run --all-files - On commit, pre-commit should run again
Input
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"?>')
f.write(output)Output
<?xml version="1.0" encoding="UTF-8"?>
<BuildingSync version="2.5.0">
<Facilities>
<Facility ID="Facility-1"/>
</Facilities>
</BuildingSync>Check out our example Jupyter Notebook here.
- See the notes above on downloading and generating the new bsync.py file.
- Bump version in
pyproject.tomlfile - Add/update CHANGELOG entry
- Update (or add) generator test in
.github/ci.yml - Update this README with the latest version of testing.
- Bump version using poetry by calling
poetry version X.Y.Z - Make sure CHANGELOG.md is up to date
- Create pull request to merge
developtomain 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 buildpoetry publish. Login via pypi account.