-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathslides.qmd
More file actions
648 lines (475 loc) · 25.3 KB
/
Copy pathslides.qmd
File metadata and controls
648 lines (475 loc) · 25.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
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
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
---
title: Deploying cross-language in high impact projects
format:
# revealjs: default
clean-revealjs: default
# self-contained: true
html-math-method:
method: mathjax
url: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
author:
- name: Robin Lovelace
orcid: 0000-0001-5679-6536
email: rob00 x at gmail dot com
affiliations: University of Leeds, Active Travel England
date: last-modified
bibliography: references.bib
---
# Introduction
## Contents
- Introduction
- Approaches to cross-language interoperability
- Containerisation
- Cross-language pain points
- Cross-language priorities
## Case study for reference
::::: columns
::: {.column width="50%"}
The Network Planning Tool for Scotland
- Development version (branch `dev`): [nptscot.github.io](https://nptscot.github.io/)
- Stable version (branch `production`): [www.npt.scot](https://www.npt.scot/)
:::
::: {.column width="50%"}

:::
:::::
## NPT stack
::::: columns
::: column
Backend: R + targets for 'cross-language' data pipeline workflow automation
- Relies on Rust crates
- Experiments with Python
Frontend: JS + MapLibre for visualisation
Progressive Web App (PWA)
:::
::: column

:::
:::::
## User interface

## Definitions
### "Deploying"
- Code runs on more than one computer
- Results are published on a website that is maintained
- Project is "in production"
- Users: Hosted on a trusted and well-used website
- Performance: updates to 'production' planned and documented
- Money changing hands
- Expectations
## Deploying the NPT

## Deployment workflow of NPT
Based on [workflow.yml file for](https://github.com/nptscot/nptscot.github.io/blob/production/.github/workflows/azure-static-web-apps-wonderful-beach-0edb91e03.yml) GitHub actions.

## "High impact projects"
- Broadly: tangible change results from the work
- With measurable impact on environmental, social (or economic?) outcomes
- E.g. Reduction in greenhouse gas emissions <!-- (accounting for 'rebound' effects) -->
- E.g. better diets resulting in more DALYs <!-- (disability-adjusted life years) -->
- Identifiable 'pathway to impact'
- E.g. New methods -\> new evidence -\> investment in active travel more effective that it would have been otherwise -\> more people cycling -\> tangible benefits
## Technical requirements for impact
- Users: The web application has users
- Scale: covers a large geographic area needs big data inputs
- Trusted: code review and multiple contributors
- User-friendly: if it's going to have lots of users
- Future proof: technology needs to last a long time
- Community: needed to ensure it lasts
## Why cross-language projects?
- Specific tool written in a particular language (`odjitter`)
- Required for 'best of both worlds' (JS for visualisation, R for statistical modelling)
- Having multiple implementations ensures robustness
- Aeroplane flight software has 3 implementations
- Redundancy common in mission-critical applications
## Comparing approaches
{{< video "geocompx_multi_lingal_blogpost.mp4" >}}
## Adding new languages
Source: [github.com/Robinlovelace/opengeohub2023](https://github.com/Robinlovelace/opengeohub2023/pull/40#issuecomment-2356008871)

## Practical session?
:::: incremental
- Who has written and visualised side-by-side code like this?
- [ ] Most people
- [ ] Some people
::: {.panel-tabset group="language"}
## R
```{r}
library(sf)
message("Hello world")
```
## Python
```{python}
import geopandas as gpd
print("Hello world")
```
:::
- What did you use?
- Would you like to learn?
::::
# Approaches to cross-language projects
Checked boxes indicate approaches used in the NPT project.
- [x] "Loose coupling" (system calls)
- [x] "Tight coupling" with low-level code embedded in R/Python/other packages (e.g. `sf`, `rsgeo`, `shapely`)
- [ ] Project environments (e.g. `pixi`, `mamba` [`rix`](https://docs.ropensci.org/rix/))
- [x] Containerisation
## Loose coupling
Example: [`odjitter`](https://github.com/dabreegster/odjitter/blob/98a7a6e03bc54bc79d3b3abbde91b6f79173ff1a/r/R/jitter.R#L163C1-L180C33) R package
``` r
msg = glue::glue("{odjitter_location} jitter --od-csv-path {od_csv_path} \\
--zones-path {zones_path} \\
--zone-name-key {zone_name_key} \\
--origin-key {origin_key} \\
--destination-key {destination_key} \\
--subpoints-origins-path {subpoints_origins_path} \\
--subpoints-destinations-path {subpoints_destinations_path} \\
--disaggregation-key {disaggregation_key} \\
--disaggregation-threshold {disaggregation_threshold} \\
--rng-seed {rng_seed} \\
{deduplicate_pairs} \\
--output-path {output_path}")
if(show_command) {
message("command sent to the system:")
cat(msg)
}
system(msg)
res = sf::read_sf(output_path)
```
## Loose coupling
Example: [`qgisprocess` R package](https://github.com/r-spatial/qgisprocess/blob/702358e5849b38a9ce8550ee0f8b465c902d59d4/R/qgis-run.R#L26-L53)
``` r
qgis_run <- function(args = character(), ..., env = qgis_env(), path = qgis_path()) {
if (is.null(path)) {
message(
"The filepath of 'qgis_process' is not present in the package cache, ",
"so the package is not well configured.\n",
"Restart R and reload the package; run `qgis_configure()` if needed.\n",
"For now, will try to fix it on the fly, but some functionality may not work.\n"
)
path <- qgis_path(query = TRUE, quiet = FALSE)
# typically the version will also be missing, so fixing that as well:
if (is.null(qgisprocess_cache$version)) {
invisible(qgis_version(query = TRUE, quiet = FALSE))
}
}
# workaround for running Windows batch files where arguments have spaces
# see https://github.com/r-lib/processx/issues/301
if (is_windows()) {
withr::with_envvar(
env,
processx::run("cmd.exe", c("/c", "call", path, args), ...),
)
} else {
withr::with_envvar(
env,
processx::run(path, args, ...)
)
}
}
```
## Tight coupling 1
Source: [`geoarrow-c`](https://github.com/geoarrow/geoarrow-c/blob/main/python/geoarrow-c/src/geoarrow/c/_lib.pyx#L1-L22)
``` py
# cython: language_level = 3
# cython: linetrace=True
"""Low-level geoarrow Python bindings."""
from libc.stdint cimport uint8_t, int32_t, int64_t, uintptr_t
from cpython cimport Py_buffer, PyObject
from libcpp cimport bool
from libcpp.string cimport string
cdef extern from "geoarrow_type.h":
struct ArrowSchema:
const char* format
const char* name
const char* metadata
int64_t flags
int64_t n_children
ArrowSchema** children
ArrowSchema* dictionary
void (*release)(ArrowSchema*)
void* private_data
```
## Tight coupling 2
Source: [`geoarrow-rs`](https://github.com/geoarrow/geoarrow-rs/blob/db06a8bf4b591b38fc164c29be86c630108751f6/python/pyo3-geoarrow/src/data_type.rs#L1-L29)
``` rust
use crate::error::{PyGeoArrowError, PyGeoArrowResult};
use crate::{PyCoordType, PyDimension};
use geoarrow::array::CoordType;
use geoarrow::datatypes::{Dimension, GeoDataType};
use pyo3::exceptions::PyValueError;
use pyo3::intern;
use pyo3::prelude::*;
use pyo3::types::{PyCapsule, PyType};
use pyo3_arrow::ffi::to_schema_pycapsule;
use pyo3_arrow::PyField;
#[pyclass(module = "geoarrow.rust.core._rust", name = "GeometryType", subclass)]
pub struct PyGeometryType(pub(crate) GeoDataType);
impl PyGeometryType {
pub fn new(data_type: GeoDataType) -> Self {
Self(data_type)
}
/// Import from a raw Arrow C Schema capsules
pub fn from_arrow_pycapsule(capsule: &Bound<PyCapsule>) -> PyGeoArrowResult<Self> {
PyField::from_arrow_pycapsule(capsule)?.try_into()
}
pub fn into_inner(self) -> GeoDataType {
self.0
}
}
```
## Tight coupling 3
Source: [`RcppExports.R` in `sf`](https://github.com/r-spatial/sf/blob/35f5f8be44e1923d242a489b51d7c58b8397a2a9/R/RcppExports.R#L212-L218)
``` r
CPL_geos_union <- function(sfc, by_feature = FALSE, is_coverage = FALSE) {
.Call(`_sf_CPL_geos_union`, sfc, by_feature, is_coverage)
}
CPL_geos_snap <- function(sfc0, sfc1, tolerance) {
.Call(`_sf_CPL_geos_snap`, sfc0, sfc1, tolerance)
}
```
## Tight coupling 4
<!-- https://github.com/paleolimbot/geos/blob/HEAD/R/geos-unary-geometry.R#L153-L169 -->
Source: [`geos-unary-geometry.R` in `geos`](https://github.com/paleolimbot/geos/blob/HEAD/R/geos-unary-geometry.R#L153-L169)
``` r
#' @rdname geos_centroid
#' @export
geos_unary_union <- function(geom) {
geom <- sanitize_geos_geometry(geom)
new_geos_geometry(.Call(geos_c_unary_union, geom), crs = attr(geom, "crs", exact = TRUE))
}
#' @rdname geos_centroid
#' @export
geos_unary_union_prec <- function(geom, grid_size) {
geom <- sanitize_geos_geometry(geom)
recycled <- recycle_common(list(geom, sanitize_double(grid_size)))
new_geos_geometry(
.Call(geos_c_unary_union_prec, recycled[[1]], recycled[[2]]),
crs = attr(geom, "crs", exact = TRUE)
)
}
```
## Tight coupling 5
<!-- https://github.com/JuliaGeo/LibGEOS.jl/blob/91f69c04843f02a995c5df54b0186891534a2ef4/src/geos_functions.jl#L712-L726 -->
Source: [`geos_functions.jl` in `LibGEOS.jl`](https://github.com/JuliaGeo/LibGEOS.jl/blob/91f69c04843f02a995c5df54b0186891534a2ef4/src/geos_functions.jl#L712-L726)
``` julia
function union(obj1::Geometry, obj2::Geometry, context::GEOSContext = get_context(obj1))
result = GEOSUnion_r(context, obj1, obj2)
if result == C_NULL
error("LibGEOS: Error in GEOSUnion")
end
geomFromGEOS(result, context)
end
function unaryUnion(obj::Geometry, context::GEOSContext = get_context(obj))
result = GEOSUnaryUnion_r(context, obj)
if result == C_NULL
error("LibGEOS: Error in GEOSUnaryUnion")
end
geomFromGEOS(result, context)
end
```
## Project environments
``` bash
pixi init test-project --format pyproject
```
```
✔ Initialized project in ~/test-project
```
``` bash
cd test-project
pixi add geopandas
pixi add --pypi --feature test pytest
pixi install
```
```
✔ Added pytest
Added these as pypi-dependencies.
Added these only for feature: test
```
Cross-language support (source: [pixi.sh](https://pixi.sh/latest/ide_integration/r_studio/))
``` bash
pixi add r-ggplot2
```
Although some issues according to my tests (see [prefix-dev/pixi#2066](https://github.com/prefix-dev/pixi/issues/2066))
## Pixi disk space usage
```
114M ┌── bin │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████ │ 6%
101M │ ┌── locale-archive.tmpl│▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████ │ 6%
101M │ ┌─┴ locale │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████ │ 6%
116M │ ┌─┴ lib64 │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████ │ 7%
142M │ ┌─┴ usr │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██████████ │ 8%
148M │ ┌─┴ sysroot │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████████ │ 8%
174M ├─┴ x86_64-conda-linux-gnu │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████████ │ 10%
245M │ ┌── 14.1.0 │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████████████████ │ 14%
245M │ ┌─┴ x86_64-conda-linux-gnu │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████████████████ │ 14%
246M │ ┌─┴ gcc │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████████████████ │ 14%
246M ├─┴ libexec │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█████████████████ │ 14%
108M │ ┌── 14.1.0 │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████ │ 6%
108M │ ┌─┴ x86_64-conda-linux-gnu │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████ │ 6%
108M │ ┌─┴ gcc │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████ │ 6%
341M │ │ ┌── site-packages │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓████████████████████████ │ 19%
391M │ ├─┴ python3.12 │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████████████████████████ │ 22%
1.0G ├─┴ lib │▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████████████████████████████████████████████████████████████████████ │ 58%
1.7G ┌─┴ default │████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ │ 100%
1.7G ┌─┴ envs │████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ │ 100%
1.7G ┌─┴ .pixi
```
## Containerisation
Source: [github.com/geocompx/docker](https://github.com/geocompx/docker)

## Containerisation 2
Source: [pangeo-data/pangeo-docker-images](https://github.com/pangeo-data/pangeo-docker-images)

## Containerisation 3
Source: <https://github.com/b-data>

## bdata: All images
| R | Python | Jupyter Hub | Jupyter Lab | code‑server (Code) | RStudio | Neovim | Git | Git LFS | Pandoc | CRAN date | Linux distro |
|:-----|:-----|:-----|:-----|:-----|:-----|:-----|:-----|:-----|:-----|:-----|:-----|
| 4.4.1 | 3.12.6 | 5.1.0 | 4.2.5 | 4.92.2 (1.92.2) | 2024.04.2+764 | 0.10.1 | 2.46.1 | 3.5.1 | 3.2 | | Debian 12 |
| 4.4.0 | 3.12.4 | 5.0.0 | 4.2.2 | 4.90.0 (1.90.0) | 2024.04.2+764 | n/a | 2.45.2 | 3.5.1 | 3.1.11 | 2024‑06‑14 | Debian 12 |
| 4.3.3 | 3.11.9 | 4.1.5 | 4.1.6 | 4.23.0 (1.88.0) | n/a | n/a | 2.44.0 | 3.5.1 | 3.1.11 | 2024‑04‑24 | Debian 12 |
| 4.3.2 | 3.11.8 | 4.0.2 | 4.1.2 | 4.21.2 (1.86.2) | n/a | n/a | 2.44.0 | 3.4.1 | 3.1.11 | 2024‑02‑29 | Debian 12 |
| 4.3.1 | 3.11.6 | 4.0.2 | 3.6.6 | 4.18.0 (1.83.1) | n/a | n/a | 2.42.0 | 3.4.0 | 3.1.1 | 2023‑10‑31 | Debian 12 |
| 4.3.0 | 3.11.4 | 4.0.1 | 3.6.4 | 4.13.0 (1.78.2) | n/a | n/a | 2.41.0 | 3.3.0 | 3.1.1 | n/a | Debian 12 |
| 4.2.3 | 3.10.11 | 4.0.0 | 3.6.3 | 4.9.1 (1.73.1) | n/a | n/a | 2.40.0 | 3.3.0 | 2.19.2 | n/a | Debian 11 |
| 4.2.2 | 3.10.10 | 3.1.1 | 3.6.1 | 4.9.1 (1.73.1) | n/a | n/a | 2.40.0 | 3.3.0 | 2.19.2 | n/a | Debian 11 |
| 4.2.1 | 3.9.2 | 2.3.1 | 3.5.0 | 4.8.1 (1.72.1) | n/a | n/a | 2.38.1 | 3.2.0 | 2.19.2 | n/a | Debian 11 |
| 4.2.0 | 3.9.2 | 2.3.1 | 3.4.3 | 4.4.0 (1.66.2) | n/a | n/a | 2.36.1 | 3.2.0 | 2.18 | n/a | Debian 11 |
## bdata: verse+ images
| R | CTAN date | Quarto |
|:------|:-----------|:---------------|
| 4.4.1 | | 1.5.57 |
| 4.4.0 | 2024‑06‑14 | 1.4.555 |
| 4.3.3 | 2024‑04‑24 | 1.4.553 |
| 4.3.2 | 2024‑02‑29 | 1.4.550 |
| 4.3.1 | 2023‑10‑31 | 1.3.450 |
| 4.3.0 | 2023‑06‑16 | 1.3.361 |
| 4.2.3 | 2023‑04‑21 | 1.2.475\[\^1\] |
| 4.2.2 | 2023‑03‑15 | 1.2.335\[\^1\] |
| 4.2.1 | 2022‑10‑31 | 1.1.251\[\^1\] |
| 4.2.0 | 2022‑06‑23 | n/a |
## bdata: qgisprocess images
| R | QGIS | SAGA | OTB\[\^1\] |
|:------|:-------|:------|:-----------|
| 4.4.1 | 3.38.3 | 9.1.3 | 9.0.0 |
| 4.4.0 | 3.36.3 | 9.1.3 | 9.0.0 |
| 4.3.3 | 3.36.2 | 9.1.3 | 9.0.0 |
| 4.3.2 | 3.36.0 | 9.1.3 | 8.1.2 |
| 4.3.1 | 3.34.0 | 9.1.3 | 8.1.2 |
| 4.3.0 | 3.30.3 | 8.5.0 | 8.1.1 |
| 4.2.3 | n/a | n/a | n/a |
| 4.2.2 | n/a | n/a | n/a |
| 4.2.1 | n/a | n/a | n/a |
| 4.2.0 | n/a | n/a | n/a |
## bdata: demo
Source: https://github.com/b-data/jupyterlab-r-docker-stack/tree/main?t
ab=readme-ov-file
``` bash
docker run -it --rm \
-p 8888:8888 \
-u root \
-v "${PWD}/jupyterlab-jovyan":/home/jovyan \
-e NB_UID=$(id -u) \
-e NB_GID=$(id -g) \
-e CHOWN_HOME=yes \
-e CHOWN_HOME_OPTS='-R' \
glcr.b-data.ch/jupyterlab/r/geospatial
```
## Rocker images (on which geocompx docker builds):
<!--
install_jupyter.sh
install_nvtop.sh
install_pandoc.sh
install_pyenv.sh
install_python.sh -->
> The Docker images built from this repository describe the software installation method in standalone scripts rather than directly in the Dockerfiles.
> These files are under the scripts directory, and these files are copied in all Docker images, under a top-level /rocker_scripts directory.
> This allows users to extend images by selecting additional modules to install on top of any pre-built images.
E.g.
```
FROM rocker/rstudio:4.0.0
RUN /rocker_scripts/install_python.sh
RUN /rocker_scripts/install_julia.sh
```
# Cross-language pain points
## Too many options: IDE
- VSCode is market leader with strong community
- Pro: many extensions
- Pro: Live Share
- Pro: GitHub integration (including copilot)
- Pro: devcontainers work out-of-the-box
- Con: setup time, can be intimidating
- Positron
- Pro: More batteries included
- Con: Missing great VSCode features (e.g. Live Share)
- Con: Early days, fewer developers
- Thought: why didn't they put energy into great extensions for modularity?
- RStudio, Jupyter Lab, Zed, ...
## Resource requirements
- Each new environment can take up a few GB of space
- Lack of shared binaries, could be overcome by pixi and judicious use of Docker containers
- Headspace requirements of learning new syntax and quirks
# Cross-language priorities
## Interactive session
- What would your top ask be to use multiple languages in a single session?
- What would you like to see in a shared environment, e.g. pixi (see )
# Bonus: cross-language publishing
## Quickstart: .devcontainer in GitHub codespaces
[](https://codespaces.new/Robinlovelace/cross_language_projects)

## Cross-language tabsets
```
::: {.panel-tabset group="language"}
...
:::
```

## Output
::: {.panel-tabset group="language"}
## R
```{r}
#| echo: true
library(sf)
sf::write_sf(spData::world, "world.gpkg")
plot(spData::world)
```
## Python
```{python}
#| echo: true
import geopandas as gpd
world = gpd.read_file('world.gpkg')
world.plot()
```
:::
## Setting-up `gh-pages` branch
You can do this with a single quarto command:
``` sh
quarto publish gh-pages
```
Which leads to the following text and eventually auto-opens the deployed webiste!

## The website
The previous command creates a `gh-pages` branch with the slides in the `docs` folder.
This is then automatically deployed to GitHub Pages, and the website is opened in your browser when ready:

How awesome is that?
### 🤯🤯🤯
## Debugging
Source of `quarto publish gh-pages` hint: [Error message from GitHub Actions](https://github.com/Robinlovelace/reproducible-slides-repo-template/actions/runs/10860601182/job/30141397336#step:4:34) when trying to publish slides to GitHub Pages:
```
ERROR: Unable to publish to GitHub Pages (the remote origin does not have a branch named "gh-pages". Use first `quarto publish gh-pages` locally to initialize the remote repository for publishing.)
```

## Adding citations {background-color="#40666e"}
## With the Quarto extension
- You need to be in Visual Editor mode (Ctrl+Shift+F4)
- Then it's Ctrl+Shift+F8

Creates citations like this: [@peng2011]
## With "Citation Picker for Zotero" extension
- Issue with this approach: doesn't generate the .bib file

Alt+Shift+Z
## Support in IDEs

# References