Skip to content

Commit af23bd2

Browse files
committed
Merge branch 'master' into fix/alter_part
2 parents 501d525 + 4360b17 commit af23bd2

File tree

212 files changed

+9428
-6411
lines changed

Some content is hidden

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

212 files changed

+9428
-6411
lines changed

.devcontainer/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Note: You can use any Debian/Ubuntu based image you want.
2+
FROM mcr.microsoft.com/devcontainers/python:3.7-bullseye
3+
4+
RUN \
5+
apt update && \
6+
apt-get install bash-completion graphviz default-mysql-client -y && \
7+
pip install flake8 black faker ipykernel nose nose-cov datajoint && \
8+
pip uninstall datajoint -y
9+
10+
ENV DJ_HOST fakeservices.datajoint.io
11+
ENV DJ_USER root
12+
ENV DJ_PASS simple

.devcontainer/devcontainer.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
{
3+
"name": "Development",
4+
"dockerComposeFile": "docker-compose.yaml",
5+
"service": "app",
6+
"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 && MYSQL_VER=8.0 MINIO_VER=RELEASE.2022-08-11T04-37-28Z docker compose -f local-docker-compose.yml up --build --wait",
20+
"forwardPorts": [
21+
80,
22+
443,
23+
3306,
24+
8080,
25+
9000
26+
],
27+
"customizations": {
28+
"vscode": {
29+
"extensions": [
30+
"ms-python.python"
31+
]
32+
}
33+
}
34+
}

.devcontainer/docker-compose.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3"
2+
services:
3+
app:
4+
build: .
5+
extra_hosts:
6+
- fakeservices.datajoint.io:127.0.0.1
7+
volumes:
8+
- ../..:/workspaces:cached
9+
entrypoint: /usr/local/share/docker-init.sh
10+
command: tail -f /dev/null

.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: 178 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,210 @@ name: Development
22
on:
33
push:
44
branches:
5-
- '**' # every branch
6-
- '!stage*' # exclude branches beginning with stage
5+
- "**" # every branch
6+
- "!gh-pages" # exclude gh-pages branch
7+
- "!stage*" # exclude branches beginning with stage
8+
tags:
9+
- '\d+\.\d+\.\d+' # only semver tags
710
pull_request:
811
branches:
9-
- '**' # every branch
10-
- '!stage*' # exclude branches beginning with stage
12+
- "**" # every branch
13+
- "!gh-pages" # exclude gh-pages branch
14+
- "!stage*" # exclude branches beginning with stage
1115
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
include:
21+
- py_ver: "3.9"
22+
distro: debian
23+
image: djbase
24+
env:
25+
PY_VER: ${{matrix.py_ver}}
26+
DISTRO: ${{matrix.distro}}
27+
IMAGE: ${{matrix.image}}
28+
DOCKER_CLIENT_TIMEOUT: "120"
29+
COMPOSE_HTTP_TIMEOUT: "120"
30+
steps:
31+
- uses: actions/checkout@v3
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
43+
run: |
44+
export HOST_UID=$(id -u)
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.9' && matrix.distro == 'debian'
48+
name: Add pip artifacts
49+
uses: actions/upload-artifact@v3
50+
with:
51+
name: pip-datajoint-${{env.DJ_VERSION}}
52+
path: dist
53+
retention-days: 1
1254
test:
13-
if: github.event_name == 'push' || github.event_name == 'pull_request'
1455
runs-on: ubuntu-latest
1556
strategy:
1657
matrix:
17-
py_ver: ["3.8"]
58+
py_ver: ["3.9"]
1859
mysql_ver: ["8.0", "5.7"]
1960
include:
20-
- py_ver: "3.7"
61+
- py_ver: "3.8"
2162
mysql_ver: "5.7"
22-
- py_ver: "3.6"
63+
- py_ver: "3.7"
2364
mysql_ver: "5.7"
2465
steps:
25-
- uses: actions/checkout@v2
66+
- uses: actions/checkout@v3
2667
- name: Set up Python ${{matrix.py_ver}}
27-
uses: actions/setup-python@v2
68+
uses: actions/setup-python@v4
2869
with:
2970
python-version: ${{matrix.py_ver}}
3071
- name: Install dependencies
3172
run: |
3273
python -m pip install --upgrade pip
33-
pip install flake8
74+
pip install flake8 black
3475
- name: Run syntax tests
3576
run: flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
3677
- name: Run primary tests
3778
env:
38-
UID: "1001"
39-
GID: "121"
4079
PY_VER: ${{matrix.py_ver}}
80+
DJ_PASS: simple
4181
MYSQL_VER: ${{matrix.mysql_ver}}
42-
ALPINE_VER: "3.10"
82+
DISTRO: alpine
4383
MINIO_VER: RELEASE.2021-09-03T03-56-13Z
84+
DOCKER_CLIENT_TIMEOUT: "120"
4485
COMPOSE_HTTP_TIMEOUT: "120"
45-
COVERALLS_SERVICE_NAME: travis-ci
46-
COVERALLS_REPO_TOKEN: fd0BoXG46TPReEem0uMy7BJO5j0w1MQiY
47-
run: docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
86+
run: |
87+
export HOST_UID=$(id -u)
88+
docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
4889
- name: Run style tests
4990
run: |
50-
flake8 --ignore=E121,E123,E126,E226,E24,E704,W503,W504,E722,F401,W605 datajoint \
91+
flake8 --ignore=E203,E722,W503 datajoint \
5192
--count --max-complexity=62 --max-line-length=127 --statistics
93+
black datajoint --check -v
94+
black tests --check -v
95+
publish-docs:
96+
if: |
97+
github.event_name == 'push' &&
98+
startsWith(github.ref, 'refs/tags')
99+
needs: test
100+
runs-on: ubuntu-latest
101+
env:
102+
DOCKER_CLIENT_TIMEOUT: "120"
103+
COMPOSE_HTTP_TIMEOUT: "120"
104+
steps:
105+
- uses: actions/checkout@v3
106+
- name: Deploy docs
107+
run: |
108+
export MODE=BUILD
109+
export PACKAGE=datajoint
110+
export UPSTREAM_REPO=https://github.com/${GITHUB_REPOSITORY}.git
111+
export HOST_UID=$(id -u)
112+
docker compose -f docs/docker-compose.yaml up --exit-code-from docs --build
113+
git push origin gh-pages
114+
publish-release:
115+
if: |
116+
github.event_name == 'push' &&
117+
startsWith(github.ref, 'refs/tags')
118+
needs: test
119+
runs-on: ubuntu-latest
120+
strategy:
121+
matrix:
122+
include:
123+
- py_ver: "3.9"
124+
distro: debian
125+
image: djbase
126+
env:
127+
PY_VER: ${{matrix.py_ver}}
128+
DISTRO: ${{matrix.distro}}
129+
IMAGE: ${{matrix.image}}
130+
TWINE_USERNAME: ${{secrets.twine_username}}
131+
TWINE_PASSWORD: ${{secrets.twine_password}}
132+
DOCKER_CLIENT_TIMEOUT: "120"
133+
COMPOSE_HTTP_TIMEOUT: "120"
134+
outputs:
135+
release_upload_url: ${{steps.create_gh_release.outputs.upload_url}}
136+
steps:
137+
- uses: actions/checkout@v3
138+
- name: Set up Python ${{matrix.py_ver}}
139+
uses: actions/setup-python@v4
140+
with:
141+
python-version: ${{matrix.py_ver}}
142+
- name: Determine package version
143+
run: |
144+
DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)
145+
RELEASE_BODY=$(python -c \
146+
'print(open("./CHANGELOG.md").read().split("\n\n")[1].split("\n", 1)[1])' \
147+
)
148+
echo "DJ_VERSION=${DJ_VERSION}" >> $GITHUB_ENV
149+
echo "RELEASE_BODY<<EOF" >> $GITHUB_ENV
150+
echo "$RELEASE_BODY" >> $GITHUB_ENV
151+
echo "EOF" >> $GITHUB_ENV
152+
- name: Create GH release
153+
id: create_gh_release
154+
uses: actions/create-release@v1
155+
env:
156+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
157+
with:
158+
tag_name: ${{env.DJ_VERSION}}
159+
release_name: Release ${{env.DJ_VERSION}}
160+
body: ${{env.RELEASE_BODY}}
161+
prerelease: false
162+
draft: false
163+
- name: Fetch pip artifacts
164+
uses: actions/download-artifact@v3
165+
with:
166+
name: pip-datajoint-${{env.DJ_VERSION}}
167+
path: dist
168+
- name: Determine pip artifact paths
169+
run: |
170+
echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
171+
echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV
172+
- name: Upload pip wheel asset to release
173+
uses: actions/upload-release-asset@v1
174+
env:
175+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
176+
with:
177+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
178+
asset_path: ${{env.DJ_WHEEL_PATH}}
179+
asset_name: pip-datajoint-${{env.DJ_VERSION}}.whl
180+
asset_content_type: application/zip
181+
- name: Upload pip sdist asset to release
182+
uses: actions/upload-release-asset@v1
183+
env:
184+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
185+
with:
186+
upload_url: ${{steps.create_gh_release.outputs.upload_url}}
187+
asset_path: ${{env.DJ_SDIST_PATH}}
188+
asset_name: pip-datajoint-${{env.DJ_VERSION}}.tar.gz
189+
asset_content_type: application/gzip
190+
- name: Publish pip release
191+
run: |
192+
export HOST_UID=$(id -u)
193+
docker-compose -f docker-compose-build.yaml run \
194+
-e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} app \
195+
sh -c "pip install twine && python -m twine upload dist/*"
196+
- name: Login to DockerHub
197+
uses: docker/login-action@v1
198+
with:
199+
username: ${{secrets.docker_username}}
200+
password: ${{secrets.docker_password}}
201+
- name: Publish image
202+
run: |
203+
IMAGE=$(docker images --filter "reference=datajoint/datajoint*" --format "{{.Repository}}")
204+
TAG=$(docker images --filter "reference=datajoint/datajoint*" --format "{{.Tag}}")
205+
docker push "${IMAGE}:${TAG}"
206+
docker tag "${IMAGE}:${TAG}" "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
207+
docker push "${IMAGE}:${TAG}-${GITHUB_SHA:0:7}"
208+
[ "$PY_VER" == "3.9" ] && [ "$DISTRO" == "debian" ] \
209+
&& docker tag "${IMAGE}:${TAG}" "${IMAGE}:latest" \
210+
&& docker push "${IMAGE}:latest" \
211+
|| echo "skipping 'latest' tag..."

.gitignore

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ build/
2121
*.env
2222
docker-compose.yml
2323
notebook
24-
.vscode
2524
__main__.py
2625
jupyter_custom.js
27-
apk_requirements.txt
28-
.eggs
26+
.eggs
27+
*.code-workspace
28+
docs/site
29+
30+
31+
!.vscode/settings.json
32+
!.vscode/launch.json
33+
!.devcontainer/devcontainer.json

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Current File",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal",
13+
"justMyCode": false
14+
}
15+
]
16+
}

.vscode/settings.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"editor.formatOnPaste": false,
3+
"editor.formatOnSave": true,
4+
"editor.rulers": [
5+
94
6+
],
7+
"python.formatting.provider": "black",
8+
"[python]": {
9+
"editor.defaultFormatter": null
10+
},
11+
"[markdown]": {
12+
"editor.defaultFormatter": "disable"
13+
},
14+
"files.autoSave": "off"
15+
}

0 commit comments

Comments
 (0)