Skip to content

Commit

Permalink
Added ability to print version info (#309)
Browse files Browse the repository at this point in the history
* Add brew tap installation instructions (#302)

* Add brew tap installation instructions

* Add update-state to readme

* Added ability to print version info

* Updated Changelog

* Testing mepo version against the last release version number

* Removing lock files

We really shouldn't need to version control lock files. Reusing already existing virtualenv
Generating production lockfile: /home/pchakrab/workspace/code/mepo/develop/requirements.lock
Generating dev lockfile: /home/pchakrab/workspace/code/mepo/develop/requirements-dev.lock
Installing dependencies
Found existing installation: mepo 2.0.0
Uninstalling mepo-2.0.0:
  Successfully uninstalled mepo-2.0.0
Looking in indexes: https://pypi.org/simple/
Obtaining file:///. (from -r /home/pchakrab/tmp/tmpatm5q2yh (line 1))
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Checking if build backend supports build_editable: started
  Checking if build backend supports build_editable: finished with status 'done'
  Getting requirements to build editable: started
  Getting requirements to build editable: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing editable metadata (pyproject.toml): started
  Preparing editable metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: mepo
  Building editable for mepo (pyproject.toml): started
  Building editable for mepo (pyproject.toml): finished with status 'done'
  Created wheel for mepo: filename=mepo-2.0.0-py3-none-any.whl size=11085 sha256=758e0b5ae11be1d887f2598e6c04fc09648e00a736ffbe8ae47fbad802e2978f
  Stored in directory: /home/pchakrab/tmp/pip-ephem-wheel-cache-5f1wnqzn/wheels/97/54/f5/d849319cdfa096e074df352654ee2e7c919da8951f090690c6
Successfully built mepo
Installing collected packages: mepo
Successfully installed mepo-2.0.0
Done! will generate them from

* Removing lock files

Merging the changes from main brought in the lock files again

* Using rye for Python and package management

* Minor cleanup of workflows

---------

Co-authored-by: Matt Thompson <[email protected]>
  • Loading branch information
pchakraborty and mathomp4 authored Aug 13, 2024
1 parent 0da5ef4 commit d4495d3
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 119 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/run-formatter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ jobs:
runs-on: ubuntu-latest
name: Format code
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.lock
timeout-minutes: 5

- name: Checkout code
uses: actions/checkout@v4

- name: Install rye
uses: eifinger/setup-rye@v4

- name: Sync dependencies
run: rye sync

- name: Run black
run: black --check .
run: |
source .venv/bin/activate
black --check .
timeout-minutes: 5
24 changes: 12 additions & 12 deletions .github/workflows/run-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ jobs:
runs-on: ubuntu-latest
name: Lint code
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.lock
timeout-minutes: 5
- name: Checkout code
uses: actions/checkout@v4

- name: Install rye
uses: eifinger/setup-rye@v4

- name: Sync dependencies
run: rye sync

- name: Run pylint
run: pylint --exit-zero src/mepo
run: |
source .venv/bin/activate
pylint --exit-zero src/mepo
timeout-minutes: 5
22 changes: 10 additions & 12 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,24 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12', 'pypy-3.9', 'pypy-3.10']
python-version: ["3.9", "3.10", "3.11", "3.12", "pypy@3.9", "pypy@3.10"]

name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
- name: Install rye
uses: eifinger/setup-rye@v4

- name: Sync dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.lock
timeout-minutes: 5
rye pin ${{ matrix.python-version }}
rye sync
- name: Run tests
run: |
export PYTHONPATH=$(pwd)/src:$PYTHONPATH
source .venv/bin/activate
python tests/test_mepo_commands.py -v
timeout-minutes: 5
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
68 changes: 0 additions & 68 deletions requirements-dev.lock

This file was deleted.

14 changes: 0 additions & 14 deletions requirements.lock

This file was deleted.

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

0 comments on commit d4495d3

Please sign in to comment.