Skip to content

Commit

Permalink
Merge pull request #73 from sstroemer/ssl-fixes-and-version-bumps
Browse files Browse the repository at this point in the history
SSL fixes and version bumps
  • Loading branch information
sstroemer authored Feb 5, 2025
2 parents 0969083 + a3855ea commit e355134
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/actions/set-versions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ runs:

- name: "set Julia version"
shell: bash
run: echo "VERSION_JULIA=1.11.2" >> $GITHUB_ENV
run: echo "VERSION_JULIA=1.11.3" >> $GITHUB_ENV


4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ dependencies = [
"pydantic >= 2.7.4",
"python-dotenv >= 1.0.1",
# the Julia dependencies are intentionally pinned!
"juliacall == 0.9.20",
"juliapkg == 0.1.13",
"juliacall == 0.9.24",
"juliapkg == 0.1.15",
]

[project.urls]
Expand Down
6 changes: 3 additions & 3 deletions src/iesopt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def _strtobool(val: str):

class Config:
DEFAULTS = {
"IESOPT_JULIA": "1.11.2",
"IESOPT_CORE": "2.4.0",
"IESOPT_JUMP": "1.23.6",
"IESOPT_JULIA": "1.11.3",
"IESOPT_CORE": "2.5.0",
"IESOPT_JUMP": "1.24.0",
"IESOPT_SOLVER_HIGHS": "1.13.0",
"IESOPT_MULTITHREADED": "no", # yes, no
"IESOPT_OPTIMIZATION": "latency", # rapid, latency, normal, performance
Expand Down
38 changes: 21 additions & 17 deletions src/iesopt/julia/setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
import sys
from pathlib import Path
# import ssl
import ssl

from ..util import logger
from .util import jl_import
Expand Down Expand Up @@ -55,22 +55,26 @@ def setup_julia():
if (Path(__file__).parent / ".." / "juliapkg.json").exists():
(Path(__file__).parent / ".." / "juliapkg.json").unlink()

# # Check for local SSL certificate file, that can interfere with Julia setup.
# _ssl = None
# if "SSL_CERT_FILE" in os.environ:
# logger.info("Detected local `SSL_CERT_FILE`; disabling it during Julia setup")
# _ssl = os.environ.pop("SSL_CERT_FILE")
# Check for local SSL certificate file, that can interfere with Julia setup.
_ssl = None
if "SSL_CERT_FILE" in os.environ:
logger.debug("Detected local `SSL_CERT_FILE`; disabling it during Julia setup")
_ssl = os.environ.pop("SSL_CERT_FILE")

# ssl._create_default_https_context = ssl._create_unverified_context
# logger.warn("Disabling SSL verification to prevent problems; this may be unsafe")
ssl._create_default_https_context = ssl._create_unverified_context
logger.info("Disabling SSL verification to prevent problems; this may be unsafe")

# Set `JULIA_SSL_CA_ROOTS_PATH` to prevent various SSL related issues (with Julia setup; LibGit2; etc.).
if "JULIA_SSL_CA_ROOTS_PATH" in os.environ:
logger.warn(
"Overwriting the env. variable `JULIA_SSL_CA_ROOTS_PATH` (current: `%s`) to prevent SSL issues during the Julia setup"
% str(os.environ["JULIA_SSL_CA_ROOTS_PATH"])
)
os.environ["JULIA_SSL_CA_ROOTS_PATH"] = ""
if os.environ["JULIA_SSL_CA_ROOTS_PATH"] != "":
logger.info(
"Overwriting the env. variable `JULIA_SSL_CA_ROOTS_PATH` (current: `%s`) to prevent SSL issues during the Julia setup"
% str(os.environ["JULIA_SSL_CA_ROOTS_PATH"])
)
os.environ["JULIA_SSL_CA_ROOTS_PATH"] = ""
else:
logger.debug('Setting `JULIA_SSL_CA_ROOTS_PATH = ""` to prevent SSL issues during the Julia setup')
os.environ["JULIA_SSL_CA_ROOTS_PATH"] = ""

# Setup Julia (checking if it "looks" valid).
import juliapkg
Expand Down Expand Up @@ -146,10 +150,10 @@ def setup_julia():
except Exception as e:
logger.error(f"Failed to install custom package '{name}': {e}")

# # Restoring potential SSL certificate.
# if _ssl is not None:
# logger.info("Restoring local `SSL_CERT_FILE`")
# os.environ["SSL_CERT_FILE"] = _ssl
# Restoring potential SSL certificate.
if _ssl is not None:
logger.debug("Restoring local `SSL_CERT_FILE`")
os.environ["SSL_CERT_FILE"] = _ssl

return juliacall

Expand Down
16 changes: 8 additions & 8 deletions uv.lock

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

0 comments on commit e355134

Please sign in to comment.