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

Merge main into develop #317

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
23 changes: 10 additions & 13 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,23 @@ 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
python tests/test_mepo_commands.py -v
rye test -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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-12
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# mepo [![Actions Status](https://github.com/pchakraborty/mepo/workflows/Unit%20testing%20of%20mepo/badge.svg)](https://github.com/pchakraborty/mepo/actions) [![DOI](https://zenodo.org/badge/215067850.svg)](https://zenodo.org/badge/latestdoi/215067850) [![Rye](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/rye/main/artwork/badge.json)](https://rye-up.com)

`mepo` is a tool, written in Python3 (3.9.0+), to manage (m)ultiple git r(epo)sitories, by attempting to create an illusion of a 'single repository' for multi-repository projects. Please see the [Wiki](../../wiki) for examples of `mepo` workflows.
`mepo` is a tool, written in Python3, to manage (m)ultiple git r(epo)sitories, by attempting to create an illusion of a 'single repository' for multi-repository projects. Please see the [Wiki](../../wiki) for examples of `mepo` workflows.


## Installation

Expand All @@ -9,7 +10,7 @@
To install `mepo` using `pip`, run the following command:

```
`pip install mepo`
pip install mepo
```

### Homebrew
Expand All @@ -27,6 +28,14 @@ brew tap gmao-si-team/packages
brew install mepo
```

### Spack

Mepo is also available via spack as a package. To install mepo using spack, run the following command:

```
spack 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:
Expand Down
19 changes: 9 additions & 10 deletions etc/mepo-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

# complete -W "init clone status checkout branch diff where whereis history" mepo

# SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$(dirname $(realpath $0))

_get_mepo_commands() {
local mepo_cmd_list=""
if [[ "$OSTYPE" == "darwin"* ]]
then
local mepodir=$(dirname $(readlink $(which mepo)))
else
local mepodir=$(dirname $(readlink -f $(which mepo)))
fi
for mydir in $(ls -d ${mepodir}/mepo.d/command/*/); do
if [[ $mydir != *"__pycache__"* ]]; then
mepo_cmd_list+=" $(basename $mydir)"
fi
local mepo_dir=$(python3 $SCRIPT_DIR/mepo-path.py)
for pyfile in $(ls ${mepo_dir}/command/*.py*); do
command=${pyfile##*/} # remove path
command=${command%.*} # remove extension
command=$(echo $command | cut -d _ -f 1)
mepo_cmd_list+=" $command"
done
echo ${mepo_cmd_list}
}
Expand Down
3 changes: 3 additions & 0 deletions etc/mepo-path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import os, mepo

print(os.path.dirname(mepo.__file__))
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "mepo"
version = "2.0.0"
version = "2.1.0"
description = "A tool for managing (m)ultiple r(epo)s"
authors = [{name="GMAO SI Team", email="[email protected]"}]
dependencies = [
Expand All @@ -23,6 +23,7 @@ dev-dependencies = [
"flake8>=7.0.0",
"pre-commit>=3.7.1",
"mdutils>=1.6.0",
"pytest>=8.2.1",
]

[build-system]
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
6 changes: 6 additions & 0 deletions src/mepo/command/update-state.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Permanently convert mepo1 state to mepo2 state"""

from urllib.parse import urljoin

from ..state import MepoState
from ..git import get_current_remote_url


def run(_):
Expand All @@ -9,6 +12,9 @@ def run(_):
# mepo2 style does not exist
allcomps = MepoState.read_state()
MepoState.mepo1_patch_undo()
for comp in allcomps:
if comp.remote.startswith("../"):
comp.remote = urljoin(get_current_remote_url() + "/", comp.remote)
# Write new state
MepoState.write_state(allcomps)
print("\nConverted mepo1 state to mepo2\n")
Expand Down
Loading
Loading