Skip to content

Refactor the management of the configuration file#2349

Merged
sphuber merged 1 commit into
aiidateam:provenance_redesignfrom
sphuber:fix_2348_refactor_config_management
Dec 14, 2018
Merged

Refactor the management of the configuration file#2349
sphuber merged 1 commit into
aiidateam:provenance_redesignfrom
sphuber:fix_2348_refactor_config_management

Conversation

@sphuber
Copy link
Copy Markdown
Contributor

@sphuber sphuber commented Dec 13, 2018

Fixes #2348

The configuration file is now abstracted by the Config class.
Loading the configuration through aiida.manage.load_config will
now return a Config instance which internally keep the contents
of the configuration file of the AiiDA instace. Altering the config
will go through this object.

All configuration related code, such as settings and methods to setup
the configuration folder for a new AiiDA instance, are organized
in the aiida.manage.configuration module.

The configuration file is now abstracted by the `Config` class.
Loading the configuration through `aiida.manage.load_config` will
now return a `Config` instance which internally keep the contents
of the configuration file of the AiiDA instace. Altering the config
will go through this object.

All configuration related code, such as settings and methods to setup
the configuration folder for a new AiiDA instance, are organized
in the `aiida.manage.configuration` module.
@sphuber sphuber force-pushed the fix_2348_refactor_config_management branch from 8083674 to ecdf231 Compare December 13, 2018 17:12
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+6.7%) to 68.035% when pulling ecdf231 on sphuber:fix_2348_refactor_config_management into 65dfecb on aiidateam:provenance_redesign.

1 similar comment
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+6.7%) to 68.035% when pulling ecdf231 on sphuber:fix_2348_refactor_config_management into 65dfecb on aiidateam:provenance_redesign.

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 13, 2018

Coverage Status

Coverage decreased (-0.08%) to 68.081% when pulling ecdf231 on sphuber:fix_2348_refactor_config_management into 65dfecb on aiidateam:provenance_redesign.

Comment thread aiida/utils/json.py
try:
return simplejson.load(fhandle, encoding='utf8', **kwargs)
except simplejson.errors.JSONDecodeError:
raise IOError
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why IOError?

self.validate_profile(name)
return Profile(name, self.dictionary[self.KEY_PROFILES][name])

def add_profile(self, name, profile, store=True):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style preference: I would rather these functions didn't have a store parameter and instead just returned self and then the user could do config.add_profile(...).store()

@sphuber sphuber merged commit bd91e88 into aiidateam:provenance_redesign Dec 14, 2018
@sphuber sphuber deleted the fix_2348_refactor_config_management branch December 14, 2018 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants