forked from aiidaplugins/aiida-lammps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- drop support for python<3.5 - remove six dependency - fix deprecation warnings - impore pre-commit code style - add tox.ini and docker-compose.yml for improved test infrastructure
- Loading branch information
1 parent
24df362
commit de95642
Showing
50 changed files
with
388 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ dist/ | |
*.egg* | ||
.DS_Store | ||
.idea/ | ||
.tox/ | ||
.pytest_cache/ | ||
.idea/vcs.xml | ||
postgres*.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"""Validate consistency of versions and dependencies. | ||
Validates consistency of setup.json and | ||
* environment.yml | ||
* version in aiida_lammps/__init__.py | ||
""" | ||
import json | ||
import os | ||
import sys | ||
|
||
import click | ||
|
||
FILENAME_SETUP_JSON = "setup.json" | ||
SCRIPT_PATH = os.path.split(os.path.realpath(__file__))[0] | ||
ROOT_DIR = os.path.join(SCRIPT_PATH, os.pardir) | ||
FILEPATH_SETUP_JSON = os.path.join(ROOT_DIR, FILENAME_SETUP_JSON) | ||
|
||
|
||
def get_setup_json(): | ||
"""Return the `setup.json` as a python dictionary.""" | ||
with open(FILEPATH_SETUP_JSON, "r") as handle: | ||
setup_json = json.load(handle) # , object_pairs_hook=OrderedDict) | ||
|
||
return setup_json | ||
|
||
|
||
@click.group() | ||
def cli(): | ||
"""Command line interface for pre-commit checks.""" | ||
pass | ||
|
||
|
||
@cli.command("version") | ||
def validate_version(): | ||
"""Check that version numbers match. | ||
Check version number in setup.json and aiida_lammos/__init__.py and make sure | ||
they match. | ||
""" | ||
# Get version from python package | ||
sys.path.insert(0, ROOT_DIR) | ||
import aiida_lammps # pylint: disable=wrong-import-position | ||
|
||
version = aiida_lammps.__version__ | ||
|
||
setup_content = get_setup_json() | ||
if version != setup_content["version"]: | ||
click.echo("Version number mismatch detected:") | ||
click.echo( | ||
"Version number in '{}': {}".format( | ||
FILENAME_SETUP_JSON, setup_content["version"] | ||
) | ||
) | ||
click.echo( | ||
"Version number in '{}/__init__.py': {}".format("aiida_lammps", version) | ||
) | ||
click.echo( | ||
"Updating version in '{}' to: {}".format(FILENAME_SETUP_JSON, version) | ||
) | ||
|
||
setup_content["version"] = version | ||
with open(FILEPATH_SETUP_JSON, "w") as fil: | ||
# Write with indentation of two spaces and explicitly define separators to not have spaces at end of lines | ||
json.dump(setup_content, fil, indent=2, separators=(",", ": ")) | ||
|
||
sys.exit(1) | ||
|
||
|
||
if __name__ == "__main__": | ||
cli() # pylint: disable=no-value-for-parameter |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.