Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to print version info #309

Merged
merged 10 commits into from
Aug 13, 2024
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*~
*.pyc
*.egg-info
*.lock
dist
venv

Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added ability to print version info via `mepo --version`

### Changed

## [2.0.0] - 2024-08-09
## [2.0.0] - 2024-08-12

### Fixed

Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,42 @@

## Installation

### Using pip

To install `mepo` using `pip`, run the following command:

```
`pip install mepo`
```

### Homebrew

Using Homebrew, you can install `mepo` by installing from the gmao-si-team tap:

```
brew install gmao-si-team/packages/mepo
```

This is equivalent to running:

```
brew tap gmao-si-team/packages
brew install mepo
```

## Transitioning from `mepo` v1.x to v2.x

If you try to use mepo v2.x within a mepo v1.x repository, you will get an warning message:
```
Detected mepo1 style state
Run <mepo update-state> to permanently convert to mepo2 style
```

To update your repository to work with mepo v2.x, you can run the following command:
```
mepo update-state
```
and it will convert the repository from mepo v1 pickle-state to mepo v2 json-state.

## Commands

Expand Down
35 changes: 13 additions & 22 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
# with-sources: false

-e file:.
astroid==3.2.1
astroid==3.2.4
# via pylint
black==24.4.2
black==24.8.0
cfgv==3.4.0
# via pre-commit
click==8.1.7
Expand All @@ -21,10 +21,10 @@ dill==0.3.8
# via pylint
distlib==0.3.8
# via virtualenv
filelock==3.14.0
filelock==3.15.4
# via virtualenv
flake8==7.0.0
identify==2.5.36
flake8==7.1.1
identify==2.6.0
# via pre-commit
isort==5.13.2
# via pylint
Expand All @@ -34,35 +34,26 @@ mccabe==0.7.0
mdutils==1.6.0
mypy-extensions==1.0.0
# via black
nodeenv==1.8.0
nodeenv==1.9.1
# via pre-commit
packaging==24.0
packaging==24.1
# via black
pathspec==0.12.1
# via black
platformdirs==4.2.2
# via black
# via pylint
# via virtualenv
pre-commit==3.7.1
pycodestyle==2.11.1
pre-commit==3.8.0
pycodestyle==2.12.1
# via flake8
pyflakes==3.2.0
# via flake8
pylint==3.2.0
pyyaml==6.0.1
pylint==3.2.6
pyyaml==6.0.2
# via mepo
# via pre-commit
setuptools==70.0.0
# via nodeenv
tomli==2.0.1
# via black
# via pylint
tomlkit==0.12.5
# via pylint
typing-extensions==4.11.0
# via astroid
# via black
tomlkit==0.13.0
# via pylint
virtualenv==20.26.2
virtualenv==20.26.3
# via pre-commit
2 changes: 1 addition & 1 deletion requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
-e file:.
colorama==0.4.6
# via mepo
pyyaml==6.0.1
pyyaml==6.0.2
pchakraborty marked this conversation as resolved.
Show resolved Hide resolved
# via mepo
7 changes: 7 additions & 0 deletions src/mepo/cmdline/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
from ..utilities import mepoconfig


def get_version():
from importlib import metadata

return metadata.version("mepo")


class MepoArgParser:

__slots__ = ["parser", "subparsers"]
Expand All @@ -16,6 +22,7 @@ def __init__(self):
self.parser = argparse.ArgumentParser(
description="Tool to manage (m)ultiple r(epo)s"
)
self.parser.add_argument("--version", action="version", version=get_version())
self.subparsers = self.parser.add_subparsers()
self.subparsers.title = "mepo commands"
self.subparsers.required = True
Expand Down
4 changes: 4 additions & 0 deletions tests/test_mepo_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import mepo.command.diff as mepo_diff
import mepo.command.whereis as mepo_whereis
import mepo.command.reset as mepo_reset
from mepo.cmdline.parser import get_version as get_mepo_version

# Import commands with dash in the name
mepo_restore_state = importlib.import_module("mepo.command.restore-state")
Expand Down Expand Up @@ -335,6 +336,9 @@ def test_reset(self):
with contextlib.redirect_stdout(io.StringIO()) as output:
self.__class__.__mepo_clone()

def test_mepo_version(self):
self.assertEqual(get_mepo_version(), "2.0.0")

def tearDown(self):
pass

Expand Down