Skip to content

Commit 66c9ebd

Browse files
committed
Merge branch 'pre/v2.0' of https://github.com/datajoint/datajoint-python into impr/modernize-pre-commit
2 parents 59d0159 + 4893e3d commit 66c9ebd

19 files changed

+6596
-118
lines changed

.devcontainer/devcontainer.json

Lines changed: 6 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,7 @@
1-
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2-
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
31
{
4-
"name": "Existing Docker Compose (Extend)",
5-
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
6-
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
7-
"dockerComposeFile": [
8-
"../docker-compose.yaml",
9-
"docker-compose.yml"
10-
],
11-
// The 'service' property is the name of the service for the container that VS Code should
12-
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
13-
"service": "app",
14-
// The optional 'workspaceFolder' property is the path VS Code should open by default when
15-
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
16-
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
17-
// Features to add to the dev container. More info: https://containers.dev/features.
18-
// "features": {},
19-
// Use 'forwardPorts' to make a list of ports inside the container available locally.
20-
"forwardPorts": [
21-
80,
22-
443,
23-
3306,
24-
8080,
25-
9000
26-
],
27-
"mounts": [
28-
"type=bind,source=${env:SSH_AUTH_SOCK},target=/ssh-agent"
29-
],
30-
"containerEnv": {
31-
"SSH_AUTH_SOCK": "/ssh-agent"
32-
},
33-
// Uncomment the next line if you want start specific services in your Docker Compose config.
34-
// "runServices": [],
35-
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
36-
"shutdownAction": "stopCompose",
37-
"onCreateCommand": "python3 -m pip install -q -e .[dev]",
38-
"features": {
39-
"ghcr.io/devcontainers/features/git:1": {},
40-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
41-
"ghcr.io/devcontainers/features/github-cli:1": {},
42-
},
43-
// Configure tool-specific properties.
44-
"customizations": {
45-
"vscode": {
46-
"extensions": [
47-
"ms-python.python"
48-
]
49-
}
50-
},
51-
"remoteEnv": {
52-
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
53-
}
54-
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
55-
// "remoteUser": "devcontainer"
56-
}
2+
"image": "mcr.microsoft.com/devcontainers/typescript-node:0-18",
3+
"features": {
4+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
5+
},
6+
"postCreateCommand": "curl -fsSL https://pixi.sh/install.sh | bash && echo 'export PATH=\"$HOME/.pixi/bin:$PATH\"' >> ~/.bashrc"
7+
}

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# SCM syntax highlighting & preventing 3-way merges
2+
pixi.lock merge=binary linguist-language=YAML linguist-generated=true

.github/workflows/test.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ jobs:
3434
python-version: ${{matrix.py_ver}}
3535
- name: Integration test
3636
env:
37-
PY_VER: ${{matrix.py_ver}}
3837
MYSQL_VER: ${{matrix.mysql_ver}}
39-
# taking default variables set in docker-compose.yaml to sync with local test
4038
run: |
41-
export HOST_UID=$(id -u)
42-
docker compose --profile test up --quiet-pull --build --exit-code-from djtest djtest
39+
pip install -e ".[test]"
40+
pytest --cov-report term-missing --cov=datajoint tests

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,5 @@ cython_debug/
185185
dj_local_conf.json
186186
*.env
187187
!.vscode/launch.json
188+
# pixi environments
189+
.pixi

activate.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /usr/bin/bash
2+
# This script registers dot plugins so that we can use graphviz
3+
# to write png images
4+
dot -c

docker-compose.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# HOST_UID=$(id -u) PY_VER=3.11 DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py) docker compose --profile test up --build --exit-code-from djtest djtest
1+
# Development environment with MySQL and MinIO services
2+
# To run tests: pytest --cov-report term-missing --cov=datajoint tests
23
services:
34
db:
45
image: datajoint/mysql:${MYSQL_VER:-8.0}

pixi.lock

Lines changed: 6097 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies = [
2222
"urllib3",
2323
"setuptools",
2424
]
25-
requires-python = ">=3.9,<4.0"
25+
requires-python = ">=3.9,<3.14"
2626
authors = [
2727
{name = "Dimitri Yatsenko", email = "[email protected]"},
2828
{name = "Thinh Nguyen", email = "[email protected]"},
@@ -78,11 +78,17 @@ Repository = "https://github.com/datajoint/datajoint-python"
7878
dj = "datajoint.cli:cli"
7979
datajoint = "datajoint.cli:cli"
8080

81-
[project.optional-dependencies]
81+
[dependency-groups]
8282
test = [
8383
"pytest",
8484
"pytest-cov",
85+
"pytest-env",
86+
"docker",
87+
"requests",
88+
"graphviz"
8589
]
90+
91+
[project.optional-dependencies]
8692
dev = [
8793
"pre-commit",
8894
"ruff",

src/datajoint/diagram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
logger = logging.getLogger(__name__.split(".")[0])
2929

3030

31-
if not diagram_active:
31+
if not diagram_active: # noqa: C901
3232

3333
class Diagram:
3434
"""

src/datajoint/settings.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ def __setitem__(self, key, value):
260260
"database.host",
261261
"database.user",
262262
"database.password",
263+
"database.port",
263264
"external.aws_access_key_id",
264265
"external.aws_secret_access_key",
265266
"loglevel",
@@ -270,6 +271,7 @@ def __setitem__(self, key, value):
270271
"DJ_HOST",
271272
"DJ_USER",
272273
"DJ_PASS",
274+
"DJ_PORT",
273275
"DJ_AWS_ACCESS_KEY_ID",
274276
"DJ_AWS_SECRET_ACCESS_KEY",
275277
"DJ_LOG_LEVEL",
@@ -278,6 +280,14 @@ def __setitem__(self, key, value):
278280
)
279281
if v is not None
280282
}
283+
284+
# Convert DJ_PORT from string to int if present
285+
if "database.port" in mapping and mapping["database.port"] is not None:
286+
try:
287+
mapping["database.port"] = int(mapping["database.port"])
288+
except ValueError:
289+
logger.warning(f"Invalid DJ_PORT value: {mapping['database.port']}, using default port 3306")
290+
del mapping["database.port"]
281291
if mapping:
282292
logger.info(f"Overloaded settings {tuple(mapping)} from environment variables.")
283293
config.update(mapping)

0 commit comments

Comments
 (0)