Proposal for new module `suntime`

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
User avatar
lorcap
Posts: 10
Joined: Sat May 23, 2020 9:02 am
Location: Italy

Proposal for new module `suntime`

Post by lorcap » Mon Sep 27, 2021 7:23 pm

I just push two pull request for a new module (#450) and its documentation (7866). `suntime` provides an approximated calculation of sunrise and sunset time. Adapted from SatAgro's suntime.

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: Proposal for new module `suntime`

Post by scruss » Mon Sep 27, 2021 9:12 pm

This is neat, but it's LGPL, so your version would have to be too.

It also looks like there are some serious unresolved issues with the original which may not be welcome in a MicroPython library

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Proposal for new module `suntime`

Post by pythoncoder » Tue Sep 28, 2021 6:26 am

The official micropython-lib implements libraries which are typically "micro" versions of equivalent CPython libraries. If users want to contribute libraries which have no CPython equivalent, these need to be maintained as independent projects typically with the source on GitHub and optionally on PyPi. You'll find numerous examples of these listed in the Wiki.

I don't believe that the maintainers will accept this on the above grounds. The licensing would also rule it out.
Peter Hinch
Index to my micropython libraries.

User avatar
lorcap
Posts: 10
Joined: Sat May 23, 2020 9:02 am
Location: Italy

Re: Proposal for new module `suntime`

Post by lorcap » Tue Sep 28, 2021 9:24 pm

The pull request was denied because of the license. I understand that. I started from scratch with the formula provided by Wikipedia's Sunrise equation and it works. I'll provide a new clean and neat code under MIT license in the following days.

What I don't understand is why a module as this couldn't be part of micropython-lib. Its current README.md states:
The libraries here fall into four categories corresponding to the four top-level directories:
  • ...
  • python-ecosys: Compatible, but reduced-functionality versions of modules from the larger Python ecosystem, for example that might be found in the Python Package Index.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Proposal for new module `suntime`

Post by pythoncoder » Wed Sep 29, 2021 4:38 am

It's up to the maintainers what to include. I had a discussion with @jimmo on the idea of a "contrib" section for user contributed libraries but it was inconclusive. In general these are offered as I described above.

Yours does seem useful. A similar library for moon rise, set and phase would be good. I did this some years ago for a project in C but so far I haven't got round to porting it to Python.
Peter Hinch
Index to my micropython libraries.

User avatar
lorcap
Posts: 10
Joined: Sat May 23, 2020 9:02 am
Location: Italy

Re: Proposal for new module `suntime`

Post by lorcap » Wed Oct 06, 2021 11:27 am

I just pushed commit 732b15df with the new module implementation. I rebased it on `datetime` branch (see my corresponding thread) because it depends on that.

I'd be glad if some (@pythoncoder) could review the documentation as well, because I'm not a native English speaker.

Post Reply