Skip to content
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
35 changes: 12 additions & 23 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
#!/usr/bin/env bash

# Read expected Python version from .python-version file
EXPECTED_VERSION=$(cat .python-version 2>/dev/null || echo "3.11.2")

# Check if pyenv is available and install the correct version if needed
if command -v pyenv >/dev/null 2>&1; then
if ! pyenv versions --bare | grep -q "^${EXPECTED_VERSION}$"; then
echo "Installing Python ${EXPECTED_VERSION} using pyenv..."
pyenv install ${EXPECTED_VERSION}
fi
if [[ -x "${PWD}/.devenv/bin/devenv" ]]; then
DEVENV="${PWD}/.devenv/bin/devenv"
elif command -v devenv >/dev/null 2>&1; then
DEVENV="devenv"
fi

PYTHON_VERSION=$(python3 --version 2>&1 | cut -d' ' -f2)
if [[ ! "$PYTHON_VERSION" == "$EXPECTED_VERSION"* ]]; then
echo "Warning: Expected Python $EXPECTED_VERSION, but found $PYTHON_VERSION"
echo "Ensure pyenv is installed and the .python-version file is respected"
# Prever but don't require devenv. We also support a globally installed uv.
if [[ -n "$DEVENV" ]]; then
$DEVENV sync
PATH_add "${PWD}/.devenv/bin"
fi

# Create virtual environment if it doesn't exist
if [[ ! -d .venv ]]; then
echo "Creating Python virtual environment in .venv..."
python3 -m venv .venv
echo "Virtual environment created successfully!"
echo "Installing base packages..."
.venv/bin/pip install --upgrade pip setuptools wheel
echo "Installing requirements..."
.venv/bin/pip install -r requirements-dev.txt
if ! command -v uv >/dev/null 2>&1; then
echo "ERROR: Please install devenv (https://github.com/getsentry/devenv) or uv (https://docs.astral.sh/uv/)"
return 1
fi

# Activate the virtual environment
uv sync --all-groups
source .venv/bin/activate

source_env_if_exists .envrc.private
15 changes: 15 additions & 0 deletions devenv/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[devenv]
minimum_version = 1.22.0

[uv]
darwin_arm64 = https://github.com/astral-sh/uv/releases/download/0.9.3/uv-aarch64-apple-darwin.tar.gz
darwin_arm64_sha256 = d6b2eaa1025b24b4779602763ad92f20112cbf19732fc6e0c72bb57a6a592c6c
darwin_x86_64 = https://github.com/astral-sh/uv/releases/download/0.9.3/uv-x86_64-apple-darwin.tar.gz
darwin_x86_64_sha256 = ad57ed22bf793267ea97cfc0022afa096149e894dd161ee4ae5401b7c4a6db83
linux_arm64 = https://github.com/astral-sh/uv/releases/download/0.9.3/uv-aarch64-unknown-linux-gnu.tar.gz
linux_arm64_sha256 = 2094a3ead5a026a2f6894c4d3f71026129c8878939a57f17f0c8246a737bed1d
linux_x86_64 = https://github.com/astral-sh/uv/releases/download/0.9.3/uv-x86_64-unknown-linux-gnu.tar.gz
linux_x86_64_sha256 = 4d6f84490da4b21bb6075ffc1c6b22e0cf37bc98d7cca8aff9fbb759093cdc23
# used for autoupdate
version = 0.9.3

16 changes: 16 additions & 0 deletions devenv/sync.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from devenv import constants
from devenv.lib import config, uv


def main(context: dict[str, str]) -> int:
reporoot = context["reporoot"]
cfg = config.get_repo(reporoot)

uv.install(
cfg["uv"]["version"],
cfg["uv"][constants.SYSTEM_MACHINE],
cfg["uv"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)

return 0
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[project]
name = "objectstore"
version = "0.1.0"
requires-python = ">=3.13"

[dependency-groups]
dev = ["devservices>=1.2.2"]
1 change: 0 additions & 1 deletion requirements-dev.txt

This file was deleted.

141 changes: 141 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.