Enable duecredit for magdir#293
Conversation
Closes fatiando#222 Adds the ability to easily get the citation of a function that was used. To test: 1. Install duecredit: `pip install duecredit` Then, either: 1. Call the script with `python -m duecredit gravmag_magdir_dipolemagdir.py`. OR 1. Set an environment variable: `DUECREDIT_ENABLE=yes`. 2. Run `python cookbook\gravmag_magdir_dipolemagdir.py`. Either method should output something like the following on the command line. Any output from the script will be shown first. =========== DueCredit Report: - Estimates total mag. dir. of approx. spherical bodies / fatiando.gravmag.magdir:DipoleMagDir (v 0.4-21-gcb9ce97-dirty) [1] - Scientific tools library / numpy (v 1.10.4) [2] 1 package cited 0 modules cited 1 function cited References ---------- [1] Oliveira, V.C. et al., 2015. Estimation of the total magnetization direction of approximately spherical bodies. Nonlin. Processes Geophys., 22(2), pp.215-232.
|
@mtb-za wow thanks for this! That was very quick. From what I understood of their docs, you can only get the citation information if you have |
|
While you're at it, could you also please add the following to the docstring of After the first line of the docstring add the line: and place the reference after Blakely: That way we are complete with #222 |
|
One more thing, maybe we should rename |
Added reference to the docstring as usual. Renamed duecredit's stub to be internal for us, not public facing.
Forgot to change the import after moving the duecredit stub.
|
This should be pretty much done now. If someone gives it the OK, I will edit the changelog and it can be merged. |
|
This is perfect, thanks Martin! You can add the changelog entry (please provide a link to the duecredit.org website there). Also, make sure the documentation builds properly after the change. Let me know when it's done and I'll merge this. |
|
I am having trouble running make on this computer. The last commit fixed an error in the Travis build for the docs, so I think it is working now. I will try and check this in the next couple days on a *nix machine. But if someone else can check before then, that would be good. The output for the docs from Travis is here: |
| to subsections. | ||
| (`PR 275 <https://github.com/fatiando/fatiando/pull/275>`__) | ||
| * Added back-end support for decorators from duecredit | ||
| (`<https://github.com/duecredit/duecredit/>`__) to be added to methods. This |
There was a problem hiding this comment.
Please replace
duecredit (`<https://github.com/duecredit/duecredit/>`__)`
with
`duecredit <https://github.com/duecredit/duecredit/>`__
The syntax
text <target>__
in rst is equivalent to
[Text](target)
In Markdown. I get this wrong all the time. That's one of the reasons i added "build the docs locally" to the check list 😄
|
Are you getting an error running make or don't have it installed? Unicode support is one the reasons I really want to move to Python 3. That - in the page numbers of the reference always gets me. |
|
It is installed, but is giving me an error when I run This seems to be something related to a space in the path to |
Having trouble running make on this computer: it is complaining about the path to `sh`. The travis build suggests that there is a problem here though: building [html]: targets for 122 source files that are out of date updating environment: 135 added, 0 changed, 0 removed reading sources... [ 9%] api/gravmag.magdir Encoding error: 'ascii' codec can't decode byte 0xe2 in position 2846: ordinal not in range(128) The full traceback has been saved in /tmp/sphinx-err-5FAnuX.log, if you want to report the issue to the developers. make: *** [html] Error 1 make: Leaving directory `/home/travis/build/fatiando/fatiando/doc' Finished building documentation This commit should remove the only non-ASCII character that I introduced. Fixed syntax in changelog.rst file
036c028 to
1bb59fe
Compare
|
@mtb-za using command-line tools in Windows is always a pain. OK, I'll run it here as well and see if I catch anything. |
|
@mtb-za Travis seems to be OK and the docs build perfectly on my machine, so I'll merge this now. Thanks again for doing this so quickly! |
Fixes #222 and test for general rollout of #292
Adds the ability to easily get the citation of a function that was used.
To test:
pip install duecredit(This should be doable without installing it globally, but that is not working
for me. I may be missing something here with importing the module, because
this is what
our_duecredit.pyis supposed to enable, if I understand theirdocs correctly.)
Then, either:
python -m duecredit gravmag_magdir_dipolemagdir.py.OR
DUECREDIT_ENABLE=yes.python cookbook\gravmag_magdir_dipolemagdir.py.Any output from the script will be shown first, followed by something like:
Checklist:
doc/install.rst,requirements.txt,environment.yml,ci/requirements-conda.txtandci/requirements-pip.txt.cd doc; makelocally)