Skip to content

Managing mepo via rye

Purnendu Chakraborty edited this page Aug 12, 2024 · 9 revisions

We use rye to manage mepo.

Install rye

curl -sSf https://rye.astral.sh/get | bash

This would install the latest Python that is available at the time. For more details, see https://rye.astral.sh/guide/installation

Checkout mepo

git clone git@github.com:GEOS-ESM/mepo.git
cd mepo

Manage via rye

Print the current state of the project

rye show

This reads the project's pyproject.toml and would output something like

project: mepo
path: /path/to/mepo
venv: /path/to/mepo/.venv
target python: 3.9
venv python: cpython@3.9.19
virtual: false
configured sources:
  default (index: https://pypi.org/simple/)

Virtualenv

rye sync

This would download the targeted Python version, create the virtualenv .venv, install dependencies (for development), and install the executable mepo in .venv/bin

Downloading cpython@3.9.19  <--- Since we are targeting Python 3.9
Checking checksum
Unpacking
Downloaded cpython@3.9.19
Initializing new virtualenv in /Users/pchakrab/Workspace/tmp/mepo/.venv
Python version: cpython@3.9.19
Generating production lockfile: /Users/pchakrab/Workspace/tmp/mepo/requirements.lock
Generating dev lockfile: /Users/pchakrab/Workspace/tmp/mepo/requirements-dev.lock
Installing dependencies
   Built file:///Users/pchakrab/Workspace/tmp/mepo Built 1 editable in 728ms
Installed 29 packages in 74ms
 + astroid==3.2.1
 + black==24.4.2
 + cfgv==3.4.0
 + click==8.1.7
 + colorama==0.4.6
 + dill==0.3.8
 + distlib==0.3.8
 + filelock==3.14.0
 + flake8==7.0.0
 + identify==2.5.36
 + isort==5.13.2
 + mccabe==0.7.0
 + mdutils==1.6.0
 + mepo==2.0.0 (from file:///Users/pchakrab/Workspace/tmp/mepo)
 + mypy-extensions==1.0.0
 + nodeenv==1.8.0
 + packaging==24.0
 + pathspec==0.12.1
 + platformdirs==4.2.2
 + pre-commit==3.7.1
 + pycodestyle==2.11.1
 + pyflakes==3.2.0
 + pylint==3.2.0
 + pyyaml==6.0.1
 + setuptools==70.0.0
 + tomli==2.0.1
 + tomlkit==0.12.5
 + typing-extensions==4.11.0
 + virtualenv==20.26.2
Done!

Note

Rye downloads and installs Python installations itself. However, one can use an existing Python installation, but that needs to be registered with rye first (before running rye sync), via

rye toolchain register <PATH>

We are now ready to activate our virtualenv and start developing

source .venv/bin/activate

Build (for distribution)

Update version number in pyproject.toml and run

rye build

This creates mepo-<version>-py3-none-any.whl and mepo-<version>.tar.gz in the dist directory

Publish (to pypi.org)

rye publish
Clone this wiki locally