Skip to content

Commit

Permalink
Added option to sort keys when exporting to JSON; Conda recipe updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bccheung committed Apr 30, 2021
1 parent 06c9ad9 commit 54ec195
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 WSP Canada Inc.
Copyright (c) 2021 WSP Canada Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 0 additions & 2 deletions conda_recipe/bld.bat

This file was deleted.

4 changes: 2 additions & 2 deletions conda_recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ source:
path: ../

build:
number: auto
noarch: python
script: python setup.py --quiet install --single-version-externally-managed --record record.txt

requirements:
host:
Expand All @@ -22,7 +22,7 @@ about:
home: https://github.com/wsp-sag/wsp-jacquard
license: MIT
license_file: LICENSE
summary: JSON-based configuration handler for models.
summary: JSON-based configuration handler for models

extra:
maintainers:
Expand Down
7 changes: 4 additions & 3 deletions jacquard/jacquard.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from six import iteritems, StringIO

from .api import (JacquardParseError, JacquardSpecificationError, JacquardTypeError, JacquardValue, is_identifier,
from .api import (JacquardParseError, JacquardSpecificationError, JacquardTypeError, JacquardValue, is_identifier,
open_file)


Expand Down Expand Up @@ -149,15 +149,16 @@ def serialize(self):
child_dict[attr] = item
return child_dict

def to_file(self, fp):
def to_file(self, fp, sort_keys=False):
"""Writes the Jacquard to a JSON file.
Args:
fp (str): File path to the output files
sort_keys (bool, optional): Defaults to ``True``.
"""
dict_ = self.serialize()
with open_file(fp, mode='w') as writer:
json.dump(dict_, writer, indent=2)
json.dump(dict_, writer, indent=2, sort_keys=sort_keys)

@classmethod
def from_file(cls, fp):
Expand Down
2 changes: 1 addition & 1 deletion jacquard/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.0'
__version__ = '1.0.1'
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
version = {}
with open(path.join(path.dirname(path.realpath(__file__)), 'jacquard', 'version.py')) as fp:
exec(fp.read(), {}, version)
version_string = safe_version(version['__version__'])

setup(
name='wsp-jacquard',
version=version_string,
version=safe_version(version['__version__']),
description='JSON-based configuration handler for models',
url='https://github.com/wsp-sag/wsp-jacquard',
author='WSP',
maintatiner='Brian Cheung',
maintainer='Brian Cheung',
maintainer_email='[email protected]',
classifiers=[
'License :: OSI Approved :: MIT License'
Expand Down

0 comments on commit 54ec195

Please sign in to comment.