Skip to content
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

Adding maths symbols #27

Closed
wants to merge 1 commit into from
Closed

Conversation

chmduquesne
Copy link
Contributor

Fix #26

@chmduquesne
Copy link
Contributor Author

I also wrote another version of extract_emojis.py which pulls the emoji list from https://unicode.org/Public/emoji/12.0/emoji-data.txt. The added benefit is that it is lighter than https://unicode.org/emoji/charts-12.0/full-emoji-list.html and you do not need BeautifulSoup for parsing.

The names of the unicode characters are pulled from https://unicode.org/Public/UNIDATA/UnicodeData.txt. That seems to be what the core module unicodedata does as well (see https://github.com/python/cpython/blob/master/Modules/unicodedata_db.h and https://github.com/python/cpython/blob/master/Tools/unicode/makeunicodedata.py#L48). The official documentation https://www.unicode.org/reports/tr44/ seems to indicate that this is the right thing to do (I was too lazy to read it entirely, but I believe this is the case).

You may want to check it out! https://github.com/chmduquesne/rofimoji/tree/no_html

@chmduquesne
Copy link
Contributor Author

Hey there, I very much enjoy getting feedback about this :-)

@fdw
Copy link
Owner

fdw commented Oct 16, 2019

I haven't forgotten you, @chmduquesne, I've just been busy 😉
Unfortunately, that won't change in the next days. I hope I can have a longer look at it on the weekend. Sorry to keep you waiting!

@fdw
Copy link
Owner

fdw commented Oct 19, 2019

First off, thanks for the addition. And the code looks good, too 👍

The only thing I'm not sure about is whether it should be part of the "default" emoji list or if it should be a separate file - my gut instinct tells me that as a user I'd only want either-or and never both mixed. Therefore, for now I'd prefer both the list and the extraction to be separate files... but I'm open to a discussion.

Maybe the -f parameter could be extended to add (not replace) the character list, or maybe the emoji list should be its own file. (@polyzen, do you know how separate files for the character lists work for packaging?).

Also, separate character sets would be an interesting thing in combination with modes (#24) where you could have a combi mode with all of them. If that is the way to go, separate files would be the right choice.

In any case, thank you very much for the work! 😊

@polyzen
Copy link
Contributor

polyzen commented Oct 24, 2019

Maybe the -f parameter could be extended to add (not replace) the character list, or maybe the emoji list should be its own file.

👍 I do see myself using both lists together, but as you said, people may in general prefer either-or.

(@polyzen, do you know how separate files for the character lists work for packaging?).

I do not, but it shouldn't be a hassle. You may want to use a setup.py.

@chmduquesne
Copy link
Contributor Author

I tend to use rofimoji as a replacement for my compose key, so I tend to want both lists together. I can separate them if needed. Do you prefer that?

@fdw
Copy link
Owner

fdw commented Oct 27, 2019

My perfect solution would be that people could choose which symbols they want. Ideally, via rofi modes where you can also have a combi mode for all of them, or via cli parameters.

However, right now modes do not work and require quite a bit of effort to implement. So I think a good solution would be to separate the maths symbols in a file and let the user "activate" them via a cli switch; -f only shows the symbols from the file, but maybe we can introduce another one that will still show emojis and the ones from the given file(s).

I also thought about moving the emojis out to their file, but they use a special logic that is hardcoded into rofimoji, so that wouldn't make sense, I think.

@fdw
Copy link
Owner

fdw commented Dec 30, 2019

I have something new on the feature/modules branch, where rofimoji reads from several data files automatically.

Would you please take a look and see if that would work for you, @chmduquesne? If so, can you rebase this branch onto it? If not, let me know and we can find a solution 🙂

@polyzen I also added a setup.py on that branch. Can you see if that works for you, too?

@polyzen
Copy link
Contributor

polyzen commented Feb 1, 2020

Is there a shorthand to use all files? Would that be too slow?

With the single file in 3.0.1, the rofimoji window pops up almost immediately after running it from rofi. 4.0.0-rc1 with the entry_points patch takes about a second to launch. 🙁 Edit: With just the emoji list, no options specified.

@polyzen
Copy link
Contributor

polyzen commented Feb 1, 2020

Side note: I normally find setup.py at the top-level, unless it's some sort of monolithic project.

This seems like a good resource: https://github.com/navdeep-G/setup.py

@fdw
Copy link
Owner

fdw commented Feb 2, 2020

Is there a shorthand to use all files? Would that be too slow?

I had not thought anyone would want all the files, but I think it can be done.

With the single file in 3.0.1, the rofimoji window pops up almost immediately after running it from rofi. 4.0.0-rc1 with the entry_points patch takes about a second to launch. slightly_frowning_face Edit: With just the emoji list, no options specified.

That's less than ideal 🙁 Do you know whether it is the entry_points patch or reading the emojis.csv file?

Side note: I normally find setup.py at the top-level, unless it's some sort of monolithic project.

Okay, can do 🙂

This seems like a good resource: https://github.com/navdeep-G/setup.py

Thank you, Google only finds very simple tutorials...
Edit: That one has no data files either 😐 I'd like to know if there is something better than entry_points:console_scripts.

fdw added a commit that referenced this pull request Feb 2, 2020
This shows all configured unicode characters. That is an actual lot.

Issue: #27
fdw added a commit that referenced this pull request Feb 2, 2020
fdw added a commit that referenced this pull request Feb 2, 2020
This shows all configured unicode characters. That is an actual lot.

Issue: #27
@polyzen
Copy link
Contributor

polyzen commented Feb 3, 2020

Is there a shorthand to use all files? Would that be too slow?

I had not thought anyone would want all the files, but I think it can be done.

After looking things over, that is indeed quite a lot.. I also had not realized or forgot the math symbols were separate 😅. Don't foresee myself using anything but [emojis, latin, math].

With the single file in 3.0.1, the rofimoji window pops up almost immediately after running it from rofi. 4.0.0-rc1 with the entry_points patch takes about a second to launch. slightly_frowning_face Edit: With just the emoji list, no options specified.

That's less than ideal slightly_frowning_face Do you know whether it is the entry_points patch or reading the emojis.csv file?

Will try to look into this. My first assumption is simply because it's reading from multiple files and not just running off of one.

Side note: I normally find setup.py at the top-level, unless it's some sort of monolithic project.

Okay, can do slightly_smiling_face

This seems like a good resource: https://github.com/navdeep-G/setup.py

Thank you, Google only finds very simple tutorials...
Edit: That one has no data files either neutral_face I'd like to know if there is something better than entry_points:console_scripts.

@polyzen
Copy link
Contributor

polyzen commented Feb 8, 2020

With the single file in 3.0.1, the rofimoji window pops up almost immediately after running it from rofi. 4.0.0-rc1 with the entry_points patch takes about a second to launch. slightly_frowning_face Edit: With just the emoji list, no options specified.

That's less than ideal slightly_frowning_face Do you know whether it is the entry_points patch or reading the emojis.csv file?

Will try to look into this. My first assumption is simply because it's reading from multiple files and not just running off of one.

This seems like a good resource: https://github.com/navdeep-G/setup.py

Thank you, Google only finds very simple tutorials...
Edit: That one has no data files either neutral_face I'd like to know if there is something better than entry_points:console_scripts.

https://github.com/ninjaaron/fast-entry_points
pypa/setuptools#510

@fdw
Copy link
Owner

fdw commented Feb 9, 2020

Wow, thank you! 🙂

So, from what I've read, we can either use fast-entry_points or build a wheel. I think I'd prefer the latter, as it's quite an easy fix and we could distribute it via GitHub. Would a wheel also work for the packaging?

@polyzen
Copy link
Contributor

polyzen commented Feb 10, 2020

Wheels do work and rofimoji launches quickly again. 🎉

@fdw
Copy link
Owner

fdw commented Feb 21, 2020

Hi @chmduquesne , sorry for hijacking this PR 😉

I would still love to have maths symbols in rofimoji. Are you still interested in updating this PR? If not, I would try to adapt it for the latest version.

@chmduquesne
Copy link
Contributor Author

chmduquesne commented Feb 21, 2020 via email

@fdw
Copy link
Owner

fdw commented Mar 6, 2020

I added this with e366d09. Hope you're okay that I added you as a co-author, @chmduquesne 🙂

@polyzen
Copy link
Contributor

polyzen commented Feb 10, 2021

@fdw, wheels are no longer needed for quick start-up time with setuptools >= 47.2.0 and Python >= 3.8 🎉:
pypa/setuptools#2194

@fdw
Copy link
Owner

fdw commented Feb 10, 2021

Cool, thanks!

Do you think we should move to something else than wheels, even though they seem to work well enough?

@polyzen
Copy link
Contributor

polyzen commented Feb 12, 2021

There is "a new style of source tree based around the pyproject.toml":
https://www.python.org/dev/peps/pep-0517/
https://python-poetry.org/docs/pyproject/
https://github.com/pypa/build

I'm not sure if it's worth still providing wheels for rofimoji: https://pythonwheels.com/

@fdw
Copy link
Owner

fdw commented Apr 9, 2021

Took some time, but now it's done. Thank you, again :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding maths symbols
3 participants