TechWiz-3 / who-unfollowed-me

😡 Python CLI tool that shows you who has unfollowed you on GitHub. PRs welcome!
GNU General Public License v3.0
11 stars 24 forks source link

Create no-color version #5

Closed TechWiz-3 closed 2 years ago

TechWiz-3 commented 2 years ago

Create a no-color, no-emoji version called "simple". It will be dealt with similarly to bubbles and panels.

All files will be relevant in this issue although I would start with cli.py.

Code should be pretty self explanatory after looking at it tho 👍. Any questions please go ahead and ask 🙏

LunarMarathon commented 2 years ago

Hi, can I work on this?

And how to run it? I read the readme file but didn't find any command to run it.

TechWiz-3 commented 2 years ago

Sure, you can run the file src/unfollow/cli.py manually when developing.

For actual personal use, pip install unfollow, unfollow

TechWiz-3 commented 2 years ago

Any updates @LunarMarathon ?

LunarMarathon commented 2 years ago

@TechWiz-3 Hey, I am getting this - 'unfollow' is not a package when I run cli.py. (I already installed it via pip) image I changed this - #!/usr/bin/env python3 to my path since I'm using windows but I'm not sure what's wrong and how to test. You can assign it to someone else, sorry

TechWiz-3 commented 2 years ago

The issue is to do with the imports because of the way the project and setup.py are structured. See #9 for more info.

What you can do is in cli.py and unfollow.py replace any imports that start with from unfollow to from src.unfollow and do the same with the unfollow script in the root dir. Then it will work.

Sorry about that, please let me know what happens

LunarMarathon commented 2 years ago

Thank you, I'll try that and send a PR today or tomorrow!

TechWiz-3 commented 2 years ago

Hey Lunar, I've fixed the development issues, please check the new development instructions in the README.md out.

Thanks a lot for your patience 🙏

LunarMarathon commented 2 years ago

Ok, I'll check it

LunarMarathon commented 2 years ago

@TechWiz-3 image image

There's a typo in the files but I checked after changing all the apperance's to appearance and without changing too, both gave Key error

TechWiz-3 commented 2 years ago

Can you check ~/.unfollow/unfollow.toml and tell me if it has contents or it's just an empty file?

LunarMarathon commented 2 years ago

There's no file called unfollow.toml but there's pyptoject.toml image

TechWiz-3 commented 2 years ago

I mean in your home directory you should have a .unfollow directory?

TechWiz-3 commented 2 years ago

It's a hidden directory

LunarMarathon commented 2 years ago

Found it, yeah it's empty

TechWiz-3 commented 2 years ago

Ah ok, delete the file unfollow.toml and re-run poetry run unfollow

LunarMarathon commented 2 years ago

image I'm getting this now. Is it working fine on your end? Maybe I have to add encoding="utf-8" somewhere

TechWiz-3 commented 2 years ago

I was getting this yesterday but i solved the issue, have you pulled the latest version?

LunarMarathon commented 2 years ago

Yes, I synced the fork and cloned to a new folder today

TechWiz-3 commented 2 years ago
  1. Are you on your main branch or your simple-mode branch
  2. Can you post what config.py says in the big default_config = """ - the issue is most likely there
  3. Everytime you retest, make sure to delete the old ~/.unfollow/unfollow.toml so new one is copied over Sorry you've been going through all this trouble man 😅 appreciate your perseverance ❤️
LunarMarathon commented 2 years ago
  1. cloned and created a new branch image but I'm not sure why the branch isn't visible on the repo. Not sure if it appears only* after I push something.
  2. Have pasted it here -> https://pastebin.com/WHZ6vyPD
  3. Ok, I'll do that

I'm almost losing it lol

TechWiz-3 commented 2 years ago

but I'm not sure why the branch isn't visible on the repo. Not sure if it appears only* after I push something.

yes when you do git push --upstream origin <branchname>

TechWiz-3 commented 2 years ago

Hmmm this is definetly the new version.

TechWiz-3 commented 2 years ago

Ohhh i think i know why, command prompt can't render some characters in the same way other terminals can. How about you use vscode's terminal or download microsoft terminal and use the command prompt option from there, hopefully will work that way

LunarMarathon commented 2 years ago

image It was the same in VS code (I was using microsoft terminal itself in the previous screenshot) but after adding encoding here - image it's working!

LunarMarathon commented 2 years ago

Last time you had suggested that I remove the colors when the user is asked to enter their Github username when unfollow is used for the first time. That part is there in this piece of code in the input file (img1)

image

Now this function is called in unfollow file (img2)

image

Nothing is passed to this function get_input_username and from img1 you can see that the default values for panels, bubbles and simple have been set to false. So whatever the theme, the color for "please enter your gh username" is always magenta. Now I need to add a separate if block for simple case with the same code without :label:, [magenta] and [red] in user invalid line. It'll look like the changes made to input file here - https://github.com/LunarMarathon/who-unfollowed-me/commit/41c67272f59042479605b64099b3c1efd55f5b94#diff-930a3e5ae0a392ab5a43f0a0e69722721cf2de947af72a1e2a53b0c9cb7a799c

Then if you see the changes in the unfollow.py file (https://github.com/LunarMarathon/who-unfollowed-me/commit/41c67272f59042479605b64099b3c1efd55f5b94#diff-fc47bb8c100fa4f81b4ae5600bf982cc60e62707be9327f19309330bc216f2a1) you'll see that I have to pass simple as true and for that I need the variable simple which is actually defined in the cli.py file. So, I had to import that from cli to unfollow.py.

When I do I get this error -

    from unfollow.cli import simple
ImportError: cannot import name 'simple' from partially initialized module 'unfollow.cli' (most likely due to a circular import) (E:\gh\hf2\who-unfollowed-me\unfollow\cli.py)

The issue is that, everything starts at cli.py file (or I guess it's setup-> then cli) and cli has an import - from unfollow.unfollow import main as unfollow_main

And then again unfollow.py would have from unfollow.cli import simple So from what I've understood this is how the circular import is caused and throws import error. So what can be done about that? Either we can ignore the colored lines when the user first gives their username or some of the functions and variables should be shifted to other existing files such that circular import does that happen but that seems difficult since cli, unfollow and config are somewhat linked(imports made from one another) or else what can be done?

TechWiz-3 commented 2 years ago

I'm not exactly sure why you're trying to import the variable simple tho?

Ahhh i see

Nothing is passed to this function get_input_username and from img1 you can see that the default values for panels, bubbles and simple have been set to false. So whatever the theme, the color for "please enter your gh username" is always magenta. Now I need to add a separate if block for simple case with the same code without 🏷️, [magenta] and [red] in user invalid line. It'll look like the changes made to input file here

Currently we haven't added theme support for that prompt, it's not at all in the code. Don't worry about it for now, just all the other text in cli.py. I'll add support for it soon 🙏

LunarMarathon commented 2 years ago

Ok, I'll do that and send a PR