Skip to content

Commit 5948a41

Browse files
committed
Merge branch 'master' into hidden-1091-continued
2 parents 1edecda + b9d8488 commit 5948a41

File tree

94 files changed

+15137
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+15137
-253
lines changed

.devcontainer/Dockerfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# Note: You can use any Debian/Ubuntu based image you want.
2-
FROM mcr.microsoft.com/devcontainers/python:3.7-bullseye
3-
1+
ARG PY_VER
2+
ARG DISTRO
3+
FROM mcr.microsoft.com/devcontainers/python:${PY_VER}-${DISTRO}
44
RUN \
55
apt update && \
66
apt-get install bash-completion graphviz default-mysql-client -y && \
7-
pip install flake8 black faker ipykernel pytest pytest-cov nose nose-cov datajoint && \
7+
pip install flake8 black faker ipykernel pytest pytest-cov nose nose-cov datajoint jupyterlab && \
88
pip uninstall datajoint -y
99

10+
USER root
1011
ENV DJ_HOST fakeservices.datajoint.io
1112
ENV DJ_USER root
12-
ENV DJ_PASS simple
13+
ENV DJ_PASS password

.devcontainer/devcontainer.json

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,50 @@
11
// 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
23
{
3-
"name": "Development",
4-
"dockerComposeFile": "docker-compose.yaml",
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+
"../LNX-docker-compose.yml",
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.
513
"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
616
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
7-
// Use this environment variable if you need to bind mount your local source code into a new container.
8-
"remoteEnv": {
9-
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
10-
},
11-
// https://containers.dev/features
12-
"features": {
13-
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
14-
"ghcr.io/devcontainers/features/git:1": {},
15-
"ghcr.io/eitsupi/devcontainer-features/jq-likes:1": {},
16-
"ghcr.io/guiyomh/features/vim:0": {}
17-
},
18-
"onCreateCommand": "pip install -e .",
19-
"postStartCommand": "MYSQL_VER=8.0 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f local-docker-compose.yml down && docker volume prune -f && MYSQL_VER=8.0 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f local-docker-compose.yml up --build --wait",
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.
2020
"forwardPorts": [
2121
80,
2222
443,
2323
3306,
2424
8080,
2525
9000
2626
],
27+
// Uncomment the next line if you want start specific services in your Docker Compose config.
28+
// "runServices": [],
29+
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
30+
"shutdownAction": "stopCompose",
31+
"onCreateCommand": "python3 -m pip install -e .",
32+
"features": {
33+
"ghcr.io/devcontainers/features/git:1": {},
34+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
35+
"ghcr.io/devcontainers/features/github-cli:1": {},
36+
},
37+
// Configure tool-specific properties.
2738
"customizations": {
2839
"vscode": {
2940
"extensions": [
3041
"ms-python.python"
3142
]
3243
}
44+
},
45+
"remoteEnv": {
46+
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
3347
}
48+
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
49+
// "remoteUser": "devcontainer"
3450
}

.devcontainer/docker-compose.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

.devcontainer/docker-compose.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: '2.4'
2+
services:
3+
# Update this to the name of the service you want to work with in your docker-compose.yml file
4+
app:
5+
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
6+
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
7+
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
8+
# array). The sample below assumes your primary file is in the root of your project.
9+
container_name: datajoint-python-devcontainer
10+
image: datajoint/datajoint-python-devcontainer:${PY_VER:-3.11}-${DISTRO:-buster}
11+
build:
12+
context: .
13+
dockerfile: .devcontainer/Dockerfile
14+
args:
15+
- PY_VER=${PY_VER:-3.11}
16+
- DISTRO=${DISTRO:-buster}
17+
18+
volumes:
19+
# Update this to wherever you want VS Code to mount the folder of your project
20+
- ..:/workspaces:cached
21+
22+
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
23+
# cap_add:
24+
# - SYS_PTRACE
25+
# security_opt:
26+
# - seccomp:unconfined
27+
28+
user: root
29+
30+
# Overrides default command so things don't shut down after the process ends.
31+
command: /bin/sh -c "while sleep 1000; do :; done"
32+

.github/workflows/development.yaml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
DOCKER_CLIENT_TIMEOUT: "120"
2929
COMPOSE_HTTP_TIMEOUT: "120"
3030
steps:
31-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
3232
- name: Validate version and release notes
3333
run: |
3434
DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
@@ -42,7 +42,7 @@ jobs:
4242
- name: Build pip artifacts
4343
run: |
4444
export HOST_UID=$(id -u)
45-
docker-compose -f docker-compose-build.yaml up --exit-code-from app --build
45+
docker compose -f docker-compose-build.yaml up --exit-code-from app --build
4646
echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
4747
- if: matrix.py_ver == '3.9' && matrix.distro == 'debian'
4848
name: Add pip artifacts
@@ -58,14 +58,16 @@ jobs:
5858
py_ver: ["3.9"]
5959
mysql_ver: ["8.0", "5.7"]
6060
include:
61+
- py_ver: "3.11"
62+
mysql_ver: "8.0"
63+
- py_ver: "3.10"
64+
mysql_ver: "8.0"
6165
- py_ver: "3.8"
6266
mysql_ver: "5.7"
63-
- py_ver: "3.7"
64-
mysql_ver: "5.7"
6567
steps:
66-
- uses: actions/checkout@v3
68+
- uses: actions/checkout@v4
6769
- name: Set up Python ${{matrix.py_ver}}
68-
uses: actions/setup-python@v4
70+
uses: actions/setup-python@v5
6971
with:
7072
python-version: ${{matrix.py_ver}}
7173
- name: Install dependencies
@@ -77,30 +79,46 @@ jobs:
7779
- name: Run primary tests
7880
env:
7981
PY_VER: ${{matrix.py_ver}}
80-
DJ_PASS: simple
82+
DJ_PASS: password
8183
MYSQL_VER: ${{matrix.mysql_ver}}
8284
DISTRO: alpine
8385
MINIO_VER: RELEASE.2021-09-03T03-56-13Z
8486
DOCKER_CLIENT_TIMEOUT: "120"
8587
COMPOSE_HTTP_TIMEOUT: "120"
8688
run: |
8789
export HOST_UID=$(id -u)
88-
docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
90+
docker compose -f LNX-docker-compose.yml up --build --exit-code-from app
91+
lint:
92+
runs-on: ubuntu-latest
93+
strategy:
94+
matrix:
95+
py_ver: ["3.11"]
96+
steps:
97+
- uses: actions/checkout@v4
98+
- name: Set up Python ${{matrix.py_ver}}
99+
uses: actions/setup-python@v5
100+
with:
101+
python-version: ${{matrix.py_ver}}
102+
- name: Install dependencies
103+
run: |
104+
python -m pip install --upgrade pip
105+
pip install flake8 black==24.2.0
106+
- name: Run syntax tests
107+
run: flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
89108
- name: Run style tests
90109
run: |
91110
flake8 --ignore=E203,E722,W503 datajoint \
92-
--count --max-complexity=62 --max-line-length=127 --statistics
93-
black datajoint --check -v
94-
black tests --check -v
95-
black tests_old --check -v
111+
--count --max-complexity=62 --max-line-length=127 --statistics \
112+
--per-file-ignores='datajoint/diagram.py:C901'
113+
black --required-version '24.2.0' --check -v datajoint tests tests_old
96114
codespell:
97115
name: Check for spelling errors
98116
permissions:
99117
contents: read
100118
runs-on: ubuntu-latest
101119
steps:
102120
- name: Checkout
103-
uses: actions/checkout@v3
121+
uses: actions/checkout@v4
104122
- name: Codespell
105123
uses: codespell-project/actions-codespell@v2
106124
publish-docs:
@@ -113,7 +131,7 @@ jobs:
113131
DOCKER_CLIENT_TIMEOUT: "120"
114132
COMPOSE_HTTP_TIMEOUT: "120"
115133
steps:
116-
- uses: actions/checkout@v3
134+
- uses: actions/checkout@v4
117135
- name: Deploy docs
118136
run: |
119137
export MODE=BUILD
@@ -145,9 +163,9 @@ jobs:
145163
outputs:
146164
release_upload_url: ${{steps.create_gh_release.outputs.upload_url}}
147165
steps:
148-
- uses: actions/checkout@v3
166+
- uses: actions/checkout@v4
149167
- name: Set up Python ${{matrix.py_ver}}
150-
uses: actions/setup-python@v4
168+
uses: actions/setup-python@v5
151169
with:
152170
python-version: ${{matrix.py_ver}}
153171
- name: Determine package version
@@ -172,7 +190,7 @@ jobs:
172190
prerelease: false
173191
draft: false
174192
- name: Fetch pip artifacts
175-
uses: actions/download-artifact@v3
193+
uses: actions/download-artifact@v4.1.7
176194
with:
177195
name: pip-datajoint-${{env.DJ_VERSION}}
178196
path: dist
@@ -201,7 +219,7 @@ jobs:
201219
- name: Publish pip release
202220
run: |
203221
export HOST_UID=$(id -u)
204-
docker-compose -f docker-compose-build.yaml run \
222+
docker compose -f docker-compose-build.yaml run \
205223
-e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} app \
206224
sh -c "pip install twine && python -m twine upload dist/*"
207225
- name: Login to DockerHub

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
DOCKER_CLIENT_TIMEOUT: "120"
99
COMPOSE_HTTP_TIMEOUT: "120"
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- name: Deploy docs
1313
run: |
1414
export MODE=BUILD

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ docs/site
3030

3131
!.vscode/settings.json
3232
!.vscode/launch.json
33-
!.devcontainer/devcontainer.json
33+
!.devcontainer/devcontainer.json
34+
!.devcontainer/docker-compose.yml
35+

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
## Release notes
22

3-
### Upcoming
3+
### 0.14.3 -- TBD
4+
- Fixed - Added encapsulating double quotes to comply with [DOT language](https://graphviz.org/doc/info/lang.html) - PR [#1177](https://github.com/datajoint/datajoint-python/pull/1177)
5+
6+
### 0.14.2 -- Aug 19, 2024
7+
- Added - Migrate nosetests to pytest - PR [#1142](https://github.com/datajoint/datajoint-python/pull/1142)
48
- Added - Codespell GitHub Actions workflow
59
- Added - GitHub Actions workflow to manually release docs
610
- Changed - Update `datajoint/nginx` to `v0.2.6`
711
- Changed - Migrate docs from `https://docs.datajoint.org/python` to `https://datajoint.com/docs/core/datajoint-python`
12+
- Fixed - [DevContainer](https://containers.dev/) configuration - PR [#1115](https://github.com/datajoint/datajoint-python/pull/1115)
813
- Fixed - Updated set_password to work on MySQL 8 - PR [#1106](https://github.com/datajoint/datajoint-python/pull/1106)
914
- Added - Missing tests for set_password - PR [#1106](https://github.com/datajoint/datajoint-python/pull/1106)
1015
- Changed - Returning success count after the .populate() call - PR [#1050](https://github.com/datajoint/datajoint-python/pull/1050)
16+
- Fixed - `Autopopulate.populate` excludes `reserved` jobs in addition to `ignore` and `error` jobs
17+
- Fixed - Issue [#1159](https://github.com/datajoint/datajoint-python/pull/1159) (cascading delete) - PR [#1160](https://github.com/datajoint/datajoint-python/pull/1160)
18+
- Changed - Minimum Python version for Datajoint-Python is now 3.8 PR #1163
19+
- Fixed - `docker compose` commands in CI [#1164](https://github.com/datajoint/datajoint-python/pull/1164)
20+
- Changed - Default delete behavior now includes masters of part tables - PR [#1158](https://github.com/datajoint/datajoint-python/pull/1158)
1121

1222
### 0.14.1 -- Jun 02, 2023
1323
- Fixed - Fix altering a part table that uses the "master" keyword - PR [#991](https://github.com/datajoint/datajoint-python/pull/991)

LNX-docker-compose.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ x-net:
77
services:
88
db:
99
<<: *net
10-
image: datajoint/mysql:${MYSQL_VER}
10+
image: datajoint/mysql:${MYSQL_VER:-8.0}
1111
environment:
12-
- MYSQL_ROOT_PASSWORD=${DJ_PASS}
12+
- MYSQL_ROOT_PASSWORD=${DJ_PASS:-password}
13+
command: mysqld --default-authentication-plugin=mysql_native_password
1314
# ports:
1415
# - "3306:3306"
1516
# volumes:
@@ -21,7 +22,7 @@ services:
2122
interval: 15s
2223
minio:
2324
<<: *net
24-
image: minio/minio:${MINIO_VER}
25+
image: minio/minio:${MINIO_VER:-RELEASE.2022-08-11T04-37-28Z}
2526
environment:
2627
- MINIO_ACCESS_KEY=datajoint
2728
- MINIO_SECRET_KEY=datajoint
@@ -44,7 +45,7 @@ services:
4445
interval: 15s
4546
fakeservices.datajoint.io:
4647
<<: *net
47-
image: datajoint/nginx:v0.2.6
48+
image: datajoint/nginx:latest
4849
environment:
4950
- ADD_db_TYPE=DATABASE
5051
- ADD_db_ENDPOINT=db:3306
@@ -58,7 +59,7 @@ services:
5859
# - "3306:3306"
5960
app:
6061
<<: *net
61-
image: datajoint/djtest:py${PY_VER}-${DISTRO}
62+
image: datajoint/djtest:py${PY_VER:-3.8}-${DISTRO:-alpine}
6263
depends_on:
6364
db:
6465
condition: service_healthy
@@ -69,7 +70,7 @@ services:
6970
environment:
7071
- DJ_HOST=fakeservices.datajoint.io
7172
- DJ_USER=root
72-
- DJ_PASS
73+
- DJ_PASS=password
7374
- DJ_TEST_HOST=fakeservices.datajoint.io
7475
- DJ_TEST_USER=datajoint
7576
- DJ_TEST_PASSWORD=datajoint
@@ -86,14 +87,12 @@ services:
8687
- -c
8788
- |
8889
set -e
89-
pip install --user nose nose-cov
9090
pip install -e .
9191
pip list --format=freeze | grep datajoint
9292
pytest -sv --cov-report term-missing --cov=datajoint tests
93-
nosetests -vsw tests_old --with-coverage --cover-package=datajoint
9493
# ports:
9594
# - "8888:8888"
96-
user: ${HOST_UID}:anaconda
95+
user: ${HOST_UID:-1000}:anaconda
9796
volumes:
9897
- .:/src
9998
- /tmp/.X11-unix:/tmp/.X11-unix:rw

datajoint/autopopulate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""This module defines class dj.AutoPopulate"""
2+
23
import logging
34
import datetime
45
import traceback
@@ -207,12 +208,12 @@ def handler(signum, frame):
207208

208209
keys = (self._jobs_to_do(restrictions) - self.target).fetch("KEY", limit=limit)
209210

210-
# exclude "error" or "ignore" jobs
211+
# exclude "error", "ignore" or "reserved" jobs
211212
if reserve_jobs:
212213
exclude_key_hashes = (
213214
jobs
214215
& {"table_name": self.target.table_name}
215-
& 'status in ("error", "ignore")'
216+
& 'status in ("error", "ignore", "reserved")'
216217
).fetch("key_hash")
217218
keys = [key for key in keys if key_hash(key) not in exclude_key_hashes]
218219

0 commit comments

Comments
 (0)