Skip to content

Commit 9b9dc30

Browse files
Merge branch 'master' into add-api-docs
2 parents fe9a5d1 + 56ced5d commit 9b9dc30

Some content is hidden

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

89 files changed

+6055
-3061
lines changed

.github/workflows/development.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Install dependencies
3131
run: |
3232
python -m pip install --upgrade pip
33-
pip install flake8
33+
pip install flake8 black
3434
- name: Run syntax tests
3535
run: flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
3636
- name: Run primary tests
@@ -40,12 +40,14 @@ jobs:
4040
PY_VER: ${{matrix.py_ver}}
4141
MYSQL_VER: ${{matrix.mysql_ver}}
4242
ALPINE_VER: "3.10"
43-
MINIO_VER: RELEASE.2019-09-26T19-42-35Z
43+
MINIO_VER: RELEASE.2021-09-03T03-56-13Z
4444
COMPOSE_HTTP_TIMEOUT: "120"
4545
COVERALLS_SERVICE_NAME: travis-ci
4646
COVERALLS_REPO_TOKEN: fd0BoXG46TPReEem0uMy7BJO5j0w1MQiY
4747
run: docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
4848
- name: Run style tests
4949
run: |
50-
flake8 --ignore=E121,E123,E126,E226,E24,E704,W503,W504,E722,F401,W605 datajoint \
50+
flake8 --ignore=E203,E722,F401,W503 datajoint \
5151
--count --max-complexity=62 --max-line-length=127 --statistics
52+
black datajoint --check -v
53+
black tests --check -v

CHANGELOG.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
## Release notes
22

3-
### 0.13.3 -- May 28, 2021
3+
### 0.13.4 -- March, 28 2022
4+
* Add - Allow reading blobs produced by legacy 32-bit compiled mYm library for matlab. PR #995
5+
* Bugfix - Add missing `jobs` argument for multiprocessing PR #997
6+
* Add - Test for multiprocessing PR #1008
7+
* Bugfix - Fix external store key name doesn't allow '-' (#1005) PR #1006
8+
* Add - Adopted black formatting into code base PR #998
9+
10+
### 0.13.3 -- Feb 9, 2022
11+
* Bugfix - Fix error in listing ancestors, descendants with part tables.
12+
* Bugfix - Fix Python 3.10 compatibility (#983) PR #972
13+
* Bugfix - Allow renaming non-conforming attributes in proj (#982) PR #972
14+
* Add - Expose proxy feature for S3 external stores (#961) PR #962
15+
* Add - implement multiprocessing in populate (#695) PR #704, #969
416
* Bugfix - Dependencies not properly loaded on populate. (#902) PR #919
17+
* Bugfix - Replace use of numpy aliases of built-in types with built-in type. (#938) PR #939
18+
* Bugfix - Deletes and drops must include the master of each part. (#151, #374) PR #957
19+
* Bugfix - `ExternalTable.delete` should not remove row on error (#953) PR #956
20+
* Bugfix - Fix error handling of remove_object function in `s3.py` (#952) PR #955
21+
* Bugfix - Fix regression issue with `DISTINCT` clause and `GROUP_BY` (#914) PR #963
22+
* Bugfix - Fix sql code generation to comply with sql mode `ONLY_FULL_GROUP_BY` (#916) PR #965
23+
* Bugfix - Fix count for left-joined `QueryExpressions` (#951) PR #966
24+
* Bugfix - Fix assertion error when performing a union into a join (#930) PR #967
25+
* Update `~jobs.error_stack` from blob to mediumblob to allow error stacks >64kB in jobs (#984) PR #986
26+
* Bugfix - Fix error when performing a union on multiple tables (#926) PR #964
27+
* Add - Allow optional keyword arguments for `make()` in `populate()` PR #971
528

629
### 0.13.2 -- May 7, 2021
730
* Update `setuptools_certificate` dependency to new name `otumat`
@@ -44,13 +67,13 @@
4467
* Fix display of part tables in `schema.save`. (#821) PR #833
4568
* Add `schema.list_tables`. (#838) PR #844
4669
* Fix minio new version regression. PR #847
47-
* Add more S3 logging for debugging. (#831) PR #832
70+
* Add more S3 logging for debugging. (#831) PR #832
4871
* Convert testing framework from TravisCI to GitHub Actions (#841) PR #840
49-
72+
5073
### 0.12.7 -- Oct 27, 2020
5174
* Fix case sensitivity issues to adapt to MySQL 8+. PR #819
5275
* Fix pymysql regression bug (#814) PR #816
53-
* Adapted attribute types now have dtype=object in all recarray results. PR #811
76+
* Adapted attribute types now have dtype=object in all recarray results. PR #811
5477

5578
### 0.12.6 -- May 15, 2020
5679
* Add `order_by` to `dj.kill` (#668, #779) PR #775, #783
@@ -122,7 +145,7 @@
122145
* Fix #628 - incompatibility with pyparsing 2.4.1
123146

124147
### 0.11.1 -- Nov 15, 2018
125-
* Fix ordering of attributes in proj (#483 and #516)
148+
* Fix ordering of attributes in proj (#483, #516)
126149
* Prohibit direct insert into auto-populated tables (#511)
127150

128151
### 0.11.0 -- Oct 25, 2018
@@ -142,9 +165,9 @@
142165
* Bugfix in restriction of the form (A & B) * B (#463)
143166
* Improved error messages (#466)
144167

145-
### 0.10.0 -- Jan 10, 2018
168+
### 0.10.0 -- Jan 10, 2018
146169
* Deletes are more efficient (#424)
147-
* ERD shows table definition on tooltip hover in Jupyter (#422)
170+
* ERD shows table definition on tooltip hover in Jupyter (#422)
148171
* S3 external storage
149172
* Garbage collection for external sorage
150173
* Most operators and methods of tables can be invoked as class methods rather than instance methods (#407)
@@ -158,7 +181,7 @@
158181
* Implement union operator +
159182
* Implement file-based external storage
160183

161-
### 0.8.0 -- Jul 26, 2017
184+
### 0.8.0 -- Jul 26, 2017
162185
Documentation and tutorials available at https://docs.datajoint.io and https://tutorials.datajoint.io
163186
* improved the ERD graphics and features using the graphviz libraries (#207, #333)
164187
* improved password handling logic (#322, #321)
@@ -177,11 +200,11 @@ Documentation and tutorials available at https://docs.datajoint.io and https://t
177200
* Added `dj.create_virtual_module`
178201

179202
### 0.4.10 (#286) -- Feb 6, 2017
180-
* Removed Vagrant and Readthedocs support
203+
* Removed Vagrant and Readthedocs support
181204
* Explicit saving of configuration (issue #284)
182205

183206
### 0.4.9 (#285) -- Feb 2, 2017
184-
* Fixed setup.py for pip install
207+
* Fixed setup.py for pip install
185208

186209
### 0.4.7 (#281) -- Jan 24, 2017
187210
* Fixed issues related to order of attributes in projection.
@@ -210,10 +233,10 @@ Documentation and tutorials available at https://docs.datajoint.io and https://t
210233

211234
### 0.3.8 -- Aug 2, 2016
212235
* added the `_update` method in `base_relation`. It allows updating values in existing tuples.
213-
* bugfix in reading values of type double. Previously it was cast as float32.
236+
* bugfix in reading values of type double. Previously it was cast as float32.
214237

215238
### 0.3.7 -- Jul 31, 2016
216-
* added parameter `ignore_extra_fields` in `insert`
239+
* added parameter `ignore_extra_fields` in `insert`
217240
* `insert(..., skip_duplicates=True)` now relies on `SELECT IGNORE`. Previously it explicitly checked if tuple already exists.
218241
* table previews now include blob attributes displaying the string <BLOB>
219242

@@ -235,7 +258,7 @@ Documentation and tutorials available at https://docs.datajoint.io and https://t
235258
* ERD() no longer text the context argument.
236259
* ERD.draw() now takes an optional context argument. By default uses the caller's locals.
237260

238-
### 0.3.2.
261+
### 0.3.2.
239262
* Fixed issue #223: `insert` can insert relations without fetching.
240263
* 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).
241264
* ERD.draw() no longer has the `prefix` argument: class names are shown as found in the context.

LNX-docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ services:
3232
interval: 1s
3333
fakeservices.datajoint.io:
3434
<<: *net
35-
image: datajoint/nginx:v0.0.16
35+
image: datajoint/nginx:v0.1.1
3636
environment:
3737
- ADD_db_TYPE=DATABASE
3838
- ADD_db_ENDPOINT=db:3306

README.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
# Welcome to DataJoint for Python!
99
DataJoint for Python is a framework for scientific workflow management based on relational principles. DataJoint is built on the foundation of the relational data model and prescribes a consistent method for organizing, populating, computing, and querying data.
1010

11-
DataJoint was initially developed in 2009 by Dimitri Yatsenko in Andreas Tolias' Lab for the distributed processing and management of large volumes of data streaming from regular experiments. Starting in 2011, DataJoint has been available as an open-source project adopted by other labs and improved through contributions from several developers.
12-
13-
Vathes LLC supports DataJoint for Python as an open-source project and everyone is welcome to contribute.
14-
Its DataJoint Neuro (https://djneuro.io) business provides support to neuroscience labs for developing and executing custom data pipelines.
11+
DataJoint was initially developed in 2009 by Dimitri Yatsenko in Andreas Tolias' Lab at Baylor College of Medicine for the distributed processing and management of large volumes of data streaming from regular experiments. Starting in 2011, DataJoint has been available as an open-source project adopted by other labs and improved through contributions from several developers.
12+
Presently, the primary developer of DataJoint open-source software is the company DataJoint (https://datajoint.com). Related resources are listed at https://datajoint.org.
1513

1614
## Installation
1715
```
@@ -22,7 +20,25 @@ If you already have an older version of DataJoint installed using `pip`, upgrade
2220
```bash
2321
pip3 install --upgrade datajoint
2422
```
23+
24+
## Documentation and Tutorials
25+
26+
* https://datajoint.org -- start page
27+
* https://docs.datajoint.org -- up-to-date documentation
28+
* https://tutorials.datajoint.io -- step-by-step tutorials
29+
* https://elements.datajoint.org -- catalog of example pipelines
30+
* https://codebook.datajoint.io -- interactive online tutorials
31+
32+
## Citation
33+
+ If your work uses DataJoint for Python, please cite the following Research Resource Identifier (RRID) and manuscript.
34+
35+
+ DataJoint ([RRID:SCR_014543](https://scicrunch.org/resolver/SCR_014543)) - DataJoint for Python (version `<Enter version number>`)
36+
37+
+ Yatsenko D, Reimer J, Ecker AS, Walker EY, Sinz F, Berens P, Hoenselaar A, Cotton RJ, Siapas AS, Tolias AS. DataJoint: managing big scientific data using MATLAB or Python. bioRxiv. 2015 Jan 1:031658. doi: https://doi.org/10.1101/031658
38+
2539
## Python Native Blobs
40+
<details>
41+
<summary>Click to expand details</summary>
2642

2743
DataJoint 0.12 adds full support for all native python data types in blobs: tuples, lists, sets, dicts, strings, bytes, `None`, and all their recursive combinations.
2844
The new blobs are a superset of the old functionality and are fully backward compatible.
@@ -92,13 +108,7 @@ the situation, but generally the following strategies may apply:
92108
As always, be sure that your data is safely backed up before modifying any
93109
important DataJoint schema or records.
94110

95-
## Documentation and Tutorials
96-
A number of labs are currently adopting DataJoint and we are quickly getting the documentation in shape in February 2017.
97-
98-
* https://datajoint.io -- start page
99-
* https://docs.datajoint.io -- up-to-date documentation
100-
* https://tutorials.datajoint.io -- step-by-step tutorials
101-
* https://catalog.datajoint.io -- catalog of example pipelines
111+
</details>
102112

103113
### API docs
104114

@@ -113,14 +123,15 @@ Generated docs are written to `docs-api/docs/html/index.html`.
113123
More details in [docs-api/README.md](docs-api/README.md).
114124

115125
## Running Tests Locally
116-
126+
<details>
127+
<summary>Click to expand details</summary>
117128

118129
* Create an `.env` with desired development environment values e.g.
119130
``` sh
120131
PY_VER=3.7
121132
ALPINE_VER=3.10
122133
MYSQL_VER=5.7
123-
MINIO_VER=RELEASE.2019-09-26T19-42-35Z
134+
MINIO_VER=RELEASE.2021-09-03T03-56-13Z
124135
UID=1000
125136
GID=1000
126137
```
@@ -152,3 +163,5 @@ GID=1000
152163
* Navigate to `localhost:8888`
153164
* Input Jupyter password
154165
* Launch a notebook i.e. `New > Python 3`
166+
167+
</details>

datajoint/__init__.py

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,40 @@
1616

1717
__author__ = "DataJoint Contributors"
1818
__date__ = "November 7, 2020"
19-
__all__ = ['__author__', '__version__',
20-
'config', 'conn', 'Connection',
21-
'Schema', 'schema', 'VirtualModule', 'create_virtual_module',
22-
'list_schemas', 'Table', 'FreeTable',
23-
'Manual', 'Lookup', 'Imported', 'Computed', 'Part',
24-
'Not', 'AndList', 'U', 'Diagram', 'Di', 'ERD',
25-
'set_password', 'kill',
26-
'MatCell', 'MatStruct', 'AttributeAdapter',
27-
'errors', 'DataJointError', 'key', 'key_hash']
19+
__all__ = [
20+
"__author__",
21+
"__version__",
22+
"config",
23+
"conn",
24+
"Connection",
25+
"Schema",
26+
"schema",
27+
"VirtualModule",
28+
"create_virtual_module",
29+
"list_schemas",
30+
"Table",
31+
"FreeTable",
32+
"Manual",
33+
"Lookup",
34+
"Imported",
35+
"Computed",
36+
"Part",
37+
"Not",
38+
"AndList",
39+
"U",
40+
"Diagram",
41+
"Di",
42+
"ERD",
43+
"set_password",
44+
"kill",
45+
"MatCell",
46+
"MatStruct",
47+
"AttributeAdapter",
48+
"errors",
49+
"DataJointError",
50+
"key",
51+
"key_hash",
52+
]
2853

2954
from .version import __version__
3055
from .settings import config
@@ -44,6 +69,6 @@
4469
from .errors import DataJointError
4570
from .migrate import migrate_dj011_external_blob_storage_to_dj012
4671

47-
ERD = Di = Diagram # Aliases for Diagram
48-
schema = Schema # Aliases for Schema
49-
create_virtual_module = VirtualModule # Aliases for VirtualModule
72+
ERD = Di = Diagram # Aliases for Diagram
73+
schema = Schema # Aliases for Schema
74+
create_virtual_module = VirtualModule # Aliases for VirtualModule

datajoint/admin.py

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@
55
from .utils import user_choice
66

77

8-
def set_password(new_password=None, connection=None, update_config=None): # pragma: no cover
8+
def set_password(
9+
new_password=None, connection=None, update_config=None
10+
): # pragma: no cover
911
connection = conn() if connection is None else connection
1012
if new_password is None:
11-
new_password = getpass('New password: ')
12-
confirm_password = getpass('Confirm password: ')
13+
new_password = getpass("New password: ")
14+
confirm_password = getpass("Confirm password: ")
1315
if new_password != confirm_password:
14-
print('Failed to confirm the password! Aborting password change.')
16+
print("Failed to confirm the password! Aborting password change.")
1517
return
1618
connection.query("SET PASSWORD = PASSWORD('%s')" % new_password)
17-
print('Password updated.')
19+
print("Password updated.")
1820

19-
if update_config or (update_config is None and user_choice('Update local setting?') == 'yes'):
20-
config['database.password'] = new_password
21+
if update_config or (
22+
update_config is None and user_choice("Update local setting?") == "yes"
23+
):
24+
config["database.password"] = new_password
2125
config.save_local(verbose=True)
2226

2327

@@ -40,24 +44,32 @@ def kill(restriction=None, connection=None, order_by=None): # pragma: no cover
4044
connection = conn()
4145

4246
if order_by is not None and not isinstance(order_by, str):
43-
order_by = ','.join(order_by)
47+
order_by = ",".join(order_by)
4448

45-
query = 'SELECT * FROM information_schema.processlist WHERE id <> CONNECTION_ID()' + (
46-
"" if restriction is None else ' AND (%s)' % restriction) + (
47-
' ORDER BY %s' % (order_by or 'id'))
49+
query = (
50+
"SELECT * FROM information_schema.processlist WHERE id <> CONNECTION_ID()"
51+
+ ("" if restriction is None else " AND (%s)" % restriction)
52+
+ (" ORDER BY %s" % (order_by or "id"))
53+
)
4854

4955
while True:
50-
print(' ID USER HOST STATE TIME INFO')
51-
print('+--+ +----------+ +-----------+ +-----------+ +-----+')
52-
cur = ({k.lower(): v for k, v in elem.items()}
53-
for elem in connection.query(query, as_dict=True))
56+
print(" ID USER HOST STATE TIME INFO")
57+
print("+--+ +----------+ +-----------+ +-----------+ +-----+")
58+
cur = (
59+
{k.lower(): v for k, v in elem.items()}
60+
for elem in connection.query(query, as_dict=True)
61+
)
5462
for process in cur:
5563
try:
56-
print('{id:>4d} {user:<12s} {host:<12s} {state:<12s} {time:>7d} {info}'.format(**process))
64+
print(
65+
"{id:>4d} {user:<12s} {host:<12s} {state:<12s} {time:>7d} {info}".format(
66+
**process
67+
)
68+
)
5769
except TypeError:
5870
print(process)
5971
response = input('process to kill or "q" to quit > ')
60-
if response == 'q':
72+
if response == "q":
6173
break
6274
if response:
6375
try:
@@ -66,9 +78,9 @@ def kill(restriction=None, connection=None, order_by=None): # pragma: no cover
6678
pass # ignore non-numeric input
6779
else:
6880
try:
69-
connection.query('kill %d' % pid)
81+
connection.query("kill %d" % pid)
7082
except pymysql.err.InternalError:
71-
print('Process not found')
83+
print("Process not found")
7284

7385

7486
def kill_quick(restriction=None, connection=None):
@@ -86,13 +98,17 @@ def kill_quick(restriction=None, connection=None):
8698
if connection is None:
8799
connection = conn()
88100

89-
query = 'SELECT * FROM information_schema.processlist WHERE id <> CONNECTION_ID()' + (
90-
"" if restriction is None else ' AND (%s)' % restriction)
101+
query = (
102+
"SELECT * FROM information_schema.processlist WHERE id <> CONNECTION_ID()"
103+
+ ("" if restriction is None else " AND (%s)" % restriction)
104+
)
91105

92-
cur = ({k.lower(): v for k, v in elem.items()}
93-
for elem in connection.query(query, as_dict=True))
106+
cur = (
107+
{k.lower(): v for k, v in elem.items()}
108+
for elem in connection.query(query, as_dict=True)
109+
)
94110
nkill = 0
95111
for process in cur:
96-
connection.query('kill %d' % process['id'])
112+
connection.query("kill %d" % process["id"])
97113
nkill += 1
98114
return nkill

0 commit comments

Comments
 (0)