Add python CLI utility to get near countries codes.#370
Add python CLI utility to get near countries codes.#370Nyanraltotlapun wants to merge 12 commits intoendeavouros-team:masterfrom
Conversation
…r ability to select near countries aoutomatically.
|
Ok so, now I added all other bits. |
|
This loop does not do what your help text says ? you already populate direct neighbors before the loop:
So DE ends up in its own output. anbd yea.. case sensitive? If the user runs:
There is no recursion here (it’s iterative)? also not coding but: Some entries are politically or geographically debatable: |
|
Ok. So, I add line to remove input country from output. And made input case insensitive. |
Yes. So rec depth starts from 1. And in this case, loop will not execute. I can refactor this a bit. |
Its recursion mapped into loop :) |
It can be, its data automatically parsed from db that automatically parsed from geodata source. |
I refactored code a little so it looks more clean, hopefully. |
|
Can you better explain the point of getting nearby countries? Geographic proximity is not a very good indicator of network proximity or performance so I am not sure why it would be beneficial to pull in countries nearby. |
Not very good, but some kind of indicator. So making this behavior as default, as I see it, removes necessity for many users to make additional tweaking, so basically better defaults. But I probably need to mention that it works better when default ranking parameter is "rate" and not "age". |
|
I understand the idea of needing to check to more countries. However, it is rare that geographically close countries are actually the fastest in that scenario. The network connections don't work that way in most cases. If you want to search by proximity, it is better to explore network proximity like rate-mirrors does. |
Not necessary fastest - but candidates for determining the fastest. Reflector searching for the fastest, and we only provide him with reasonable list of candidates to search. I am also pretty sure that there is positive correlation between geographical closeness and internet connection quality - on average it is better the closest points are. If you think it is unreasonable assumption, I will search for some data on this regard. |
|
My point is that network proximity is a better indicator. Since that data exists, why wouldn't we use that? Also, at least for the US, I can pretty much guarantee that Canada and Mexico will not make sense. I use two different ISPs and I have never seen a Canadian or Mexican mirror. The connectivity to Europe is better. I often get European mirrors in my top 10 even though there are many mirrors in the US. From where I am, I have better connectivity to another continent separated by an ocean than I do to parts of my own country. |
Can you point this data to me? |
|
I would take a look at rate-mirrors to see how he is storing the data. That being said, I think we should step and think about what we are trying to accomplish. At least to me, the primary purpose of selecting a list of countries in reflector-simple is because you want to limit your results to only those countries. If you don't care about that, why select a country at all? |
Ok. Ill look to it a bit later. But this also can rise a question - why not just use it all together instead?
Yes. But not limit too much, just enough.
Because rating large number of mirrors is time consuming, and also creates unnecessary network load. But from user perspective mostly time consuming. It seems to me, that a better way will be to form list on network(hops) distance, then select n freshest from it, and rate them by download speed. But this also leaves question of countries choice limiting and it default behavior. Most people, will not want to limit servers to their country by default in the case of algorithm above. So default need to be different ether way. |
|
Personal i do always use rate-mirrors on the installer livesession. But reflector-simple is very helpful for users having issues in areas like india with no good mirrors in the country at all. And it is almost everytime helping them to add nearby countries but also Geman and US mirrors as fallback .. In the end it is always true that one good working mirror would be all needed to get OS installed properly. Its not mainly nearby countries that will provide the best connections its about the infrastructure, the knots and the quality of lines too. Reflector itself is somehow based on Countries? so is reflector-simple may not the very best tool compared to what we have today for arch mirror selection tools. But a valid and logical easy to use and understand option for a lot of users. And yea users.. . its the first in the welcome app and because of that people using it. we could put rate-mirrors first. And on the india example it is an issue to only have india in the preselection by default it should always add some other country as fallback. |
We offer both reflector-simple and rate-mirrors in the welcome app so people can choose which they prefer. That being said, before you spend too much more time on this, I think we should get some input from @manuel-192 as well. He is the maintainer of Also, in case we haven't mentioned it yet, we do appreciate people wanting to jump in and contribute so thank you for that. |
100% @Nyanraltotlapun very welcome ! And for sure it will need @manuel-192 to decide if he want to merge this or not.. i do only commented here. |
|
Because you probably don't have |
Yes. I am very default man 😅 |
|
@Nyanraltotlapun The idea of using neighbor countries might work in some cases but not all. That's why I think this near-countries idea is not something we can use for reflector-simple. Of course you are free to, for example, create a package and publish it in the AUR. Then users can decide if it suits their needs. Thanks for the interest anyway! |
Can you give me permission to distribute your original code with my changes under GPL v3.0 license? |
But this selection wont last to next app launch... |

Add python CLI utility to get near countries codes. As preparation for ability to select near countries automatically.
This is only "get_near_countries.py" file addition. No changes to reflector-simple itself.