Skip to content

Commit

Permalink
Merge pull request #14 from BuildingSync/feat/support-bsync-2.4
Browse files Browse the repository at this point in the history
Upgrade to BuildingSync Version 2.4
  • Loading branch information
nllong authored Nov 4, 2021
2 parents 9c980e8 + 33dbda7 commit ea06e16
Show file tree
Hide file tree
Showing 13 changed files with 2,622 additions and 3,350 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,19 @@ jobs:
- name: Install poetry
uses: abatilo/[email protected]

- name: Install poetry and pre-commit
- name: Install poetry (and update) and pre-commit
run: |
poetry install
poetry update
poetry run pre-commit install
- name: Run pre-commit
run: poetry run pre-commit run --all-files


- name: Run tests
run: poetry run pytest
run: poetry run pytest

- name: Run Generator (BuildingSync 2.4)
run: |
curl -L -o bsyncpy/BuildingSync-2.4.xsd https://github.com/BuildingSync/schema/releases/download/v2.4.0/BuildingSync.xsd
cd bsyncpy
poetry run python bsyncpy_generator.py BuildingSync-2.4.xsd
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.python-version
.idea
.vscode
.DS_Store
__pycache__
*.egg-info
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Version 0.2.0 (Unreleased)

* Generated for BuildingSync 2.4
* Renamed project folder to bsyncpy to follow Python package conventions
* Updated Poetry/Python dependencies

# Version 0.1.1

* Updated dependencies and regenerated bsync.py
Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

![Build Status](https://github.com/BuildingSync/bsyncpy/actions/workflows/ci.yml/badge.svg?branch=develop)

Currently generated by BuildingSync version:
- `2.3.0`
Current BuildingSync version: `2.4.0`.

## Generating
- `poetry install`
- `poetry run pre-commit install`
- Download, copy, or curl a BuildingSync schema into `bsyncpy/bsync`
- `curl -L -o bsync/BuildingSync-2.3.xsd https://github.com/BuildingSync/schema/releases/download/v2.3.0/BuildingSync.xsd`
- cd into `bsyncpy/bsync`
- Run generator: `poetry run python bsyncpy_generator.py BuildingSync-2.3.xsd`
- Go back to `bsyncpy` and run tests: `poetry run pytest`
- Download, copy, or curl a BuildingSync schema into `bsyncpy/bsyncpy`
- `curl -L -o bsyncpy/BuildingSync-2.4.xsd https://github.com/BuildingSync/schema/releases/download/v2.4.0/BuildingSync.xsd`
- cd into `bsyncpy/bsyncpy`
- Run generator: `poetry run python bsyncpy_generator.py BuildingSync-2.4.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

Expand All @@ -21,11 +20,11 @@ Currently generated by BuildingSync version:
*Input*
```python
from lxml import etree
from bsync import bsync
from bsyncpy import bsync

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

# Valid element attributes can also be passed in as kwargs
f = bsync.Facilities(bsync.Facilities.Facility(ID='Facility-1'))
Expand All @@ -42,7 +41,7 @@ with open('output.xml', 'wb+') as f:
*Output*
```xml
<?xml version="1.0" encoding="UTF-8"?>
<BuildingSync version="2.3.0">
<BuildingSync version="2.4.0">
<Facilities>
<Facility ID="Facility-1"/>
</Facilities>
Expand All @@ -52,3 +51,12 @@ with open('output.xml', 'wb+') as f:
## Comprehensive example

Check out our example Jupyter Notebook [here](https://nbviewer.jupyter.org/github/BuildingSync/schema/blob/develop-v2/docs/notebooks/bsync_examples/Small-Office-Level-1.ipynb).


# Updating Version

* See the notes above on downloading and generating the new bsync.py file.
* Bump version in `pyproject.toml` file
* Add CHANGELOG entry
* Update (or add) generator test in `.github/ci.yml`
* Update this README with the latest version of testing.
File renamed without changes.
Loading

0 comments on commit ea06e16

Please sign in to comment.