diff --git a/.github/workflows/build-site.yml b/.github/workflows/build-site.yml index b3d0678..d3d38b3 100644 --- a/.github/workflows/build-site.yml +++ b/.github/workflows/build-site.yml @@ -2,6 +2,7 @@ name: Build Site on: push: branches: ["master"] + workflow_dispatch: jobs: build-docs: @@ -20,6 +21,14 @@ jobs: run: Rscript -e 'renv::install("reticulate")' - name: Set up quarto uses: quarto-dev/quarto-actions/setup@v2 + - name: Build Research pages + run: | + python make_research_qmd.py --zotero_key ${{ secrets.ZOTERO_KEY }} + git config user.name 'bot' + git config user.email '...' + git add research/papers/* + git commit -m "gh workflow build [skip actions]" + git push - name: Render and publish to gh pages uses: quarto-dev/quarto-actions/publish@v2 with: diff --git a/make_research_qmd.py b/make_research_qmd.py new file mode 100644 index 0000000..fc1d556 --- /dev/null +++ b/make_research_qmd.py @@ -0,0 +1,55 @@ +from pyzotero import zotero +from zotero2qmd.zotero2qmd import item2main, main2qmd, filter_pubs +from collections import Counter +import re +import yaml +from pathlib import Path +import click + + +def make_file_names(all_mains): + first_aut = [x["author"][0]["name"]["family"] for x in all_mains] + years = [x["date"].split("-")[0] for x in all_mains] + keys = [x["params"]["key"] for x in all_mains] + + all_stem = [f"{aut}_{year}_{key}" for aut, year, key in zip(first_aut, years, keys)] + + all_stem = [re.sub(r"_$", "", x) for x in all_stem] + return all_stem + +@click.command() +@click.option( + '--zotero_key', + default = ".zotero" +) +def zotero_qmd( + zotero_key +): + if zotero_key == ".zotero": + keypath = Path(".zotero") + with keypath.open() as keyfile: + zotero_key = keyfile.readline().strip() + + zot = zotero.Zotero( + library_id='7642731', + library_type='user', + api_key=zotero_key + ) + + pubs = zot.publications() + + filtered_pubs = filter_pubs(pubs) + all_mains = [item2main(x) for x in filtered_pubs] + all_stems = make_file_names(all_mains) + out_path = Path("research","papers") + + for stem, item in zip(all_stems, all_mains): + out_file = out_path.joinpath(stem).with_suffix(".qmd") + if not out_file.exists(): + with out_file.open(mode = "w"): + qmd_string = "---\n"+yaml.dump(item)+"\n---" + out_file.write_text(qmd_string) + + +if __name__ == "__main__": + zotero_qmd() \ No newline at end of file diff --git a/renv.lock b/renv.lock index 41e57a4..062db19 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.3.0", + "Version": "4.4.0", "Repositories": [ { "Name": "CRAN", @@ -16,9 +16,9 @@ "Packages": { "MASS": { "Package": "MASS", - "Version": "7.3-60", + "Version": "7.3-60.2", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "R", "grDevices", @@ -27,15 +27,16 @@ "stats", "utils" ], - "Hash": "a56a6365b3fa73293ea8d084be0d9bb0" + "Hash": "2f342c46163b0b54d7b64d1f798e2c78" }, "Matrix": { "Package": "Matrix", - "Version": "1.5-4", + "Version": "1.7-0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", + "grDevices", "graphics", "grid", "lattice", @@ -43,38 +44,18 @@ "stats", "utils" ], - "Hash": "e779c7d9f35cc364438578f334cffee2" - }, - "R6": { - "Package": "R6", - "Version": "2.5.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "470851b6d5d0ac559e9d01bb352b4021" - }, - "RColorBrewer": { - "Package": "RColorBrewer", - "Version": "1.1-3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "45f0398006e83a5b10b72a90663d8d8c" + "Hash": "1920b2f11133b12350024297d8a4ff4a" }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.11", + "Version": "1.0.12", "Source": "Repository", "Repository": "RSPM", "Requirements": [ "methods", "utils" ], - "Hash": "ae6cbbe1492f4de79c45fce06f967ce8" + "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" }, "RcppTOML": { "Package": "RcppTOML", @@ -87,19 +68,9 @@ ], "Hash": "c232938949fcd8126034419cc529333a" }, - "base64enc": { - "Package": "base64enc", - "Version": "0.1-3", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R" - ], - "Hash": "543776ae6848fde2f48ff3816d0628bc" - }, "boot": { "Package": "boot", - "Version": "1.3-28.1", + "Version": "1.3-30", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -107,145 +78,40 @@ "graphics", "stats" ], - "Hash": "9a052fbcbe97a98ceb18dbfd30ebd96e" - }, - "bslib": { - "Package": "bslib", - "Version": "0.6.1", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "base64enc", - "cachem", - "grDevices", - "htmltools", - "jquerylib", - "jsonlite", - "lifecycle", - "memoise", - "mime", - "rlang", - "sass" - ], - "Hash": "c0d8599494bc7fb408cd206bbdd9cab0" - }, - "cachem": { - "Package": "cachem", - "Version": "1.0.8", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "fastmap", - "rlang" - ], - "Hash": "c35768291560ce302c0a6589f92e837d" + "Hash": "96abeed416a286d4a0f52e550b612343" }, "cli": { "Package": "cli", - "Version": "3.6.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "utils" - ], - "Hash": "1216ac65ac55ec0058a6f75d7ca0fd52" - }, - "colorspace": { - "Package": "colorspace", - "Version": "2.1-0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "grDevices", - "graphics", - "methods", - "stats" - ], - "Hash": "f20c47fd52fae58b4e377c37bb8c335b" - }, - "digest": { - "Package": "digest", - "Version": "0.6.33", + "Version": "3.6.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "b18a9cf3c003977b0cc49d5e76ebe48d" - }, - "ellipsis": { - "Package": "ellipsis", - "Version": "0.3.2", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "rlang" - ], - "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" + "Hash": "b21916dd77a27642b447374a5d30ecf3" }, "evaluate": { "Package": "evaluate", - "Version": "0.23", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "methods" - ], - "Hash": "daf4a1246be12c1fa8c7705a0935c1a0" - }, - "farver": { - "Package": "farver", - "Version": "2.1.1", - "Source": "Repository", - "Repository": "CRAN", - "Hash": "8106d78941f34855c440ddb946b8f7a5" - }, - "fastmap": { - "Package": "fastmap", - "Version": "1.1.1", - "Source": "Repository", - "Repository": "RSPM", - "Hash": "f7736a18de97dea803bde0a2daaafb27" - }, - "fontawesome": { - "Package": "fontawesome", - "Version": "0.5.2", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "htmltools", - "rlang" - ], - "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" - }, - "fs": { - "Package": "fs", - "Version": "1.6.3", + "Version": "0.24.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "47b5f30c720c23999b913a1a635cf0bb" + "Hash": "a1066cbc05caee9a4bf6d90f194ff4da" }, "glue": { "Package": "glue", - "Version": "1.6.2", + "Version": "1.7.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "4f2596dfb05dac67b9dc558e5c6fba2e" + "Hash": "e0b3a53876554bd45879e596cdb10a52" }, "here": { "Package": "here", @@ -259,41 +125,14 @@ }, "highr": { "Package": "highr", - "Version": "0.10", + "Version": "0.11", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "xfun" ], - "Hash": "06230136b2d2b9ba5805e1963fa6e890" - }, - "htmltools": { - "Package": "htmltools", - "Version": "0.5.7", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "base64enc", - "digest", - "ellipsis", - "fastmap", - "grDevices", - "rlang", - "utils" - ], - "Hash": "2d7b3857980e0e0d0a1fd6f11928ab0f" - }, - "jquerylib": { - "Package": "jquerylib", - "Version": "0.1.4", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "htmltools" - ], - "Hash": "5aab57a3bd297eee1c1d862735972182" + "Hash": "d65ba49117ca223614f71b60d85b8ab7" }, "jsonlite": { "Package": "jsonlite", @@ -307,7 +146,7 @@ }, "knitr": { "Package": "knitr", - "Version": "1.45", + "Version": "1.47", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -319,22 +158,11 @@ "xfun", "yaml" ], - "Hash": "1ec462871063897135c1bcbe0fc8f07d" - }, - "labeling": { - "Package": "labeling", - "Version": "0.4.3", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "graphics", - "stats" - ], - "Hash": "b64ec208ac5bc1852b285f665d6368b3" + "Hash": "7c99b2d55584b982717fcc0950378612" }, "lattice": { "Package": "lattice", - "Version": "0.21-8", + "Version": "0.22-6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -345,7 +173,7 @@ "stats", "utils" ], - "Hash": "0b8a6d63c8770f02a8b5635f3c431e6b" + "Hash": "cc5ac1ba4c238c7ca9fa6a87ca11a7e2" }, "lifecycle": { "Package": "lifecycle", @@ -370,20 +198,9 @@ ], "Hash": "7ce2733a9826b3aeb1775d56fd305472" }, - "memoise": { - "Package": "memoise", - "Version": "2.0.1", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "cachem", - "rlang" - ], - "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" - }, "mgcv": { "Package": "mgcv", - "Version": "1.8-42", + "Version": "1.9-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -396,32 +213,11 @@ "stats", "utils" ], - "Hash": "3460beba7ccc8946249ba35327ba902a" - }, - "mime": { - "Package": "mime", - "Version": "0.12", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "tools" - ], - "Hash": "18e9c28c1d3ca1560ce30658b22ce104" - }, - "munsell": { - "Package": "munsell", - "Version": "0.5.0", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "colorspace", - "methods" - ], - "Hash": "6dfe8bf774944bd5595785e3229d8771" + "Hash": "110ee9d83b496279960e162ac97764ce" }, "nlme": { "Package": "nlme", - "Version": "3.1-162", + "Version": "3.1-164", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -431,7 +227,7 @@ "stats", "utils" ], - "Hash": "0984ce8da8da9ead8643c5cbbb60f83e" + "Hash": "a623a2239e642806158bc4dc3f51565d" }, "png": { "Package": "png", @@ -480,9 +276,9 @@ }, "reticulate": { "Package": "reticulate", - "Version": "1.34.0", + "Version": "1.38.0", "Source": "Repository", - "Repository": "RSPM", + "Repository": "CRAN", "Requirements": [ "Matrix", "R", @@ -498,42 +294,18 @@ "utils", "withr" ], - "Hash": "a69f815bcba8a055de0b08339b943f9e" + "Hash": "8810e64cfe0240afe926617a854a38a4" }, "rlang": { "Package": "rlang", - "Version": "1.1.2", + "Version": "1.1.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "50a6dbdc522936ca35afc5e2082ea91b" - }, - "rmarkdown": { - "Package": "rmarkdown", - "Version": "2.25", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "bslib", - "evaluate", - "fontawesome", - "htmltools", - "jquerylib", - "jsonlite", - "knitr", - "methods", - "stringr", - "tinytex", - "tools", - "utils", - "xfun", - "yaml" - ], - "Hash": "d65e35823c817f09f4de424fcdfa812a" + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" }, "rprojroot": { "Package": "rprojroot", @@ -545,43 +317,9 @@ ], "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" }, - "sass": { - "Package": "sass", - "Version": "0.4.8", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R6", - "fs", - "htmltools", - "rappdirs", - "rlang" - ], - "Hash": "168f9353c76d4c4b0a0bbf72e2c2d035" - }, - "scales": { - "Package": "scales", - "Version": "1.3.0", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "R", - "R6", - "RColorBrewer", - "cli", - "farver", - "glue", - "labeling", - "lifecycle", - "munsell", - "rlang", - "viridisLite" - ], - "Hash": "c19df082ba346b0ffa6f833e92de34d1" - }, "stringi": { "Package": "stringi", - "Version": "1.8.3", + "Version": "1.8.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -590,7 +328,7 @@ "tools", "utils" ], - "Hash": "058aebddea264f4c99401515182e656a" + "Hash": "39e1144fd75428983dc3f63aa53dfa91" }, "stringr": { "Package": "stringr", @@ -609,16 +347,6 @@ ], "Hash": "960e2ae9e09656611e0b8214ad543207" }, - "tinytex": { - "Package": "tinytex", - "Version": "0.49", - "Source": "Repository", - "Repository": "RSPM", - "Requirements": [ - "xfun" - ], - "Hash": "5ac22900ae0f386e54f1c307eca7d843" - }, "vctrs": { "Package": "vctrs", "Version": "0.6.5", @@ -633,39 +361,29 @@ ], "Hash": "c03fa420630029418f7e6da3667aac4a" }, - "viridisLite": { - "Package": "viridisLite", - "Version": "0.4.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R" - ], - "Hash": "c826c7c4241b6fc89ff55aaea3fa7491" - }, "withr": { "Package": "withr", - "Version": "2.5.2", + "Version": "3.0.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "grDevices", - "graphics", - "stats" + "graphics" ], - "Hash": "4b25e70111b7d644322e9513f403a272" + "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" }, "xfun": { "Package": "xfun", - "Version": "0.41", + "Version": "0.45", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "grDevices", "stats", "tools" ], - "Hash": "460a5e0fe46a80ef87424ad216028014" + "Hash": "ca59c87fe305b16a9141a5874c3a7889" }, "yaml": { "Package": "yaml", diff --git a/requirements.txt b/requirements.txt index 041d4b9..36b0301 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,16 +8,19 @@ async-lru==2.0.4 attrs==23.1.0 Babel==2.14.0 beautifulsoup4==4.12.2 +bibtexparser==1.4.1 bleach==6.1.0 certifi==2023.11.17 cffi==1.16.0 charset-normalizer==3.3.2 +click==8.1.7 comm==0.2.0 debugpy==1.8.0 decorator==5.1.1 defusedxml==0.7.1 executing==2.0.1 fastjsonschema==2.19.0 +feedparser==6.0.11 fqdn==1.5.1 idna==3.6 ipykernel==6.27.1 @@ -62,12 +65,16 @@ prompt-toolkit==3.0.43 psutil==5.9.6 ptyprocess==0.7.0 pure-eval==0.2.2 +pyaml==23.12.0 pycparser==2.21 Pygments==2.17.2 +pyparsing==3.1.2 python-dateutil==2.8.2 python-json-logger==2.0.7 +pytz==2024.1 PyYAML==6.0.1 pyzmq==25.1.2 +pyzotero==1.5.19 qtconsole==5.5.1 QtPy==2.4.1 referencing==0.32.0 @@ -76,6 +83,7 @@ rfc3339-validator==0.1.4 rfc3986-validator==0.1.1 rpds-py==0.13.2 Send2Trash==1.8.2 +sgmllib3k==1.0.0 six==1.16.0 sniffio==1.3.0 soupsieve==2.5 @@ -92,3 +100,4 @@ webcolors==1.13 webencodings==0.5.1 websocket-client==1.7.0 widgetsnbextension==4.0.9 +zotero2qmd @ git+https://github.com/JoFrhwld/zotero2qmd.git@d678db31706efe1786e8d454d9b735a78cdba1a6