From 1b379a0710f1087f518873bba8f7e5661ef1ad5d Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Mon, 12 Aug 2024 09:57:51 -0400 Subject: [PATCH 1/8] Add brew tap installation instructions (#302) * Add brew tap installation instructions * Add update-state to readme --- CHANGELOG.md | 2 +- README.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f0d8d4..8b65a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -## [2.0.0] - 2024-08-09 +## [2.0.0] - 2024-08-12 ### Fixed diff --git a/README.md b/README.md index 5bf8a88..588388e 100644 --- a/README.md +++ b/README.md @@ -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 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 From ae4d5a0e9c97765e86dc6b2c809558bedb63a9fa Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Mon, 12 Aug 2024 12:25:41 -0400 Subject: [PATCH 2/8] Added ability to print version info --- src/mepo/cmdline/parser.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mepo/cmdline/parser.py b/src/mepo/cmdline/parser.py index cddd3f2..4cee79d 100644 --- a/src/mepo/cmdline/parser.py +++ b/src/mepo/cmdline/parser.py @@ -8,6 +8,12 @@ from ..utilities import mepoconfig +def get_version(): + from importlib import metadata + + return metadata.version("mepo") + + class MepoArgParser: __slots__ = ["parser", "subparsers"] @@ -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 From 37a3175abcf9ee5571a24e07b45f4e0252020a19 Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Mon, 12 Aug 2024 12:36:10 -0400 Subject: [PATCH 3/8] Updated Changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f0d8d4..577c6c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ 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 From aa05f5242efa14efb6d0bdbbc83eb78babcaef6d Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Mon, 12 Aug 2024 14:55:02 -0400 Subject: [PATCH 4/8] Testing mepo version against the last release version number --- tests/test_mepo_commands.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_mepo_commands.py b/tests/test_mepo_commands.py index b610f82..19966da 100644 --- a/tests/test_mepo_commands.py +++ b/tests/test_mepo_commands.py @@ -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") @@ -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 From 0b71055b124e7141f9e584f3e603a8c236730f63 Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Mon, 12 Aug 2024 14:57:37 -0400 Subject: [PATCH 5/8] 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 --- .gitignore | 1 + requirements-dev.lock | 35 +++++++++++++---------------------- requirements.lock | 2 +- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 07e88d2..5f155ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *~ *.pyc *.egg-info +*.lock dist venv diff --git a/requirements-dev.lock b/requirements-dev.lock index 15f19a7..ba8e35a 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -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 @@ -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 @@ -34,9 +34,9 @@ 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 @@ -44,25 +44,16 @@ 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 diff --git a/requirements.lock b/requirements.lock index 7cecfb7..45f2324 100644 --- a/requirements.lock +++ b/requirements.lock @@ -10,5 +10,5 @@ -e file:. colorama==0.4.6 # via mepo -pyyaml==6.0.1 +pyyaml==6.0.2 # via mepo From b55a27c954222ad01a8d583ee415e1a9eb3b2540 Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Mon, 12 Aug 2024 16:42:07 -0400 Subject: [PATCH 6/8] Removing lock files Merging the changes from main brought in the lock files again --- requirements-dev.lock | 59 ------------------------------------------- requirements.lock | 14 ---------- 2 files changed, 73 deletions(-) delete mode 100644 requirements-dev.lock delete mode 100644 requirements.lock diff --git a/requirements-dev.lock b/requirements-dev.lock deleted file mode 100644 index ba8e35a..0000000 --- a/requirements-dev.lock +++ /dev/null @@ -1,59 +0,0 @@ -# generated by rye -# use `rye lock` or `rye sync` to update this lockfile -# -# last locked with the following flags: -# pre: false -# features: [] -# all-features: false -# with-sources: false - --e file:. -astroid==3.2.4 - # via pylint -black==24.8.0 -cfgv==3.4.0 - # via pre-commit -click==8.1.7 - # via black -colorama==0.4.6 - # via mepo -dill==0.3.8 - # via pylint -distlib==0.3.8 - # via virtualenv -filelock==3.15.4 - # via virtualenv -flake8==7.1.1 -identify==2.6.0 - # via pre-commit -isort==5.13.2 - # via pylint -mccabe==0.7.0 - # via flake8 - # via pylint -mdutils==1.6.0 -mypy-extensions==1.0.0 - # via black -nodeenv==1.9.1 - # via pre-commit -packaging==24.1 - # via black -pathspec==0.12.1 - # via black -platformdirs==4.2.2 - # via black - # via pylint - # via virtualenv -pre-commit==3.8.0 -pycodestyle==2.12.1 - # via flake8 -pyflakes==3.2.0 - # via flake8 -pylint==3.2.6 -pyyaml==6.0.2 - # via mepo - # via pre-commit -tomlkit==0.13.0 - # via pylint -virtualenv==20.26.3 - # via pre-commit diff --git a/requirements.lock b/requirements.lock deleted file mode 100644 index 45f2324..0000000 --- a/requirements.lock +++ /dev/null @@ -1,14 +0,0 @@ -# generated by rye -# use `rye lock` or `rye sync` to update this lockfile -# -# last locked with the following flags: -# pre: false -# features: [] -# all-features: false -# with-sources: false - --e file:. -colorama==0.4.6 - # via mepo -pyyaml==6.0.2 - # via mepo From 2a4f9f9ce9d8e7d4c3ef8a35787785fed64329d1 Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Mon, 12 Aug 2024 16:56:59 -0400 Subject: [PATCH 7/8] Using rye for Python and package management --- .github/workflows/run-formatter.yaml | 25 ++++++++++++++----------- .github/workflows/run-linter.yaml | 24 +++++++++++++----------- .github/workflows/run-tests.yaml | 22 ++++++++++------------ 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/.github/workflows/run-formatter.yaml b/.github/workflows/run-formatter.yaml index 2d42054..103f01d 100644 --- a/.github/workflows/run-formatter.yaml +++ b/.github/workflows/run-formatter.yaml @@ -7,17 +7,20 @@ jobs: runs-on: ubuntu-latest name: Format code steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install rye + uses: eifinger/setup-rye@v4 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 + enable-cache: true + + - name: Sync dependencies + run: rye sync + - name: Run black - run: black --check . + run: | + source .venv/bin/activate + black --check . timeout-minutes: 5 diff --git a/.github/workflows/run-linter.yaml b/.github/workflows/run-linter.yaml index 0607441..5adc214 100644 --- a/.github/workflows/run-linter.yaml +++ b/.github/workflows/run-linter.yaml @@ -7,17 +7,19 @@ jobs: runs-on: ubuntu-latest name: Lint code steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install rye + uses: eifinger/setup-rye@v4 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 + enable-cache: true + + - 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 diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index bbddc13..ae2a7bb 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -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 From aaf146c5d83b86db5215022f62486801a5ac767e Mon Sep 17 00:00:00 2001 From: Purnendu Chakraborty Date: Mon, 12 Aug 2024 18:39:00 -0400 Subject: [PATCH 8/8] Minor cleanup of workflows --- .github/workflows/run-formatter.yaml | 2 -- .github/workflows/run-linter.yaml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/run-formatter.yaml b/.github/workflows/run-formatter.yaml index 103f01d..a061e61 100644 --- a/.github/workflows/run-formatter.yaml +++ b/.github/workflows/run-formatter.yaml @@ -13,8 +13,6 @@ jobs: - name: Install rye uses: eifinger/setup-rye@v4 - with: - enable-cache: true - name: Sync dependencies run: rye sync diff --git a/.github/workflows/run-linter.yaml b/.github/workflows/run-linter.yaml index 5adc214..a3251c6 100644 --- a/.github/workflows/run-linter.yaml +++ b/.github/workflows/run-linter.yaml @@ -12,8 +12,6 @@ jobs: - name: Install rye uses: eifinger/setup-rye@v4 - with: - enable-cache: true - name: Sync dependencies run: rye sync