<div dir="ltr"><div>That's a lot of responses, thanks for the interest and the suggestions!</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Are there other languages or software communities that do something like this? It would be nice not to have to invent this wheel. Eventually a PEP and an implementation should be presented, but first the idea needs to be explored more.</span></blockquote><div> </div><div>To my knowledge, R is the only language that implements such a feature. Package developers add a CITATION text file containing a text with whatever text citation format for their package. A specialized <font face="monospace, monospace">citation()</font> built-in function can be called from the REPL that would return a citation for the R itself, including a BibTex file for LateX users. When <font face="monospace, monospace">citation</font> is called on a package instead, it returns the contents of CITATION for that package specifically (eg. <font face="monospace, monospace">citation("ggplot2")</font>) or alternatively uses package metadata to build a sane citation. Given that most of work with R is done within a REPL and packages are installed/imported with commands such as <font face="monospace, monospace">install.package("ggplot2")/import("ggplot2")</font>, this approach makes sense in that context. This, however, didn't feel terribly Pythonic to me. </div><div><br></div><div>As for PEP and a reference implementation, I will gladly take care of them if the idea gets enough traction, but there seems to be already a PEP draft as well as an attempt at implementation by one of the AstroPy/AstroML maintainers, using the <font face="monospace, monospace">__citation__</font> field and <font face="monospace, monospace">citation()</font> function to unpack it:</div><div><br></div><div><a href="https://github.com/adrn/CitationPEP" target="_blank">https://github.com/adrn/CitationPEP</a> <br></div><div><br></div><div>There also seem some packages in the community using <font face="monospace, monospace">__bibtex__</font> rather than <font face="monospace, monospace">__citation__</font> to store BibTeX entries but I haven't found yet any large project implementing it or PEP drafts associated to it.</div><div><br></div><div><br></div><div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">The software sustainability institute in the UK have written several blog posts advocating the use of CITATION files containing this sort of metadata:<br><a href="https://software.ac.uk/blog/2017-12-12-standard-format-citation-files" style="color:rgb(17,85,204)" target="_blank">https://software.ac.uk/blog/2017-12-12-standard-format-citation-files</a></blockquote><div><br></div>Yes, that's the R approach I presented above. It is viable, especially if hooked to something accessible from the REPL directly, such as __cite__ or __citation__ attribute/method for modules. I would, however, advocate for a more structured approach - perhaps JSON or BibTeX that would get parsed and converted to suitable citation format by the __cite__, if it was implemented as a method.</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A github code search for __citation__ also gets 127 hits that mostly seem to be research software that are using this attribute more or less as suggested here:<br><a href="https://github.com/search?q=__citation__&type=Code" target="_blank">https://github.com/search?q=__citation__&type=Code</a> </blockquote><div><br></div><div>Most of them are from the AstroPy universe or from the CitationPEP draft I've referenced above.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">This is indeed a serious problem. I suspect python-ideas isn't the<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">best venue for addressing it though – there's nothing here that needs<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">changes to the Python interpreter itself (I think), and the people who<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">understand this problem the best and who are most affected by it,<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">mostly aren't here.</span></blockquote><div> </div></div><div>There has been localized discussion popping up among the large scientific package maintainers and some attempts to solve the problem at the local level. Until now they seemed to be winding down due to a lack of a large-scale citation mechanism and a discussion about what is concretely doable at the scale of the language is likely to finalize </div><div><br></div><div>As for the list, reserving a <font face="monospace, monospace">__citation__/__cite__</font> for packages at the same level as <font face="monospace, monospace">__version__</font> is now reserved and adding a <font face="monospace, monospace">citation()/cite()</font> function to the standard library seemed large enough modifications to warrant searching a buy-in from the maintainers and the community at large.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">You'll want to check out the duecredit project:<br></span><a href="https://github.com/duecredit/duecredit" rel="noreferrer" style="color:rgb(17,85,204);background-color:rgb(255,255,255)" target="_blank">https://github.com/duecredit/duecredit<br></a><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">One of the things they've thought about is the ability to track<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">citation information at a more fine-grained way than per-package – for<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">example, there might be a paper that should be cited by anyone who<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">calls a particular method (or even passes a specific argument to some<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">specific method, when that turns on some fancy algorithm).</span></blockquote><div><br></div><div>Due credit looks amazing - I will definitely check it out. The idea was, however, to bring the barrier for adoption and usage as low as possible. In my experience, the vast majority of Python users in academic environment who aren't citing the packages properly are beginners. As such they are unlikely to search for third-party libraries beyond those they've found and used to solve their specific problem.</div><div><br></div><div> who just assembled a pipeline based on widely-used libraries and would need to generate a citation list for it to pass on to their colleagues responsible for the paper assembly and submission.</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I'd actually like to see a more general solution that isn't restricted<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">to any one language, because multi-language analysis pipelines are<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">very common. For example, we could standardize a convention where if a<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">certain environment variable is set, then the software writes out<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">citation information to a certain location, and then implement<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">libraries that do this in multiple languages. Of course, that's a<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">"dynamic" solution that requires running the software -- which is<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">probably necessary if you want to do fine-grained citations, but it<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">might be useful to also have static metadata, e.g. as part of the<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">package metadata that goes into sdists, wheels, and on PyPI. That<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">would be a discussion for the distutils-sig mailing list, which<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">manages that metadata.</span></blockquote><br></div><div>Thanks for the reference to the distutils-sig list. I will talk to them if the idea gets traction here</div><div><br></div><div>I am not entirely convinced for the multi-language pipelines. In bioinformatics, often the heavy lifting is done by a single package (for instance bowtie for RNA-seq alignment) and the output is piped to the custom script, mostly in R or Python. The citations for the library doing the heavy-lifting is often well-known and widely cited and the issues arise in the custom scripts importing and using libraries that should be cited without citing them.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">One challenge in standardizing this kind of thing is choosing a<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">standard way to represent citation information. Maybe CSL-JSON?<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">There's a lot of complexity as you dig into this, though of course one<br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">shouldn't let the perfect be the enemy of the good...</span></blockquote><div><br></div><div>CLS-JSON represented as a dict to be supplied to the setup file is definitely one way of doing it. I was, however, thinking more about the BibTeX format, given that CLS-JSON is more closely affiliated with Mendeley </div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Why does this have to be a dunder method? In general, application code<span> </span></span></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">shouldn't be calling dunders directly, they're reserved for Python.</span></blockquote></div><div><br></div><div>I was under the impression that sometimes the dunders are used to store relevant information that would not be of use to the most users, such as <font face="monospace, monospace">__version__</font> and sometimes to better control the execution flow (for instance the <font face="monospace, monospace">if __name__== "main"</font>)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">I think your description of what this method should do is not<span> <br></span></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">really coherent. On the one hand, you have __citation__() be a method<span> <br></span></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">that you call (how?) but on the other hand you have it being a data<span> <br></span></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">field __citation__ that you scan.</span></blockquote><div><br></div><div>My initial idea was to have a __cite__ method embedded in the import mechanism that would parse data from config and upon a call on a package, return the citation developers want to see associated to the current package version in the format user needs. (for instance<font face="monospace, monospace"> numpy.__cite__('bibtex')</font> would return a citation for the current <font face="monospace, monospace">numpy</font> version in BibTeX format). If called on the script itself <font face="monospace, monospace">__cite__('bibtex')</font> would iterate through all the imported modules and retrieve their citations one by one, at least for those that modules that have associated citation. </div><div><br></div><div>After reading the feedback in this thread, I believe that a __citation__ reserved field that pulls the data from the setup script and a cite() script in the standard library would be a better approach.</div><div><br></div><div>In the end, I believe the best would be to implement both of them and see which one feels more pythonic.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">I do think you have identified an important feature, but I think this<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4771 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_gramm m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-Style m_-8817930465565352327gmail-multiReplace" id="m_-8817930465565352327gmail-4771" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">is <br></span></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4771 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_gramm m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_disable_anim_appear m_-8817930465565352327gmail-Style m_-8817930465565352327gmail-multiReplace" id="m_-8817930465565352327gmail-4771" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">a</span><span> </span>*tool*, not a *language feature*. My spur of the moment<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4740 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_spell m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-ContextualSpelling m_-8817930465565352327gmail-ins-del" id="m_-8817930465565352327gmail-4740" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">thought</span><span> </span>is:</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">- we could have a script (a third party script? or in the std lib?) <br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  which the user calls, giving the name of their module or package as<br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  argument</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  e.g. "python -m cite<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4742 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_spell m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-ContextualSpelling" id="m_-8817930465565352327gmail-4742" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">myapplication</span>.py"</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">- this script knows how to<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4745 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_spell m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-ContextualSpelling m_-8817930465565352327gmail-multiReplace" id="m_-8817930465565352327gmail-4745" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">analyse</span><span> </span>myapplication.py for a list of<br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  dependencies, perhaps filtering out standard library packages;</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">- it interrogates<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4739 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_spell m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-ContextualSpelling m_-8817930465565352327gmail-ins-del m_-8817930465565352327gmail-multiReplace" id="m_-8817930465565352327gmail-4739" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">myapplication</span>, and each dependency, for a citation;</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">- this might involve reserving a standard __citation__ data field<br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  in each<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4748 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_gramm m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-Punctuation m_-8817930465565352327gmail-only-del m_-8817930465565352327gmail-replaceWithoutSep" id="m_-8817930465565352327gmail-4748" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">module,</span><span> </span>or a __citation__.xml file in the package, or<br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  some other protocol;</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">- or perhaps the cite script<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4738 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_spell m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-ContextualSpelling m_-8817930465565352327gmail-ins-del" id="m_-8817930465565352327gmail-4738" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">nows</span><span> </span>how to generate the appropriate<br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"> <span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4751 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_gramm m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-Grammar m_-8817930465565352327gmail-only-ins m_-8817930465565352327gmail-replaceWithoutSep" id="m_-8817930465565352327gmail-4751" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">citation</span><span> </span>itself, from any of the standard formatted data fields<br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  found in many common modules, like __author__, __version__ etc.</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">- either way, the script would generate a list of packages and<br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">  modules used by<span> </span><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_4741 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_spell m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-ContextualSpelling" id="m_-8817930465565352327gmail-4741" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">myapplication</span>, plus citations for them.</span></blockquote><div><br></div><div>Yes, that's the idea! The biggest reason for me to send the discussion to this list is to check if it would be acceptable to reserve the __citation__ data field in each module and include the cite() script in the standard library.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Presumably you would need to be able to specify which citation style to<span> <br></span></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">use.</span></blockquote><div> </div><div><div>Yes, but to avoid building a configurable citation engine for the thousands of formats there are in the wild,</div><div>it would take a couple of standard formats and interchangeable formats, such as bibtex or EndNote xref - both text</div><div>formats that are simple to use. I was thinking about the approach taken by Google Scholar from that perspective.</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="m_-8817930465565352327gmail-im" style="color:rgb(80,0,80);background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">> What does Python core team think about addition and long-term maintenance<br></span><span class="m_-8817930465565352327gmail-im" style="color:rgb(80,0,80);background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">> of such a feature to the import and setup mechanisms?</span><span class="m_-8817930465565352327gmail-im" style="color:rgb(80,0,80);background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial"><br></span><span style="background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">What does this have to do with either import or setup?</span></blockquote><div><br></div>The implementation I was thinking about would have required __citation__/__cite__ dunder reservation or implementation of a function that would be injected into installed packages. For setup I was thinking about adding the citation field to the distutils setup. I was not really aware of the distutils-sig discussion list that would be more appropriate with that regards.<div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A long time ago, I added a feature request for a page in the <br>documentation to show how to cite Python in various formats:<br><a href="https://bugs.python.org/issue26597" target="_blank">https://bugs.python.org/issue26597</a><br>I don't believe there has been any progress on this. (I certainly don't <br>know the right way to cite software.) Perhaps this can be merged with <br>your idea.</blockquote></div><div><br></div><div>That's a good point. Unfortunately, I have not thought about how to cite code that would not have an associated publication. From what I see by checking google scholar, as of now people are citing the Python language reference manual if they want to cite Python itself in a scientific publication. GVM didn't seem interested in citations for Python and from what I understand the vast majority of non-scientific package developer, given citations are not essential for their career advancement.<br></div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Should Python have a standard sys.__citation__ field that provides the <br>relevant detail in some format-independent, machine-readable object like <br>a named tuple? Then this hypothetical cite.py tool could read the tuple <br>and format it according to any citation style.</blockquote></div><div><br></div><div>The idea for Python itself seems good! However, rather than using a named tuple, I was thinking about using a dict consistent with CSL-JSON or BibTeX. And writing a citation generating engine that would be consistent with hundreds if not thousands journal-specific formats is a bit of the scope of the proposal for now - most of the time people just want something their citation/bibliography engine can ingest and generate a citation from there in their Word/LaTeX documents. Bibtex/EndNote export formats are perfect for that task in my experience.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">just thought that it might be worth pointing out that this should <br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">actually work both ways i.e. if a specific package, module or function <br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">is inspired by or directly implements the methods included in a specific <br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span class="m_-8817930465565352327gmail-gr_ m_-8817930465565352327gmail-gr_5076 m_-8817930465565352327gmail-gr-alert m_-8817930465565352327gmail-gr_gramm m_-8817930465565352327gmail-gr_inline_cards m_-8817930465565352327gmail-gr_run_anim m_-8817930465565352327gmail-Grammar m_-8817930465565352327gmail-only-ins m_-8817930465565352327gmail-replaceWithoutSep" id="m_-8817930465565352327gmail-5076" style="display:inline;border-bottom:2px solid transparent;background-repeat:no-repeat;color:inherit;font-size:inherit">publication</span><span> </span>then any __citation__ entries within it should also cite <br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">that/those or allow references to them to be recovered.</span><br style="color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial"><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">The general principle is if you are expecting to be cited you also have <br></span><span style="line-height:1.57143em;color:rgb(56,56,56);font-family:gotham,helvetica,arial,sans-serif;font-size:14px;text-decoration-style:initial;text-decoration-color:initial">to cite.</span></blockquote><div><br></div><div>The general convention is to cite the top-level publication. While some methods definitely deserve a citation on their own (such as Sobol filter in Scikits-image), they provide a link to the relevant citation in their documentation to them and would normally cite them in their master publication. That's definitely an idea to look at but I don't see a straightforward of implementing this so far.</div><div><br></div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I think this is a fine idea, but could be achieved by convention, like<br>__version__, rather than by fiat.<br>And it’s certainly not a language feature.<br>So Nathaniel’s right — the thing to do now is work out the convention,<br>and then advocate for it.</blockquote><div><br></div><div>This already seems to be an idea floating in the air - AstroPy is inching towards that implementation. The idea is to modify the language to make citing as straightforward as possible and create a universal mechanism for that.</div></div><div><br></div><div>Best,</div><div><br clear="all"><div><div dir="ltr" class="m_-8817930465565352327gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><p style="background-image:initial;background-position:initial;background-repeat:initial"><b><span style="font-size:10pt;font-family:Arial,sans-serif">Andrei Kucharavy</span></b><span style="font-size:9.5pt;font-family:Arial,sans-serif"></span></p>

<p style="background-image:initial;background-position:initial;background-repeat:initial"><span style="font-size:8pt;font-family:Arial,sans-serif">Post-Doc @ <b>Joel S. Bader</b></span><b style="font-size:12.8px"><span style="font-size:8pt;font-family:Arial,sans-serif"> Lab</span></b></p>

<p style="background-image:initial;background-position:initial;background-repeat:initial"><span style="font-size:8pt;font-family:Arial,sans-serif">Johns Hopkins University, Baltimore, USA.</span><span style="font-size:9.5pt;font-family:Arial,sans-serif"></span></p></div></div></div></div></div></div><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Jun 28, 2018 at 11:48 AM Chris Barker - NOAA Federal via Python-ideas <<a href="mailto:python-ideas@python.org" target="_blank">python-ideas@python.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I think this is a fine idea, but could be achieved by convention, like<br>
__version__, rather than by fiat.<br>
<br>
And it’s certainly not a language feature.<br>
<br>
So Nathaniel’s right — the thing to do now is work out the convention,<br>
and then advocate for it.<br>
<br>
-CHB<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div></div></div>