Commit 0ca8250
committed
Allow users to override the Swiss Ephemeris directory
Previously Stellium hard-coded ~/.stellium/ephe/ as the only location
for Swiss Ephemeris data files. That works for the common case but
breaks for portable installs (PythonPortable on D:\), read-only $HOME
environments (Docker, Lambda, shared hosts), and users who already
maintain a .se1 folder for another astrology tool and don't want a
second copy.
Add a small, layered override mechanism mirroring the convention used
by pip, cargo, pyenv, HuggingFace, and friends:
1. SwissEphemerisEngine(ephe_path=...) — explicit argument, highest
priority.
2. STELLIUM_EPHE_PATH environment variable — no code changes needed.
3. Default ~/.stellium/ephe/ — unchanged behavior for existing users.
When a custom path is supplied Stellium uses it as-is: the directory
is not created and the bundled essentials are not copied into it.
Missing custom directories emit a stderr warning instead of crashing
so misconfiguration fails loudly at the first calculation.
Also:
- Track the currently active directory (_active_ephe_dir) so
get_ephe_dir() and has_ephe_file() report against the override
rather than USER_EPHE_DIR.
- Allow re-initialization against a different path; same path is a
no-op.
- Document all three mechanisms in README.md under a new
"Ephemeris Data Location" section.
- Add tests/test_ephemeris_paths.py covering precedence, expansion,
no-copy semantics, has_ephe_file routing, env-var pass-through, and
an end-to-end chart calculation against a populated custom path.1 parent 10daea7 commit 0ca8250
4 files changed
Lines changed: 407 additions & 38 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
414 | 452 | | |
415 | 453 | | |
416 | 454 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
| |||
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
45 | 54 | | |
| 55 | + | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
| |||
129 | 139 | | |
130 | 140 | | |
131 | 141 | | |
132 | | - | |
| 142 | + | |
133 | 143 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 144 | + | |
140 | 145 | | |
141 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
142 | 149 | | |
143 | 150 | | |
144 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
145 | 167 | | |
146 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
147 | 176 | | |
148 | | - | |
149 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
150 | 181 | | |
151 | | - | |
152 | | - | |
| 182 | + | |
| 183 | + | |
153 | 184 | | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
158 | 190 | | |
159 | | - | |
160 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
161 | 224 | | |
162 | 225 | | |
163 | | - | |
| 226 | + | |
| 227 | + | |
164 | 228 | | |
165 | 229 | | |
166 | 230 | | |
167 | 231 | | |
168 | 232 | | |
169 | 233 | | |
170 | 234 | | |
171 | | - | |
| 235 | + | |
| 236 | + | |
172 | 237 | | |
173 | 238 | | |
174 | | - | |
| 239 | + | |
175 | 240 | | |
176 | 241 | | |
177 | 242 | | |
178 | | - | |
| 243 | + | |
| 244 | + | |
179 | 245 | | |
180 | 246 | | |
181 | 247 | | |
182 | 248 | | |
183 | 249 | | |
184 | 250 | | |
185 | | - | |
| 251 | + | |
| 252 | + | |
186 | 253 | | |
187 | | - | |
| 254 | + | |
188 | 255 | | |
| 256 | + | |
189 | 257 | | |
190 | 258 | | |
191 | 259 | | |
192 | 260 | | |
193 | 261 | | |
194 | | - | |
| 262 | + | |
195 | 263 | | |
196 | 264 | | |
197 | 265 | | |
198 | 266 | | |
199 | 267 | | |
200 | | - | |
| 268 | + | |
201 | 269 | | |
202 | | - | |
| 270 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
24 | | - | |
25 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | | - | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
32 | 39 | | |
33 | | - | |
| 40 | + | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| |||
116 | 123 | | |
117 | 124 | | |
118 | 125 | | |
119 | | - | |
120 | | - | |
121 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
122 | 139 | | |
123 | 140 | | |
124 | 141 | | |
| |||
0 commit comments