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
Github org/repo abstraction #1197
base: master
Are you sure you want to change the base?
Conversation
This starts working towards a common download/installation infrastructure (#1172). `download` module takes care of downloading code from external servers. Right now this is done using functions, but we may consider using classes here too, I'm not sure about that yet. `github` module handles a Github repository (later also organizations) through the REST API. * Create a github.Repo object from an org/repo and a given SHA (default: 'master') * Load JSON information representing the tree * Directories and files are handled as nodes. * Each node knows about * its children (if it's a directory), * some metadata * the URL from which a file can be downloaded TODO: * Make the networking more robust * Add organization handler
github.org.Organization class Factor out common functionality of repos and orgs to github.entity.Entity. This can so far list included repositories.
PS: First use cases for this will be listing (and then also downloading/installing) notation fonts and frescobaldi extensions. |
raw_url() and raw_file_url() provide URLs for accessing and retrieving repository elements directly fetch() and download_file() allow to retrieve files from Github based on the relative path inside the repository.
Provide generic Item and ItemCollection (because many item types behave very similarly in the Github API). Add Support for a repository's releases with - Releases - Release - Assets - Asset
This is *really* preliminary: - when the "Download" button is clicked, the list of available fonts is retrieved from Github and displayed in the terminal.
Nice! Would this pave the way to editing music on github, download openlilylib, have shared snippet repository etc? Isn't there maybe a ready to use python github api implementation? (Forgive my ignorance🙂) Just a side note: I often experiment by running python3 in the frescobaldi_app directory and then |
This will initially allow
(see #1172) I haven't thought about a shared snippet repository, but that should work too. Shared music editing will probably not benefit from this because that will be better dealt with in th The The "client" UIs (e.g. the music fonts dialog, the extensions Preferences page etc.) will have to provide interfaces to select (or detect) whether to interact with the remote resources through Git or the HTTP downloads. For example, it is of course better to clone an extension's repository and have it updated with Git than downloading and unpacking a static snapshot archive file. But we shouldn't require users to work with Git, not even transparently. One more (minor) thing I thought of is changing the exception handler to not send an email but create an issue on the Github tracker. But that would also involve the authentication issue, and maybe it would be better to simply have the "new issue" page opened for the user and the relevant information automatically copied to the clipboard then ... One thing I found out already is that the Github API is limited to 60 hits per hours for unauthenticated access. Maybe this will be an issue because there are multiple requests necessary for most basic things (e.g. one for the basic info, one more for getting the file tree, one for getting the releases list the one for each release and one for each release's assets list etc.)
There is a package PyGithub, but I'm not sure if it really helps that much, and it would of course add an additional dependency. OTOH I'm wondering whether it would be wise to make use of Qt for the |
Nice! (Frescobaldi 1 had a LilyPond downloader and installer. Maybe we can resurrect some of that code.) |
Where can I find the code for F1? Yesterday I did a little research and decided that I'll definitely use the QtNetwork module rather than plain Python. It's a prime case for using a framework. Regarding bug detection this should be possible - at least Atom can do that, although I don't know how they determine that. |
F1 is now at wbsoft/lilykde, the old LilyPond download dialog here. It heavily used the KDE libs, such as KIO ;-) |
Thanks, I'll see when I can get to that. I must admit that my initial attempt at integrating Just one remark: @wbsoft when you update a comment I won't be notified. |
In and of itself this doesn't do much yet, but it is a step in the direction of #1172, and I would be glad about some early feedback.
It allows to create
Repo
andOrganization
objects allowing access to the contents of organizations (so far: list included repositories) and repositories (so far: navigate their tree, get URLs and info about all the objects).Later there will be facilities to download individual objects or whole downloads.
Communication works through Github API, which will for example also allow the retrieval of download and clone links for managing repositories through Git.
NOTE: I am pretty sure that the networking part of the code has to be made more robust (although the actual exception handling will have to be implemented later in GUI parts using the module).
For testing: If you add the following code at the end of
frescobaldi_app/app.py
and start Fresocbaldi from the command line you should see the relevant output, you can also play around with the strings to see other organizations or repositories.On my PC it resulted in this output: