Skip to content

Commit 028dbad

Browse files
committed
Merge remote-tracking branch 'origin/claude/drop-legacy-support-rFhLT' into claude/add-type-aliases-6uN3E
2 parents 6fefbf6 + 83fc7bd commit 028dbad

21 files changed

+955
-670
lines changed

.github/workflows/post_draft_release_published.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
include:
26-
- py_ver: "3.9"
26+
- py_ver: "3.10"
2727
runs-on: ubuntu-latest
2828
env:
2929
PY_VER: ${{matrix.py_ver}}
@@ -40,14 +40,14 @@ jobs:
4040
- name: Update version.py
4141
run: |
4242
VERSION=$(echo "${{ github.event.release.name }}" | grep -oP '\d+\.\d+\.\d+')
43-
sed -i "s/^__version__ = .*/__version__ = \"$VERSION\"/" datajoint/version.py
44-
cat datajoint/version.py
43+
sed -i "s/^__version__ = .*/__version__ = \"$VERSION\"/" src/datajoint/version.py
44+
cat src/datajoint/version.py
4545
# Commit the changes
4646
BRANCH_NAME="update-version-$VERSION"
4747
git switch -c $BRANCH_NAME
4848
git config --global user.name "github-actions"
4949
git config --global user.email "github-actions@github.com"
50-
git add datajoint/version.py
50+
git add src/datajoint/version.py
5151
git commit -m "Update version.py to $VERSION"
5252
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
5353
- name: Update README.md badge

.github/workflows/test.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
py_ver: ["3.9", "3.10", "3.11", "3.12", "3.13"]
24+
py_ver: ["3.10", "3.11", "3.12", "3.13"]
2525
mysql_ver: ["8.0"]
26-
include:
27-
- py_ver: "3.9"
28-
mysql_ver: "5.7"
2926
steps:
3027
- uses: actions/checkout@v4
3128
- name: Set up Python ${{matrix.py_ver}}

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ services:
4141
context: .
4242
dockerfile: Dockerfile
4343
args:
44-
PY_VER: ${PY_VER:-3.9}
44+
PY_VER: ${PY_VER:-3.10}
4545
HOST_UID: ${HOST_UID:-1000}
4646
depends_on:
4747
db:

docs/src/client/credentials.md

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,82 @@
11
# Credentials
22

3-
Configure the connection through DataJoint's `config` object:
3+
Database credentials should never be stored in config files. Use environment variables or a secrets directory instead.
44

5-
```python
6-
> import datajoint as dj
7-
DataJoint 0.4.9 (February 1, 2017)
8-
No configuration found. Use `dj.config` to configure and save the configuration.
5+
## Environment Variables (Recommended)
6+
7+
Set the following environment variables:
8+
9+
```bash
10+
export DJ_HOST=db.example.com
11+
export DJ_USER=alice
12+
export DJ_PASS=secret
913
```
1014

11-
You may now set the database credentials:
15+
These take priority over all other configuration sources.
16+
17+
## Secrets Directory
18+
19+
Create a `.secrets/` directory next to your `datajoint.json`:
1220

13-
```python
14-
dj.config['database.host'] = "alicelab.datajoint.io"
15-
dj.config['database.user'] = "alice"
16-
dj.config['database.password'] = "haha not my real password"
21+
```
22+
myproject/
23+
├── datajoint.json
24+
└── .secrets/
25+
├── database.user # Contains: alice
26+
└── database.password # Contains: secret
1727
```
1828

19-
Skip setting the password to make DataJoint prompt to enter the password every time.
29+
Each file contains a single secret value (no JSON, just the raw value).
2030

21-
You may save the configuration in the local work directory with
22-
`dj.config.save_local()` or for all your projects in `dj.config.save_global()`.
23-
Configuration changes should be made through the `dj.config` interface; the config file
24-
should not be modified directly by the user.
31+
Add `.secrets/` to your `.gitignore`:
2532

26-
You may leave the user or the password as `None`, in which case you will be prompted to
27-
enter them manually for every session.
28-
Setting the password as an empty string allows access without a password.
33+
```
34+
# .gitignore
35+
.secrets/
36+
```
2937

30-
Note that the system environment variables `DJ_HOST`, `DJ_USER`, and `DJ_PASS` will
31-
overwrite the settings in the config file.
32-
You can use them to set the connection credentials instead of config files.
38+
## Docker / Kubernetes
3339

34-
To change the password, the `dj.set_password` function will walk you through the
35-
process:
40+
Mount secrets at `/run/secrets/datajoint/`:
41+
42+
```yaml
43+
# docker-compose.yml
44+
services:
45+
app:
46+
volumes:
47+
- ./secrets:/run/secrets/datajoint:ro
48+
```
49+
50+
## Interactive Prompt
51+
52+
If credentials are not provided via environment variables or secrets, DataJoint will prompt for them when connecting:
3653
3754
```python
38-
dj.set_password()
55+
>>> import datajoint as dj
56+
>>> dj.conn()
57+
Please enter DataJoint username: alice
58+
Please enter DataJoint password:
3959
```
4060
41-
After that, update the password in the configuration and save it as described above:
61+
## Programmatic Access
62+
63+
You can also set credentials in Python (useful for testing):
4264
4365
```python
44-
dj.config['database.password'] = 'my#cool!new*psswrd'
45-
dj.config.save_local() # or dj.config.save_global()
66+
import datajoint as dj
67+
68+
dj.config.database.user = "alice"
69+
dj.config.database.password = "secret"
70+
```
71+
72+
Note that `password` uses `SecretStr` internally, so it will be masked in logs and repr output.
73+
74+
## Changing Database Password
75+
76+
To change your database password, use your database's native tools:
77+
78+
```sql
79+
ALTER USER 'alice'@'%' IDENTIFIED BY 'new_password';
4680
```
81+
82+
Then update your environment variables or secrets file accordingly.

docs/src/client/install.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Install and Connect
22

3-
DataJoint is implemented for Python 3.4+.
3+
DataJoint is implemented for Python 3.10+.
44
You may install it from [PyPI](https://pypi.python.org/pypi/datajoint):
55

66
```bash
@@ -25,7 +25,7 @@ to connect to DataJoint pipelines.
2525

2626
Quick install steps for advanced users are as follows:
2727

28-
- Install latest Python 3.x and ensure it is in `PATH` (3.6.3 current at time of writing)
28+
- Install latest Python 3.x and ensure it is in `PATH` (3.10+ required)
2929
```bash
3030
pip install datajoint
3131
```
@@ -46,7 +46,7 @@ Python for Windows is available from:
4646

4747
https://www.python.org/downloads/windows
4848

49-
The latest 64 bit 3.x version, currently 3.6.3, is available from the [Python site](https://www.python.org/ftp/python/3.6.3/python-3.6.3-amd64.exe).
49+
The latest 64 bit 3.x version (3.10 or later required) is available from the [Python site](https://www.python.org/downloads/windows/).
5050

5151
From here run the installer to install Python.
5252

docs/src/client/settings.md

Lines changed: 161 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,166 @@
11
# Configuration Settings
22

3-
If you are not using DataJoint on your own, or are setting up a DataJoint
4-
system for other users, some additional configuration options may be required
5-
to support [TLS](#tls-configuration) or
6-
[external storage](../sysadmin/external-store.md).
3+
DataJoint uses a strongly-typed configuration system built on [pydantic-settings](https://docs.pydantic.dev/latest/concepts/pydantic_settings/).
4+
5+
## Configuration Sources
6+
7+
Settings are loaded from the following sources (in priority order):
8+
9+
1. **Environment variables** (`DJ_*`)
10+
2. **Secrets directory** (`.secrets/` or `/run/secrets/datajoint/`)
11+
3. **Project config file** (`datajoint.json`, searched recursively)
12+
4. **Default values**
13+
14+
## Project Structure
15+
16+
```
17+
myproject/
18+
├── .git/
19+
├── datajoint.json # Project config (commit this)
20+
├── .secrets/ # Local secrets (add to .gitignore)
21+
│ ├── database.password
22+
│ └── aws.secret_access_key
23+
└── src/
24+
└── analysis.py # Config found via parent search
25+
```
26+
27+
## Config File
28+
29+
Create a `datajoint.json` file in your project root:
30+
31+
```json
32+
{
33+
"database": {
34+
"host": "db.example.com",
35+
"port": 3306
36+
},
37+
"stores": {
38+
"raw": {
39+
"protocol": "file",
40+
"location": "/data/raw"
41+
}
42+
},
43+
"display": {
44+
"limit": 20
45+
},
46+
"safemode": true
47+
}
48+
```
49+
50+
DataJoint searches for this file starting from the current directory and moving up through parent directories, stopping at the first `.git` or `.hg` directory (project boundary) or filesystem root.
51+
52+
## Credentials
53+
54+
**Never store credentials in config files.** Use one of these methods:
55+
56+
### Environment Variables (Recommended)
57+
58+
```bash
59+
export DJ_USER=alice
60+
export DJ_PASS=secret
61+
export DJ_HOST=db.example.com
62+
```
63+
64+
### Secrets Directory
65+
66+
Create files in `.secrets/` next to your `datajoint.json`:
67+
68+
```
69+
.secrets/
70+
├── database.password # Contains: secret
71+
├── database.user # Contains: alice
72+
├── aws.access_key_id
73+
└── aws.secret_access_key
74+
```
75+
76+
Add `.secrets/` to your `.gitignore`.
77+
78+
For Docker/Kubernetes, secrets can be mounted at `/run/secrets/datajoint/`.
79+
80+
## Accessing Settings
81+
82+
```python
83+
import datajoint as dj
84+
85+
# Attribute access (preferred)
86+
dj.config.database.host
87+
dj.config.safemode
88+
89+
# Dict-style access
90+
dj.config["database.host"]
91+
dj.config["safemode"]
92+
```
93+
94+
## Temporary Overrides
95+
96+
Use the context manager for temporary changes:
97+
98+
```python
99+
with dj.config.override(safemode=False):
100+
# safemode is False here
101+
table.delete()
102+
# safemode is restored
103+
```
104+
105+
For nested settings, use double underscores:
106+
107+
```python
108+
with dj.config.override(database__host="test.example.com"):
109+
# database.host is temporarily changed
110+
pass
111+
```
112+
113+
## Available Settings
114+
115+
### Database Connection
116+
117+
| Setting | Environment Variable | Default | Description |
118+
|---------|---------------------|---------|-------------|
119+
| `database.host` | `DJ_HOST` | `localhost` | Database server hostname |
120+
| `database.port` | `DJ_PORT` | `3306` | Database server port |
121+
| `database.user` | `DJ_USER` | `None` | Database username |
122+
| `database.password` | `DJ_PASS` | `None` | Database password (use env/secrets) |
123+
| `database.reconnect` || `True` | Auto-reconnect on connection loss |
124+
| `database.use_tls` || `None` | TLS mode: `True`, `False`, or `None` (auto) |
125+
126+
### Display
127+
128+
| Setting | Default | Description |
129+
|---------|---------|-------------|
130+
| `display.limit` | `12` | Max rows to display in previews |
131+
| `display.width` | `14` | Column width in previews |
132+
| `display.show_tuple_count` | `True` | Show total count in previews |
133+
134+
### Other Settings
135+
136+
| Setting | Default | Description |
137+
|---------|---------|-------------|
138+
| `safemode` | `True` | Prompt before destructive operations |
139+
| `loglevel` | `INFO` | Logging level |
140+
| `fetch_format` | `array` | Default fetch format (`array` or `frame`) |
141+
| `enable_python_native_blobs` | `True` | Use Python-native blob serialization |
7142

8143
## TLS Configuration
9144

10-
Starting with v0.12, DataJoint will by default use TLS if it is available. TLS can be
11-
forced on or off with the boolean `dj.config['database.use_tls']`.
145+
DataJoint uses TLS by default if available. Control this with:
146+
147+
```python
148+
dj.config.database.use_tls = True # Require TLS
149+
dj.config.database.use_tls = False # Disable TLS
150+
dj.config.database.use_tls = None # Auto (default)
151+
```
152+
153+
## External Storage
154+
155+
Configure external stores in the `stores` section. See [External Storage](../sysadmin/external-store.md) for details.
156+
157+
```json
158+
{
159+
"stores": {
160+
"raw": {
161+
"protocol": "file",
162+
"location": "/data/external"
163+
}
164+
}
165+
}
166+
```

docs/src/develop.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ git clone https://github.com/datajoint/datajoint-python.git
4343
### With Virtual Environment
4444

4545
```bash
46-
# Check if you have Python 3.9 or higher, if not please upgrade
46+
# Check if you have Python 3.10 or higher, if not please upgrade
4747
python --version
4848
# Create a virtual environment with venv
4949
python -m venv .venv
5050
source .venv/bin/activate
5151
pip install -e .[dev]
5252

5353
# Or create a virtual environment with conda
54-
conda create -n dj python=3.13 # any 3.9+ is fine
54+
conda create -n dj python=3.13 # any 3.10+ is fine
5555
conda activate dj
5656
pip install -e .[dev]
5757
```
@@ -81,7 +81,7 @@ Here are some options that provide a great developer experience:
8181
- Ensure you have [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
8282
- Ensure you have [Docker](https://docs.docker.com/get-docker/)
8383
- `git clone` the codebase repository and open it in VSCode
84-
- Issue the following command in the terminal to build and run the Docker container: `HOST_UID=$(id -u) PY_VER=3.11 DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py) docker compose --profile test run --rm -it djtest -- sh -c 'pip install -qe ".[dev]" && bash'`
84+
- Issue the following command in the terminal to build and run the Docker container: `HOST_UID=$(id -u) PY_VER=3.11 DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' src/datajoint/version.py) docker compose --profile test run --rm -it djtest -- sh -c 'pip install -qe ".[dev]" && bash'`
8585
- Issue the following command in the terminal to stop the Docker compose stack: `docker compose --profile test down`
8686

8787
[Back to top](#table-of-contents)

0 commit comments

Comments
 (0)