Coder Social home page Coder Social logo

Check CircuitPython version about circup HOT 9 CLOSED

adafruit avatar adafruit commented on August 27, 2024
Check CircuitPython version

from circup.

Comments (9)

lesamouraipourpre avatar lesamouraipourpre commented on August 27, 2024

After a proper look at the code, CircUp already has this feature for normal releases.

It would be nice to be notified of newer beta versions, but after reading github documentation the only redirecting url seems to be github.../releases/latest which links to the current non-beta release.

Without parsing the github..circuitpython/releases (or maybe github..circuitpython/tags) page, I can't see an easy way to extract the information.

I'll leave this open in case someone can figure an easy way to get the latest beta/rc release version. Otherwise, I'll close it in a week or so.

from circup.

Neradoc avatar Neradoc commented on August 27, 2024

The list of releases if available from: https://api.github.com/repos/adafruit/circuitpython/releases
A non stable relase is one where "-" in release['tag_name'] (that's the test circuitpython itself does to identify un/stable releases in the download pages of circuitpython.org)

import json
import requests
response = requests.get("https://api.github.com/repos/adafruit/circuitpython/releases")
data = response.json()
betas = [
    release['tag_name']
    for release in data
    if "-" in release['tag_name']
]
print(betas[0])
6.2.0-beta.4

Of course there is potential rate limiting issues with the API, but we don't need to hit it more than once a day, and can safely ignore an error.

from circup.

lesamouraipourpre avatar lesamouraipourpre commented on August 27, 2024
betas = [ release['tag_name'] for release in data if "-" in release['tag_name'] ]

could be improved to

betas = [ release['tag_name'] for release in data if release['prerelease'] ]

We could also do something with git command line like
git ls-remote --tags --refs https://github.com/adafruit/circuitpython
This currently downloads ~11k compared to ~100k for the webpage. It also gives all tags but they would need to be version parsed and sorted.

from circup.

askpatrickw avatar askpatrickw commented on August 27, 2024

Thanks @lesamouraipourpre for going back and verifying that indeed circup does have this already.

It might be worth adding the downloads link into the existing new version notification.
https://circuitpython.org/downloads

https://github.com/adafruit/circup/blob/master/circup.py#L819

As for discovering and encouraging beta usage, for the general population of CP folks (beginners) I wouldn't push for that. It's also not how python packaging\pip works. You pip install from the releases and you go to the repo\website for non-released versions. I think we're trying to mostly mimic that behavior here (although we use "list" in non pip-like fashion).

from circup.

lesamouraipourpre avatar lesamouraipourpre commented on August 27, 2024

We could do something like the following pseudo-code which for most CircUp users would do nothing different. But for users who currently have a prerelease version installed it will run extra version checks.

if current_version < latest_stable_version:
    display update message

if current_version is a prerelease version:
    get latest release versions

    if current_version < latest_prerelease_version_with_same_major:
        display update message

    if current_version_major < maximum_prerelease_major:
        display information about a new version being developed

For example (with made up version numbers):

Example A - stable user:
Current Version : 6.0.2
There is a newer version of CircuitPython available: 6.1.0

Example B - testing user:
Current Version : 6.0.1-beta.2
There is a newer version of CircuitPython available: 6.1.0
There is a newer prerelease version of CircuitPython available: 6.2.0-rc.4
There is a future version of CircuitPython being developed: 7.0.0-alpha.2

from circup.

lesamouraipourpre avatar lesamouraipourpre commented on August 27, 2024

As an aside, version 6 is currently hard-coded into the script:

def get_bundle(tag):
    urls = {
        "py": (
            "https://github.com/adafruit/Adafruit_CircuitPython_Bundle"
            "/releases/download"
            "/{tag}/adafruit-circuitpython-bundle-py-{tag}.zip".format(tag=tag)
        ),
        "6mpy": (
            "https://github.com/adafruit/Adafruit_CircuitPython_Bundle/"
            "releases/download"
            "/{tag}/adafruit-circuitpython-bundle-6.x-mpy-{tag}.zip".format(tag=tag)
        ),
    }

Is this an intentional behaviour that is planned for in the transition to CP7? Or should I raise an issue about it?

from circup.

askpatrickw avatar askpatrickw commented on August 27, 2024

It used to have both 5 and 6 listed so I think you're correct it is intentional and where one could add 7 and the community bundle.

If there's a better way I know everyone appreciates PRs. :)

from circup.

makermelissa avatar makermelissa commented on August 27, 2024

Oh, by the way, there is now a JSON file attached to the Bundle releases that includes all the libraries, versions, and dependencies (as well as paths in the bundle itself). I'm working on an API that will allow you to query all this information as well to facilitate plugin development and make things easier that makes use of the JSON file.

from circup.

lesamouraipourpre avatar lesamouraipourpre commented on August 27, 2024

I'm closing this as the upcoming work to be done on moving to JSON dependency management should hopefully cover most cases.

from circup.

Related Issues (20)

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.