Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document standalone citation processing #37

Closed
agitter opened this issue Aug 2, 2018 · 10 comments
Closed

Document standalone citation processing #37

agitter opened this issue Aug 2, 2018 · 10 comments

Comments

@agitter
Copy link
Member

agitter commented Aug 2, 2018

The Manubot package can be broadly useful for citation processing even if users do not need the full functionality. We could document how to map citation identifiers to CSL JSON items with standalone examples like the test cases in test_citations.py.

See greenelab/deep-review#886 for another potential use case.

@slochower
Copy link
Collaborator

Do you mean harnessing the citation facility within Manubot without the full GitHub and CI functionality?

I have a little script locally that'll take a Markdown file I'm writing, copy it somewhere (e.g., /tmp but it doesn't really matter), run Manubot to process the citations, and then copy it back or display in browser. This way I can use Manubot for writing short notes where I want the citations processed.

But maybe you mean a more abstract API that'll just run citation JSON given an identifier.

@agitter
Copy link
Member Author

agitter commented Aug 3, 2018

I was thinking of a few lines of code that would show how the citation_to_citeproc function can be used. One of the test cases is close to what I had in mind:
https://github.com/greenelab/manubot/blob/f456155e6cbe83c32c80f74ad24bc069beb0bfc7/tests/test_citations.py#L76-L88

Provide an identifier and you can easily get authors, title, and other metadata.

@slochower
Copy link
Collaborator

Are you thinking it would be good if this could be called directly, e.g., manubot --get-citation="arxiv:cond-mat/0703470v2" returning either the JSON or CSL?

@agitter
Copy link
Member Author

agitter commented Aug 3, 2018

I hadn't thought about that, but maybe? I was thinking about importing and using that function directly as part of a larger Python codebase.

@dhimmel
Copy link
Member

dhimmel commented Aug 3, 2018

The citation identifier to citeproc is widely applicable beyond Manubot. Were we to advertise this functionality and make it easily usable, it could gain a lot of usage. To maximize usage, it would probably be best as a standalone library. However, in the meantime we could create some documentation for manubot.citations and manubot.metadata. In fact, manubot.metadata should probably become manubot.citation.retreve or something.

I will look into setup.py to see if there's an easy way to install only the dependencies required for citaiton processing.

I am guessing some users will want to pass full citations like doi:10.7554/eLife.32822, whereas others will just want to directly call get_pubmed_citeproc(29424689).

Larger picture, I think we should move the Manubot USAGE.md to this repository. Probably host documentation for Manubot in this repository rather than rootstock. We could even display the doc at a Manubot domain. I digress. Will open a new issue.

@dhimmel
Copy link
Member

dhimmel commented Aug 3, 2018

Good idea @slochower. I'd be in favor of a CLI like:

manubot cite "arxiv:cond-mat/0703470v2"

We may want to change the current manubot CLI command to manubot process or something.

BTW. Casey just acquired manubot.org. manu.bot would be better, but is administered by Amazon and only eligible for certain bots.

dhimmel added a commit to dhimmel/manubot that referenced this issue Aug 5, 2018
Backwards incompatabile API change. The `manubot` command is now
`manubot process`. A new `manubot cite` CLI has been added to
generate CSL for the specified citations.

Refs manubot#37
dhimmel added a commit that referenced this issue Aug 5, 2018
Merges #41
Refs #37

* Move citation code into manubot/cite
* Update imports with cite submodule
* Move each metadata resource to its own submodule
* Move citeproc / CSL code to submodule
* setup.py: use setuptools.find_packages
* Unrelated flake8 change
dhimmel added a commit to dhimmel/manubot that referenced this issue Aug 5, 2018
Backwards incompatabile API change. The `manubot` command is now
`manubot process`. A new `manubot cite` CLI has been added to
generate CSL for the specified citations.

Refs manubot#37
dhimmel added a commit to dhimmel/manubot that referenced this issue Aug 6, 2018
manubot#42

Ignore .pytest_cache/ dicectory

CLI to print CSL for citations: arparse sub-commands

Backwards incompatabile API change. The `manubot` command is now
`manubot process`. A new `manubot cite` CLI has been added to
generate CSL for the specified citations.

Refs manubot#37

Test manubot cite: assert error if no citations

Ignore flake8 line too long

Separate process code into module

Create command module with console_script entry point

manubot cite CLI: add --file option for output

Order arguments in required order

Test manubot cite: stdout & file output

Fix typo

CLI: require specifying submodule

Produce a descriptive error message in the case that Manubot is
called without a sub-command (i.e. `manubot`).

CLI: test v0.1.0

DOC: add sub-command usage to README.md

Workaround subprocess windows bug
@dhimmel dhimmel closed this as completed in 6f41e15 Aug 7, 2018
@agitter
Copy link
Member Author

agitter commented Aug 7, 2018

The new CLI in #42 is really great. Do we also want to show an example of access through a Python script?

>>> from manubot.cite import citation_to_citeproc
>>> csl_item = citation_to_citeproc('url:https://greenelab.github.io/meta-review/')
>>> csl_item['title']
'Open collaborative writing with Manubot'

@dhimmel
Copy link
Member

dhimmel commented Aug 7, 2018

Do we also want to show an example of access through a Python script?

Yes but not until the internal API stabilizes. I still am thinking about moving some functions and refactoring.

@agitter
Copy link
Member Author

agitter commented Aug 7, 2018

That makes sense.

@dhimmel
Copy link
Member

dhimmel commented Oct 22, 2018

BTW. Casey just acquired manubot.org. manu.bot would be better, but is administered by Amazon and only eligible for certain bots.

Somewhat related, it'd be great if we could get the @manubot GitHub handle to host our repositories. See manubot-zz/manuel.botero-hotmail.com#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants