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
2,239 changes: 1,423 additions & 816 deletions .circleci/conda-lock-3.10.yml

Large diffs are not rendered by default.

1,914 changes: 1,319 additions & 595 deletions .circleci/conda-lock-3.11.yml

Large diffs are not rendered by default.

22,630 changes: 22,630 additions & 0 deletions .circleci/conda-lock-3.12.yml

Large diffs are not rendered by default.

1,872 changes: 1,298 additions & 574 deletions .circleci/conda-lock-3.9.yml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
shell: /bin/bash -xl
command: |
PYTHON_VERSION="<< parameters.python-version >>"
if [ "${PYTHON_VERSION}" == "3.12" ]; then
if [ "${PYTHON_VERSION}" == "3.13" ]; then
LOCKFILE_PATH="conda-lock.yml"
else
LOCKFILE_PATH=".circleci/conda-lock-${PYTHON_VERSION}.yml"
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
shell: /bin/bash -xl
command: |
PYTHON_VERSION="<< parameters.python-version >>"
if [ "${PYTHON_VERSION}" == "3.12" ]; then
if [ "${PYTHON_VERSION}" == "3.13" ]; then
python -m pip install coveralls
python .circleci/fix_coverage_paths.py .coverage ${PWD}/tools/RAiDER/
coverage report -mi --show-missing --data-file=.coverage
Expand All @@ -94,4 +94,4 @@ workflows:
- build:
matrix:
parameters:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
47 changes: 24 additions & 23 deletions .circleci/regenerate-locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,54 @@
import tempfile
from pathlib import Path

import yaml
from tqdm import tqdm

from RAiDER.logger import logger

# RAiDER's supported Python versions. The last entry in the list will be placed
# in the project root.
VERSIONS = [
'3.9',
'3.10',
'3.11',
'3.12',
]

# The dependencies entry for python.
# First group: " - python"
# Second group: ">=3.9" or any version specification
PATTERN_PYTHON_DEP = re.compile(r'^(\s*-\s*python)([<>=~]?=?.+$)', re.MULTILINE)

ENVIROMENT_YML_PATH = Path('environment.yml')
# Matches the "dependencies" entry for python.
# First group: like " - python"
# Second group: like ">=3.8"
PATTERN_PYTHON_DEP = re.compile(r'^(\s*-\s*python)([<>=~]?=?.+)$', re.MULTILINE)


def generate_lock(out_path: Path, version: str, template: str) -> None:
"""
Use conda-lock to generate a lockfile for this version of the
environment.yml file, and place it at the specified output path.
"""
logger.info(f'Generating lockfile for Python {version}...')
with tempfile.TemporaryDirectory() as tmp_dir_str:
tmp_dir = Path(tmp_dir_str)
env_path = tmp_dir / 'environment.yml'
env_path = Path(tmp_dir_str) / 'environment.yml'

# Hardcode a copy of the environment.yml file to this Python version
with env_path.open('w', encoding='utf-8') as f_env:
f_env.write(re.sub(PATTERN_PYTHON_DEP, f'\\1=={version}', template))
f_env.write(re.sub(PATTERN_PYTHON_DEP, f'\\1={version}', template))

# Platforms explicitly listed in order to exclude win-64, since isce3
# and wand (and therefore RAiDER) are not compatible with Windows.
cmd = f'conda-lock --file {env_path} --lockfile {out_path} -p linux-64 -p osx-64 -p osx-arm64'
cmd = f'conda-lock -f {env_path} --lockfile {out_path} -p linux-64 -p osx-64 -p osx-arm64'
logger.debug(f'>>> {cmd}')
result = subprocess.run(cmd.split(' '), stdout=subprocess.PIPE, text=True)
if result.returncode != 0:
raise Exception(f'Command exited with non-zero status code {result.returncode}: "{cmd}"')
raise Exception(f'Command exited with non-zero status {result.returncode}: "{cmd}"')


def main() -> None:
with ENVIROMENT_YML_PATH.open(encoding='utf-8') as fin:
yml_content = fin.read()
"""(Re)generates a lockfile for each Python version in .circleci/config.yml."""
with Path('environment.yml').open(encoding='utf-8') as f_env:
yml_content = f_env.read()

# Read RAiDER's supported Python versions from CircleCI config.
# The last entry in the list will be placed in the project root.
with Path('.circleci/config.yml').open(encoding='utf-8') as f_ci_config:
versions: list[str] = yaml.safe_load(f_ci_config) \
['workflows']['all-tests']['jobs'][0] \
['build']['matrix']['parameters']['python-version']

for i, version in tqdm(enumerate(VERSIONS), total=len(VERSIONS), unit='lockfiles written'):
if i < len(VERSIONS) - 1:
for i, version in tqdm(enumerate(versions), total=len(versions), unit='lockfiles written'):
if i < len(versions) - 1:
generate_lock(Path(f'.circleci/conda-lock-{version}.yml'), version, yml_content)
else:
generate_lock(Path('conda-lock.yml'), version, yml_content)
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### Added
* [762](https://github.com/dbekaert/RAiDER/pull/762) - Added lockfiles through conda-lock to the repo, documentation, and CircleCI runners.
* [761](https://github.com/dbekaert/RAiDER/pull/761) - Added Python 3.13 support.
* [747](https://github.com/dbekaert/RAiDER/pull/747) - Added support for run config time format `%H:%M:%S` (without quotes).
* [746](https://github.com/dbekaert/RAiDER/pull/746) - Added support for numpy v2.
* [725](https://github.com/dbekaert/RAiDER/pull/725) - Added rules to ignore all test artifacts in git.
Expand Down
Loading