Skip to content

Commit fadb7bb

Browse files
authored
Add devbox development environment (#529)
Adds devbox.json with Python 3.12, jq, and a virtualenv-based setup so contributors can get a working environment with a single `devbox shell`. Adds pytest to test dependencies and installs from requirements.txt to ensure pinned versions are used.
1 parent 45b7985 commit fadb7bb

3 files changed

Lines changed: 210 additions & 0 deletions

File tree

devbox.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
3+
"packages": {
4+
"python312": "latest",
5+
"jq": "latest"
6+
},
7+
"shell": {
8+
"init_hook": [
9+
"export PROJECT_ROOT=\"$(git rev-parse --show-toplevel 2>/dev/null || echo $DEVBOX_PROJECT_ROOT)\"",
10+
"if [ ! -d \"$PROJECT_ROOT/.venv\" ]; then python -m venv $PROJECT_ROOT/.venv; fi",
11+
"source $PROJECT_ROOT/.venv/bin/activate",
12+
"if ! python -m pylint --version > /dev/null 2>&1; then echo 'Running pip install...'; pip install -r requirements.txt && pip install -e '.[test]'; fi"
13+
],
14+
"scripts": {
15+
"install": ["pip install -r requirements.txt && pip install -e '.[test]'"],
16+
"test": ["python -m pytest segment/analytics/test/"],
17+
"lint": ["pylint --rcfile=.pylintrc --reports=y --exit-zero segment/analytics"],
18+
"format-check": ["flake8 --max-complexity=10 --statistics segment/analytics"],
19+
"check": [
20+
"devbox run lint",
21+
"devbox run format-check",
22+
"devbox run test"
23+
],
24+
"release": ["python setup.py sdist bdist_wheel", "twine upload dist/*"]
25+
}
26+
}
27+
}

devbox.lock

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"github:NixOS/nixpkgs/nixpkgs-unstable": {
5+
"last_modified": "2026-05-06T02:58:03Z",
6+
"resolved": "github:NixOS/nixpkgs/ed67bc86e84e51d4a88e73c7fd36006dc876476f?lastModified=1778036283&narHash=sha256-62EWg6lI0qyzm7oAx5cAnGkLutvJsRBe0KkEW2JDZCE%3D"
7+
},
8+
"jq@latest": {
9+
"last_modified": "2026-04-29T01:19:07Z",
10+
"resolved": "github:NixOS/nixpkgs/ebc08544afa77957cc348ba72dc490ec73b87f68#jq",
11+
"source": "devbox-search",
12+
"version": "1.8.1",
13+
"systems": {
14+
"aarch64-darwin": {
15+
"outputs": [
16+
{
17+
"name": "bin",
18+
"path": "/nix/store/zpaiv3csv85i5qdhwlivlbg8a5clnqmh-jq-1.8.1-bin",
19+
"default": true
20+
},
21+
{
22+
"name": "man",
23+
"path": "/nix/store/vs9rx9xgqachcay4mn95m1gwifzxrhm4-jq-1.8.1-man",
24+
"default": true
25+
},
26+
{
27+
"name": "dev",
28+
"path": "/nix/store/h46rnp90pvk5ky12r9drbzhl1fqlmjnf-jq-1.8.1-dev"
29+
},
30+
{
31+
"name": "doc",
32+
"path": "/nix/store/iksz05vk9j78ls9agfg9blhax9azgv69-jq-1.8.1-doc"
33+
},
34+
{
35+
"name": "out",
36+
"path": "/nix/store/inmyqx7646xrcqrwxipacv5gkf3ca6m3-jq-1.8.1"
37+
}
38+
],
39+
"store_path": "/nix/store/zpaiv3csv85i5qdhwlivlbg8a5clnqmh-jq-1.8.1-bin"
40+
},
41+
"aarch64-linux": {
42+
"outputs": [
43+
{
44+
"name": "bin",
45+
"path": "/nix/store/blgzs73jx017qji4n78v4wg1qxcg3cav-jq-1.8.1-bin",
46+
"default": true
47+
},
48+
{
49+
"name": "man",
50+
"path": "/nix/store/s8h2klkc7rw485yqj3s73ancc5915v2m-jq-1.8.1-man",
51+
"default": true
52+
},
53+
{
54+
"name": "doc",
55+
"path": "/nix/store/r992wf8cylhf9ayxwf64lawdfxcr4cl8-jq-1.8.1-doc"
56+
},
57+
{
58+
"name": "out",
59+
"path": "/nix/store/2v9443fs97gdg5mz9lk3q603hryhqijm-jq-1.8.1"
60+
},
61+
{
62+
"name": "dev",
63+
"path": "/nix/store/lx675fc624glij1dh9iw89pavkvfkv73-jq-1.8.1-dev"
64+
}
65+
],
66+
"store_path": "/nix/store/blgzs73jx017qji4n78v4wg1qxcg3cav-jq-1.8.1-bin"
67+
},
68+
"x86_64-darwin": {
69+
"outputs": [
70+
{
71+
"name": "bin",
72+
"path": "/nix/store/cpq0n6nrgs7jwyr121qshzk2fvjkmjbh-jq-1.8.1-bin",
73+
"default": true
74+
},
75+
{
76+
"name": "man",
77+
"path": "/nix/store/flsm1xvpbr9681y4y8101v5c5m3qmcim-jq-1.8.1-man",
78+
"default": true
79+
},
80+
{
81+
"name": "dev",
82+
"path": "/nix/store/0p7h41icsq99c08sym6iw4wzdsl35r13-jq-1.8.1-dev"
83+
},
84+
{
85+
"name": "doc",
86+
"path": "/nix/store/h6wn2lzbxq1v2dypaj4kpv4nnkkm9yld-jq-1.8.1-doc"
87+
},
88+
{
89+
"name": "out",
90+
"path": "/nix/store/spn7m9y4302yvw9zafpy1g2sz3z9xnx1-jq-1.8.1"
91+
}
92+
],
93+
"store_path": "/nix/store/cpq0n6nrgs7jwyr121qshzk2fvjkmjbh-jq-1.8.1-bin"
94+
},
95+
"x86_64-linux": {
96+
"outputs": [
97+
{
98+
"name": "bin",
99+
"path": "/nix/store/v5c3inhfq6xshmwg1c254vfbcy4jp3k9-jq-1.8.1-bin",
100+
"default": true
101+
},
102+
{
103+
"name": "man",
104+
"path": "/nix/store/lsyqny7h1riwhzajwy2vjjdd63viiwvm-jq-1.8.1-man",
105+
"default": true
106+
},
107+
{
108+
"name": "dev",
109+
"path": "/nix/store/p8x5zv9s9qg3ld8b7jdm03hkpdqybjl9-jq-1.8.1-dev"
110+
},
111+
{
112+
"name": "doc",
113+
"path": "/nix/store/g2wlgi44rn837jdirpwi3lk5f2iy13zg-jq-1.8.1-doc"
114+
},
115+
{
116+
"name": "out",
117+
"path": "/nix/store/09bq2i0kb008ccg3qdbyxv81ggxxnn09-jq-1.8.1"
118+
}
119+
],
120+
"store_path": "/nix/store/v5c3inhfq6xshmwg1c254vfbcy4jp3k9-jq-1.8.1-bin"
121+
}
122+
}
123+
},
124+
"python312@latest": {
125+
"last_modified": "2026-04-23T13:07:47Z",
126+
"plugin_version": "0.0.4",
127+
"resolved": "github:NixOS/nixpkgs/01fbdeef22b76df85ea168fbfe1bfd9e63681b30#python312",
128+
"source": "devbox-search",
129+
"version": "3.12.13",
130+
"systems": {
131+
"aarch64-darwin": {
132+
"outputs": [
133+
{
134+
"name": "out",
135+
"path": "/nix/store/fn6fnl5cg8qnsn1xn3lwaahk48vyw9l7-python3-3.12.13",
136+
"default": true
137+
}
138+
],
139+
"store_path": "/nix/store/fn6fnl5cg8qnsn1xn3lwaahk48vyw9l7-python3-3.12.13"
140+
},
141+
"aarch64-linux": {
142+
"outputs": [
143+
{
144+
"name": "out",
145+
"path": "/nix/store/jczbi6lb8vws7zc251v47bpijh805lyg-python3-3.12.13",
146+
"default": true
147+
},
148+
{
149+
"name": "debug",
150+
"path": "/nix/store/2x5zchy1i0bprgxdvn5crjjmc4dw83p1-python3-3.12.13-debug"
151+
}
152+
],
153+
"store_path": "/nix/store/jczbi6lb8vws7zc251v47bpijh805lyg-python3-3.12.13"
154+
},
155+
"x86_64-darwin": {
156+
"outputs": [
157+
{
158+
"name": "out",
159+
"path": "/nix/store/074rsjnaz8sf3xdf09a16zcw1qf8cj81-python3-3.12.13",
160+
"default": true
161+
}
162+
],
163+
"store_path": "/nix/store/074rsjnaz8sf3xdf09a16zcw1qf8cj81-python3-3.12.13"
164+
},
165+
"x86_64-linux": {
166+
"outputs": [
167+
{
168+
"name": "out",
169+
"path": "/nix/store/h3q2g9wq4x3q84164qsfm3lz5djj0bf3-python3-3.12.13",
170+
"default": true
171+
},
172+
{
173+
"name": "debug",
174+
"path": "/nix/store/8hjni6450l0l4m5cvlxjb6wn7r0ynffl-python3-3.12.13-debug"
175+
}
176+
],
177+
"store_path": "/nix/store/h3q2g9wq4x3q84164qsfm3lz5djj0bf3-python3-3.12.13"
178+
}
179+
}
180+
}
181+
}
182+
}

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"mock==2.0.0",
3131
"pylint==3.3.1",
3232
"flake8==3.7.9",
33+
"pytest",
3334
]
3435

3536
setup(

0 commit comments

Comments
 (0)