Skip to content

Commit 0abd3c0

Browse files
author
Thinh Nguyen
committed
Merge branch 'master' into populate_success_count
2 parents 1b4806e + a745322 commit 0abd3c0

Some content is hidden

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

56 files changed

+902
-529
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Create a report to help us improve
44
title: ''
5-
labels: 'bug, awaiting-triage'
5+
labels: 'bug'
66
assignees: ''
77

88
---

.github/workflows/development.yaml

Lines changed: 128 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,55 @@ on:
33
push:
44
branches:
55
- '**' # every branch
6+
- '!gh-pages' # exclude gh-pages branch
67
- '!stage*' # exclude branches beginning with stage
8+
tags:
9+
- '\d+\.\d+\.\d+' # only semver tags
710
pull_request:
811
branches:
912
- '**' # every branch
13+
- '!gh-pages' # exclude gh-pages branch
1014
- '!stage*' # exclude branches beginning with stage
1115
jobs:
12-
build-docs:
16+
build:
1317
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
include:
21+
- py_ver: 3.8
22+
distro: alpine
23+
image: djbase
1424
env:
25+
PY_VER: ${{matrix.py_ver}}
26+
DISTRO: ${{matrix.distro}}
27+
IMAGE: ${{matrix.image}}
1528
DOCKER_CLIENT_TIMEOUT: "120"
1629
COMPOSE_HTTP_TIMEOUT: "120"
1730
steps:
1831
- uses: actions/checkout@v2
19-
- name: Compile docs static artifacts
32+
- name: Validate version and release notes
33+
run: |
34+
DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
35+
RELEASE_BODY=$(python -c \
36+
'print(open("./CHANGELOG.md").read().split("\n\n")[1].split("\n", 1)[1])' \
37+
)
38+
echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
39+
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
40+
echo "$RELEASE_BODY" >> $GITHUB_ENV
41+
echo "EOF" >> $GITHUB_ENV
42+
- name: Build pip artifacts
2043
run: |
2144
export HOST_UID=$(id -u)
22-
docker-compose -f ./docs-api/docker-compose.yaml up --exit-code-from docs-builder --build
23-
- name: Add docs static artifacts
45+
docker-compose -f docker-compose-build.yaml up --exit-code-from app --build
46+
echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
47+
- if: matrix.py_ver == '3.8' && matrix.distro == 'alpine'
48+
name: Add pip artifacts
2449
uses: actions/upload-artifact@v2
2550
with:
26-
name: docs-api-static
27-
path: docs-api/build/html
51+
name: pip-datajoint-${{env.DJ_VERSION}}
52+
path: dist
2853
retention-days: 1
2954
test:
30-
if: github.event_name == 'push' || github.event_name == 'pull_request'
3155
runs-on: ubuntu-latest
3256
strategy:
3357
matrix:
@@ -39,7 +63,7 @@ jobs:
3963
steps:
4064
- uses: actions/checkout@v2
4165
- name: Set up Python ${{matrix.py_ver}}
42-
uses: actions/setup-python@v2
66+
uses: actions/setup-python@v4
4367
with:
4468
python-version: ${{matrix.py_ver}}
4569
- name: Install dependencies
@@ -50,58 +74,121 @@ jobs:
5074
run: flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
5175
- name: Run primary tests
5276
env:
53-
UID: "1001"
54-
GID: "121"
5577
PY_VER: ${{matrix.py_ver}}
5678
MYSQL_VER: ${{matrix.mysql_ver}}
5779
ALPINE_VER: "3.10"
5880
MINIO_VER: RELEASE.2021-09-03T03-56-13Z
5981
COMPOSE_HTTP_TIMEOUT: "120"
6082
COVERALLS_SERVICE_NAME: travis-ci
6183
COVERALLS_REPO_TOKEN: fd0BoXG46TPReEem0uMy7BJO5j0w1MQiY
62-
run: docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
84+
run: |
85+
export HOST_UID=$(id -u)
86+
export HOST_GID=$(id -g)
87+
docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
6388
- name: Run style tests
6489
run: |
65-
flake8 --ignore=E203,E722,F401,W503 datajoint \
90+
flake8 --ignore=E203,E722,W503 datajoint \
6691
--count --max-complexity=62 --max-line-length=127 --statistics
6792
black datajoint --check -v
6893
black tests --check -v
6994
publish-docs:
7095
if: |
7196
github.event_name == 'push' &&
72-
(
73-
github.repository_owner == 'datajoint' ||
74-
github.repository_owner == 'datajoint-company' ||
75-
github.repository_owner == 'dj-sciops'
76-
)
77-
needs: build-docs
97+
startsWith(github.ref, 'refs/tags')
98+
needs: test
7899
runs-on: ubuntu-latest
100+
env:
101+
DOCKER_CLIENT_TIMEOUT: "120"
102+
COMPOSE_HTTP_TIMEOUT: "120"
79103
steps:
80104
- uses: actions/checkout@v2
81-
- name: Fetch docs static artifacts
105+
- name: Deploy docs
106+
run: |
107+
export MODE=BUILD
108+
export PACKAGE=datajoint
109+
export UPSTREAM_REPO=https://github.com/${GITHUB_REPOSITORY}.git
110+
export HOST_UID=$(id -u)
111+
docker compose -f docs/docker-compose.yaml up --exit-code-from docs --build
112+
git push origin gh-pages
113+
publish-release:
114+
if: |
115+
github.event_name == 'push' &&
116+
startsWith(github.ref, 'refs/tags')
117+
needs: test
118+
runs-on: ubuntu-latest
119+
strategy:
120+
matrix:
121+
include:
122+
- py_ver: 3.8
123+
distro: alpine
124+
image: djbase
125+
env:
126+
PY_VER: ${{matrix.py_ver}}
127+
DISTRO: ${{matrix.distro}}
128+
IMAGE: ${{matrix.image}}
129+
TWINE_USERNAME: ${{secrets.twine_username}}
130+
TWINE_PASSWORD: ${{secrets.twine_password}}
131+
DOCKER_CLIENT_TIMEOUT: "120"
132+
COMPOSE_HTTP_TIMEOUT: "120"
133+
outputs:
134+
release_upload_url: ${{steps.create_gh_release.outputs.upload_url}}
135+
steps:
136+
- uses: actions/checkout@v2
137+
- name: Set up Python ${{matrix.py_ver}}
138+
uses: actions/setup-python@v4
139+
with:
140+
python-version: ${{matrix.py_ver}}
141+
- name: Determine package version
142+
run: |
143+
DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
144+
RELEASE_BODY=$(python -c \
145+
'print(open("./CHANGELOG.md").read().split("\n\n")[1].split("\n", 1)[1])' \
146+
)
147+
echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
148+
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
149+
echo "$RELEASE_BODY" >> $GITHUB_ENV
150+
echo "EOF" >> $GITHUB_ENV
151+
- name: Create GH release
152+
id: create_gh_release
153+
uses: actions/create-release@v1
154+
env:
155+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
156+
with:
157+
tag_name: ${{env.DJ_VERSION}}
158+
release_name: Release ${{env.DJ_VERSION}}
159+
body: ${{env.RELEASE_BODY}}
160+
prerelease: false
161+
draft: false
162+
- name: Fetch pip artifacts
82163
uses: actions/download-artifact@v2
83164
with:
84-
name: docs-api-static
85-
path: docs-api/build/html
86-
- name: Commit documentation changes
165+
name: pip-datajoint-${{env.DJ_VERSION}}
166+
path: dist
167+
- name: Determine pip artifact paths
87168
run: |
88-
git clone https://github.com/${GITHUB_REPOSITORY}.git \
89-
--branch gh-pages --single-branch gh-pages
90-
rm -R gh-pages/*
91-
cp -r docs-api/build/html/* gh-pages/
92-
cp .gitignore gh-pages/
93-
touch gh-pages/.nojekyll
94-
echo "docs-api.datajoint.org" > gh-pages/CNAME
95-
cd gh-pages
96-
git config --local user.email "[email protected]"
97-
git config --local user.name "GitHub Action"
98-
git add . --all
99-
git commit -m "Update documentation" -a || true
100-
# The above command will fail if no changes were present, so we ignore
101-
# the return code.
102-
- name: Push changes
103-
uses: ad-m/github-push-action@master
169+
echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
170+
echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV
171+
- name: Upload pip wheel asset to release
172+
uses: actions/upload-release-asset@v1
173+
env:
174+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
104175
with:
105-
branch: gh-pages
106-
directory: gh-pages
107-
github_token: ${{secrets.GITHUB_TOKEN}}
176+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
177+
asset_path: ${{env.DJ_WHEEL_PATH}}
178+
asset_name: pip-datajoint-${{env.DJ_VERSION}}.whl
179+
asset_content_type: application/zip
180+
- name: Upload pip sdist asset to release
181+
uses: actions/upload-release-asset@v1
182+
env:
183+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
184+
with:
185+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
186+
asset_path: ${{env.DJ_SDIST_PATH}}
187+
asset_name: pip-datajoint-${{env.DJ_VERSION}}.tar.gz
188+
asset_content_type: application/gzip
189+
- name: Publish pip release
190+
run: |
191+
export HOST_UID=$(id -u)
192+
docker-compose -f docker-compose-build.yaml run \
193+
-e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} app \
194+
sh -lc "pip install twine && python -m twine upload dist/*"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ notebook
2424
.vscode
2525
__main__.py
2626
jupyter_custom.js
27-
apk_requirements.txt
2827
.eggs
2928
*.code-workspace
29+
docs/site

CHANGELOG.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
## Release notes
22

3+
### 0.14.0 -- TBA
4+
* Bugfix - Activating a schema requires all tables to exist even if `create_tables=False` PR [#1058](https://github.com/datajoint/datajoint-python/pull/1058)
5+
6+
### 0.13.8 -- Sep 21, 2022
7+
* Add - New documentation structure based on markdown PR [#1052](https://github.com/datajoint/datajoint-python/pull/1052)
8+
* Bugfix - Fix queries with backslashes ([#999](https://github.com/datajoint/datajoint-python/issues/999)) PR [#1052](https://github.com/datajoint/datajoint-python/pull/1052)
9+
310
### 0.13.7 -- Jul 13, 2022
4-
* Bugfix - Fix networkx incompatable change by version pinning to 2.6.3 PR #1036 (#1035)
5-
* Add - Support for serializing numpy datetime64 types PR #1036 (#1022)
11+
* Bugfix - Fix networkx incompatable change by version pinning to 2.6.3 (#1035) PR #1036
12+
* Add - Support for serializing numpy datetime64 types (#1022) PR #1036
613
* Update - Add traceback to default logging PR #1036
714

815
### 0.13.6 -- Jun 13, 2022
@@ -266,7 +273,7 @@ Documentation and tutorials available at https://docs.datajoint.io and https://t
266273

267274
### 0.3.4
268275
* Added method the `ERD.add_parts` method, which adds the part tables of all tables currently in the ERD.
269-
* `ERD() + arg` and `ERD() - arg` can now accept relation classes as arg.
276+
* `ERD() + arg` and `ERD() - arg` can now accept table classes as arg.
270277

271278
### 0.3.3
272279
* Suppressed warnings (redirected them to logging). Previoiusly, scipy would throw warnings in ERD, for example.
@@ -276,5 +283,5 @@ Documentation and tutorials available at https://docs.datajoint.io and https://t
276283

277284
### 0.3.2.
278285
* Fixed issue #223: `insert` can insert relations without fetching.
279-
* ERD() now takes the `context` argument, which specifies in which context to look for classes. The default is taken from the argument (schema or relation).
286+
* ERD() now takes the `context` argument, which specifies in which context to look for classes. The default is taken from the argument (schema or table).
280287
* ERD.draw() no longer has the `prefix` argument: class names are shown as found in the context.

Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
FROM datajoint/pydev
2-
3-
COPY --chown=dja . /tmp/src
4-
RUN pip install --user /tmp/src && \
5-
rm -rf /tmp/src
1+
ARG PY_VER=3.8
2+
ARG DISTRO=alpine
3+
ARG IMAGE=djbase
4+
FROM datajoint/${IMAGE}:py${PY_VER}-${DISTRO}
5+
WORKDIR /main
6+
COPY --chown=anaconda:anaconda ./requirements.txt ./setup.py \
7+
/main/
8+
COPY --chown=anaconda:anaconda ./datajoint/*.py /main/datajoint/
9+
RUN \
10+
umask u+rwx,g+rwx,o-rwx && \
11+
pip install --no-cache-dir . && \
12+
rm -R ./*
13+
CMD ["python"]

LNX-docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# docker-compose -f LNX-docker-compose.yml --env-file LNX.env up --exit-code-from app --build
1+
# docker compose -f LNX-docker-compose.yml --env-file LNX.env up --exit-code-from app --build
22
version: '2.2'
33
x-net: &net
44
networks:
@@ -32,7 +32,7 @@ services:
3232
interval: 1s
3333
fakeservices.datajoint.io:
3434
<<: *net
35-
image: datajoint/nginx:v0.2.1
35+
image: datajoint/nginx:v0.2.3
3636
environment:
3737
- ADD_db_TYPE=DATABASE
3838
- ADD_db_ENDPOINT=db:3306
@@ -85,7 +85,7 @@ services:
8585
# jupyter notebook
8686
# ports:
8787
# - "8888:8888"
88-
user: ${UID}:${GID}
88+
user: ${HOST_UID}:${HOST_GID}
8989
volumes:
9090
- .:/src
9191
- /tmp/.X11-unix:/tmp/.X11-unix:rw

Makefile

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ PY_VER=3.7
132132
ALPINE_VER=3.10
133133
MYSQL_VER=5.7
134134
MINIO_VER=RELEASE.2021-09-03T03-56-13Z
135-
UID=1000
136-
GID=1000
135+
HOST_UID=1000
136+
HOST_GID=1000
137137
```
138138
* `cp local-docker-compose.yml docker-compose.yml`
139139
* `docker-compose up -d` (Note configured `JUPYTER_PASSWORD`)

datajoint/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
"DataJointError",
5151
"key",
5252
"key_hash",
53+
"logger",
54+
"migrate_dj011_external_blob_storage_to_dj012",
5355
]
5456

5557
from .logging import logger

datajoint/autopopulate.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def _call_populate1(key):
4343

4444
class AutoPopulate:
4545
"""
46-
AutoPopulate is a mixin class that adds the method populate() to a Relation class.
47-
Auto-populated relations must inherit from both Relation and AutoPopulate,
46+
AutoPopulate is a mixin class that adds the method populate() to a Table class.
47+
Auto-populated tables must inherit from both Table and AutoPopulate,
4848
must define the property `key_source`, and must define the callback method `make`.
4949
"""
5050

@@ -117,7 +117,7 @@ def _job_key(self, key):
117117

118118
def _jobs_to_do(self, restrictions):
119119
"""
120-
:return: the relation containing the keys to be computed (derived from self.key_source)
120+
:return: the query yeilding the keys to be computed (derived from self.key_source)
121121
"""
122122
if self.restriction:
123123
raise DataJointError(

0 commit comments

Comments
 (0)