-
Notifications
You must be signed in to change notification settings - Fork 85
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
design-needed: Create app to display licenses and license rules #32
Comments
For a local Webserver available in ScanCode-toolkit to consult license data:
This could also be a new Django app module in ScanCode.io with publicly available views. |
Here is an updated version: import saneyaml
import webbrowser
from bottle import route, run, template
from licensedcode.models import load_licenses
licenses = load_licenses()
webbrowser.open("http://localhost:8080/license")
@route('/license')
def license_list():
return '<br>'.join([f'<a href="/license/{key}">{key}</a>' for key in licenses.keys()])
@route('/license/<key>')
def license_text(key):
try:
data = saneyaml.dump(licenses[key].to_dict())
text = licenses[key].text
except KeyError:
return template('License {{key}} not found.', key=key)
return template('<pre>{{data}}</pre>\n=====================\n<pre>{{text}}</pre>', data=data, text=text)
run(host='localhost', port=8080) |
A similar approach generating a static HTML site that could be available through GitHub pages for example:
|
Signed-off-by: Thomas Druez <tdruez@nexb.com>
Signed-off-by: Thomas Druez <tdruez@nexb.com>
Signed-off-by: Thomas Druez <tdruez@nexb.com>
@pombredanne This PR about making the licenses data available from the ScanCode.io server UI is ready for review: #47 For the publicly available license data, see an example using the GitHub pages feature with a generated static HTML from the load_licenses(): Let me know your take on those 2 approches and if we should migrate the GitHub pages app into a reference nexB repo. |
@tdruez IMHO both approaches are worthy. The statically generated pages are easy and can make deployment as Github pages or else with minimal fuss quite easy. And the Django mini app allows clean integration in scancode.io in one step. |
Signed-off-by: Thomas Druez <tdruez@nexb.com>
Minimal license views are now available in ScanCode.io. |
These should be the scancode-toolkit licenses.
Ideally we should also have an easy to add new records which should then trigger a PR in scancode-toolkit
There should also ideally be a simple API that could be use d by aboutcde-toolkit to fetch license texts for attribution generation
The text was updated successfully, but these errors were encountered: