Giter VIP home page Giter VIP logo

invenio-formatter's Introduction

invenio-formatter's People

Contributors

alizeepace avatar blixhavn avatar egabancho avatar github-actions[bot] avatar greut avatar inveniobot avatar jalavik avatar jeromecaffaro avatar jirikuncar avatar jmartinm avatar kaplun avatar kasioumis avatar kneczaj avatar konstantinastoikou avatar kpsherva avatar labordoc avatar lnielsen avatar ludmilamarian avatar manzikki avatar mb-wali avatar ndyankov avatar osso avatar rekt-hard avatar samihiltunen avatar slint avatar tgbaron avatar tiborsimko avatar utnapischtim avatar valkyriesavage avatar zzacharo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

invenio-formatter's Issues

release: beta version checklist

1. Global API overview + Prepare docs structure:

  • 1.1 Synchronize with new documentation structure inveniosoftware/cookiecutter-invenio-module#56
    • docs/requirements.txt should exist (EXAMPLE)
    • Run the cookiecutter repo diffing tool:
      • Create a new cookiecutter module with the same name and description in a separate place
      • Diff the repos: python repocheck.py ~/src/invenio-foobar ~/src/fresh/invenio-foobar
      • Synchronize all of the 'constant' files (CONTRIBUTING.rst, .gitignore, babel.ini, ...)
      • Check all of the 'diffed' files (README.rst, RELEASE_NOTES.rst, ...)
      • Manually check all of the remaining files (setupy.py, .travis.yml,tests/conftest.py,...)
  • 1.2 API proof-reading
    • Read and understand API
    • Check existing API methods for feature completeness and correctness.
    • Check if new API needs to be added.

2. Local code improvements:

  • 2.1 General code improvements
    • Check code quality all over the module
    • Does QualifiedCode report any errors that can be fixed?
    • Is the test coverage % sufficient across the whole module?
    • Is all core code (API, models) covered with unit test?
    • grep the module for "TODO"/"FIXME". Remove where no longer relevant.
    • Are all strings decorated as translation strings?
  • 2.2 Dependencies:
    • Remove unused dependencies in setup.py and requirements-devel.txt
    • Module should not depend on flask_cli nor should it instantiate FlaskCLI extension.
  • 2.3 Example app should run.

3. Documentation:

3.1. Write

  • 3.1.1 General documentation:
    • Document usage / getting started guide inside package docstring (EXAMPLE)
    • Make config variables self-documented and imported in the package docs under 'Configuration' section (EXAMPLE and EXAMPLE)
    • Add docstring documentation for example app
    • Are all API methods, classes and modules plugged in the documentation as autodoc?
    • Add intersphinx mappings where convenient and make sure they work compiled documentation (EXAMPLE_REFERENCE and EXAMPLE_CONFIG)
    • Are all chapter/section underlines (e.g. ====, -----) matching the length of the section/chapter title?
  • 3.1.2 Functional documentation:
    • Document all public method docstrings with description and types
      • Methods and functions that accept **kwargs should document potential arguments and mention if they are passed to another function/method which provides documentation for them.
    • Document signals

3.2 Review (read the compiled documentation A-Z)

  • Is all imported autodoc documentation being loaded correctly?
  • Do all pages and sections contain some text?
  • Are all links on the page (API class references, intersphinx links) resolvable?
  • Are all text and characters rendered correctly?
    • Non-breaking newlines going outside the page?
    • Strange characters, half-escaped style markers inside docstrings (*, **, ``)
  • Docs are compiled and assembled from multiple file/package docstings into single pages - is the assembled block of text easy to read? Unify the compiled text if possible.
  • Create a new virtual environment and follow the installation and then getting started guide - does it actually work as described? Add and improve documentation if the description is missing something.

4. Miscellaneous:

  • MANIFEST.txt
    • Should be sorted and without comments from auto-updates
    • Should NOT contain include *.py
  • List of modules in.editorconfig:known_third_party should match 1-to-1 all devel requirements in requirements-devel.txt (orders of modules should also match) (.editorconfig and requirements-devel.txt)
  • setup.py:
    • keywords: check existing keywords for relevance / add new ones
    • entrypoints: check if correct
    • Apply 'Development Status :: 4 - Beta'
  • Change double bracket "string" to 'string' if you spot it anywhere.

tests: simplify doctest execution

The following cookiecutter change:

inveniosoftware/cookiecutter-invenio-module#98

should be propagated to this Invenio module.

Namely, in run-tests.sh, the sphinx for doctests is invoked after pytest run:

$ tail -3 ./\{\{\ cookiecutter.project_shortname\ \}\}/run-tests.sh
sphinx-build -qnNW docs docs/_build/html && python setup.py test && sphinx-build -qnNW -b doctest docs docs/_build/doctest

This sometimes led to problems on Travis CI with the second sphinx-build run due
to "disappearing" dependencies after the example application was tested.

A solution that worked for invenio-marc21 (see
inveniosoftware/invenio-marc21#49 (comment))
and that was integrated in cookiecutter (see
inveniosoftware/cookiecutter-invenio-module#98) was to
run doctest execution in pytest, removing the second sphinx-build invocation.

This both solved Travis CI build failures and simplified test suite execution.

Note that this change may necessitate to amend the code tests etc so that things
would be executed with the Flask application context (see
inveniosoftware/invenio-marc21@09e98fc).

Installation instructions reference non-existent option "badges"

Package version (if known): 1.1.3

Describe the bug

The INSTALL.rst file and requirements.txt file reference an installation option called "badges", but there is no such option defined in setup.cfg. For example, here's a line from INSTALL.rst:

pip install invenio-formatter[badges]

The above will fail because extra feature "badges" is undefined.

Expected behavior

The instructions and requirements.txt file should probably not reference badges, or else an option for badges needs to be added to setup.cfg.

views: badges should contain "no-cache"-ing headers

This is part of a Travis badge SVG response headers:

$ curl https://travis-ci.org/zenodo/zenodo.svg\?branch\=master -L -I

HTTP/1.1 200 OK
Date: Mon, 28 Nov 2016 13:11:36 GMT
Content-Type: image/svg+xml
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Content-Type, Cache-Control, Expires, Etag, Last-Modified
Vary: Accept,Accept-Encoding
Cache-Control: no-cache
Etag: "a9e445ad2237440326816952c70dba79"
Pragma: no-cache
Expires: Mon, 28 Nov 2016 13:11:36 GMT
Content-Disposition: inline; filename="failing.svg"
Last-Modified: Thu, 24 Nov 2016 15:27:27 GMT
X-Content-Digest: 922c9cc746e8bc766b6acfed45d83e014df8a13e
Age: 0
X-Rack-Cache: miss, store
...

...while this is from an invenio-formatter badge:

$ curl https://zenodo.org/badge/6365411.svg -L -I

HTTP/1.1 200 OK
Date: Mon, 28 Nov 2016 13:06:05 GMT
Content-Type: image/svg+xml
...

In badge responses we should include headers such as Cache-Control, Etag, Pragma, Expires, Last-Modified so they are correctly not cached.

Access-Control-Allow-* headers (aka CORS headers) should be investigated as well (or at least documented).

(Original issue from Zenodo: zenodo/zenodo#912)

travis: fix build failure

https://travis-ci.org/github/inveniosoftware/invenio-formatter/jobs/664497132#L311

$ requirements-builder --level=min setup.py > .travis-lowest-requirements.txt
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7.15/bin/requirements-builder", line 8, in <module>
    sys.exit(cli())
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/requirements_builder/cli.py", line 69, in cli
    output.writelines(lines)
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/click/_compat.py", line 88, in writelines
    for line in lines:
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/requirements_builder/cli.py", line 66, in <genexpr>
    '{0}\n'.format(req)
  File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/requirements_builder/requirements_builder.py", line 108, in iter_requirements
    exec(setup_fp.read(), g)
  File "<string>", line 0
SyntaxError: encoding declaration in Unicode string
The command "requirements-builder --level=min setup.py > .travis-lowest-requirements.txt" failed and exited with 1 during .

api: stabilise and document

  • check existing API functionality
  • add missing important API functionality
  • check API function signatures and parameters
  • enhance API docstrings (param, returns, raises, versionadded)
  • plug API functions to existing docs

badge colors cannot be passed

Describe the bug

The generate_badge_* functions in context_processors/badges/badges.py accept a (background) color parameter, but this parameter is not currenty passed by the blueprint - thus it is not easily possible to customize badge colours.

Expected behavior

Generating a DOI button in a template like this:

<img id="record-doi-badge" data-target="[data-modal='{{ id_doi }}']"
        src="{{ url_for('invenio_formatter_badges.badge', title='DOI', color='#fcb425', value=id_doi.identifier, ext='svg') }}" alt="{{ id_doi.identifier }}" />

Generates a useable URL:
https://muya.soas.hasdai.org/badge/DOI/10.5281/zenodo.8359113.svg?color=%23fcb425
However since the parameter is not in the blueprint, the background colour remains the default blue specified in the generator functions.

I am happy to fix the view to accept this optional parameter, unless someone has a better approach?

Doi badge svg is not created

Package version (if known): v1.1.0

Describe the bug

A clear and concise description of what the bug is.
OS which does not have font DejaVuSans the Doi badge svg is not created.

Steps to Reproduce

  1. Build a containerized instance: invenio-cli containers start --lock --build --setup
  2. enable doi bage for landingpage
  3. go to record-landingpage
  4. See error
    doibadge-erro

Expected behavior

expected-doi

Additional context

possible solutions:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.