hugovk / em-keyboard Goto Github PK
View Code? Open in Web Editor NEWThe CLI emoji keyboard
License: ISC License
The CLI emoji keyboard
License: ISC License
Or keywords for an emoji should include each word in the name separately?
For example, search results for family:
$ em -s family
๐ช family
It doesn't return other family ZWJ sequences, such as this in emojis.json:
"family_man_woman_girl": {
"keywords": ["home", "parents", "people", "human", "child"],
"char": "๐จโ๐ฉโ๐ง",
"category": "people"
},
OS: OS X 10.11.5
Python: Python 3.5.1 (default, Jun 6 2016, 15:12:24)
when I typed em -s red
:
Traceback (most recent call last):
File "/usr/local/bin/em", line 11, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.5/site-packages/em/__init__.py", line 119, in cli
found = do_find(lookup, names[0])
File "/usr/local/lib/python3.5/site-packages/em/__init__.py", line 73, in do_find
for name, definition in lookup.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'
QAQ Any suggestion about the error?
em uses xerox, which may have dependencies depending on your system (for example, adityarathod/xerox#28)
I think autocomplete would make this a pretty awesome little package, with functionality similar to GitHub's neat emoji complete feature that pops up when you type a colon โจ. I'd be willing to do the implementation and open a PR, but it looks to me like the best way to do it would be to use argcomplete, which would require using argparse
rather than docopt
. How do you feel about sacrificing the readability of the docopt style of argument specification for the convenience of tab completion?
Hi @hugovk ,
Just wanted to say thanks for this plugin!
I'm using it via python in my Albert emoji plugin and it's really great! :)
Python 3.10 final was released this month:
That means we can switch testing from 3.10-dev
to 3.10
on the CI.
Edit the CI config file to switch, but note this:
And put quotes around all the Python versions.
I only opened this issue to keep this as a record here in case anyone needs it.
I am using em-keyboard to copy emojis to the clipboard on windows.
I don't care if they are not displayed correctly in the command prompt, as I am using it from inside a python script using os.system
I was getting an error due to the json file being read without any encoding provided, so I added encoding = 'utf-8'
in this line:
json.load(open(filename, encoding='utf-8'))
It is working well now. I can paste the emojis to a text field (I'm using selenium to automate a website operation)
Hello,
Would you accept a PR that replaces __file__
with importlib.resources
(either the stdlib or PyPI package)?
I ask because I'd like to package this library, and that bit in particular is causing troubles with making a self-contained package.
Cheers
On Cygwin, looks like a formatting problem:
Annie@soraya /c/Users/Annie/Documents/git/em
$ em family
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\em\__init__.py", line 148, in cli
print(u'Copied! {}'.format(print_results))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 8-9: ordinal not in range(128)
Annie@soraya /c/Users/Annie/Documents/git/em
$ em -s family
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\em\__init__.py", line 125, in cli
print(u'{} {}'.format(' '.join(v), n))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
On Windows cmd.exe, looks like the default code page is wrong:
C:\Users\Annie>em -s family
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\em\__init__.py", line 125, in cli
print(u'{} {}'.format(' '.join(v), n))
File "c:\python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-1: cha
racter maps to <undefined>
C:\Users\Annie>em family
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\em.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\em\__init__.py", line 148, in cli
print(u'Copied! {}'.format(print_results))
File "c:\python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 8-9: cha
racter maps to <undefined>
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.
.github/workflows/deploy.yml
actions/checkout v4
hynek/build-and-inspect-python-package v2
actions/download-artifact v4
actions/download-artifact v4
.github/workflows/labels.yml
actions/checkout v4
micnncim/action-label-syncer v1
.github/workflows/lint.yml
actions/checkout v4
actions/setup-python v5
pre-commit/action v3.0.1
.github/workflows/release-drafter.yml
release-drafter/release-drafter v6
.github/workflows/require-pr-label.yml
mheap/github-action-required-labels v5
.github/workflows/test.yml
actions/checkout v4
actions/setup-python v5
codecov/codecov-action v3.1.5
pyproject.toml
The search feature is very slow for me (on a nice laptop). Maybe drop the wildcard support for speed, if you think that's a good idea. I know I do not filter emojis by patterns of their names, it may not be an essential feature.
Hi @timofurrer, would you be able to give me the "Owner" role for em-keyboard on PyPI?
I just made a broken release (2.3.0) and whilst I quickly put out a fixed version (2.3.1 via #65), it'd be good if I could "yank" the broken one to prevent anyone ending up with the broken one.
Thanks!
Emoji whose canonical names contain spaces do not appear when queried directly, or when searched for with their exact names:
$ em -s disguised
๐ฅธ disguised face
$ em -s hugging
๐ค hugging_face
๐ซ people hugging
$ em -s transgender
๐ณ๏ธโ๐ rainbow_flag
โง๏ธ transgender symbol
๐ณ๏ธโโง๏ธ transgender flag
$ em 'disguised face'
[1]
$ em 'people hugging'
[1]
$ em 'transgender flag'
[1]
$ em -s 'disguised face'
# no output
$ em -s 'people hugging'
# no output
$ em -s 'transgender flag'
# no output
This seems to be because em
currently replaces any spaces, periods, or hyphens in the query text with underscores:
Lines 73 to 76 in c1c9afc
yet has emoji in its dictionary whose canonical names contain spaces:
em-keyboard/em/emoji-en-US.json
Lines 11885 to 11891 in c1c9afc
making them impossible to reference directly.
I believe the most straightforward options here are:
Of the two, I believe the first option is preferable, as the second would be a departure from the existing behavior of the interface.
Using pyvenv
:
$ pyvenv-3.5 install em-keyboard
$ em
Traceback (most recent call last):
File "/opt/pyvenv/em-keyboard/bin/em", line 9, in <module>
load_entry_point('em-keyboard==0.0.4', 'console_scripts', 'em')()
File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 547, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 2720, in load_entry_point
return ep.load()
File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 2380, in load
return self.resolve()
File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 2386, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/opt/pyvenv/em-keyboard/lib64/python3.5/site-packages/em/__init__.py", line 117
print u'{} {}'.format(' '.join(v), n)
^
SyntaxError: invalid syntax
Python version:
Python 3.5.1 (default, Jul 10 2016, 20:36:01)
[GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux
At the moment running setup.py
fails on a fresh git checkout because HISTORY.rst
doesn't exist. here:
long_description=read('README.rst') + '\n\n' + read('HISTORY.rst'),
Creating an empty HISTORY.rst
file should fix this.
There is a ๐ emoji:
em -s hand
๐ middle_finger
โ๏ธ point_up
๐ช muscle
๐ facepunch
๐ point_down
โ hand
๐ +1
๐ค sign_of_horns
๐ -1
But there doesn't seem to be a way of getting em
to print it out (apart from searching for it)
$ em '-1'
Usage:
em <name>... [--no-copy]
em -s <name>...
$ em "'-1'"
$ em _1
$ em - -1
Usage:
em <name>... [--no-copy]
em -s <name>...
Looking at the cli code, it looks like it's a combination of arguments that begin with '-' being parsed as flags, and also the fact that '-' is translated to '_' when doing lookup.
Just something to be aware of. The next version of iTerm2 will support Unicode 9.0, which makes emoji doublewidth (meaning you don't have to insert spaces between them to make them look good in the Terminal). It already works in the nightly. It has a special escape code you can print https://gitlab.com/gnachman/iterm2/wikis/unicodeversionswitching to enable it. There's also some way to detect if you are in iTerm2 (I don't remember what it is; I think it's another escape sequence).
xerox hasn't had a release in 5 years, and we're using pyperclip for Windows.
When I try to get an emoji, or perform a search, I get an error saying emojis.json
not found.
elssar@r2d2:~/work/src$ em -s food
Traceback (most recent call last):
File "/usr/local/bin/em", line 9, in <module>
load_entry_point('em-keyboard==0.0.3', 'console_scripts', 'em')()
File "/usr/local/lib/python2.7/dist-packages/em.py", line 105, in cli
lookup = parse_emojis()
File "/usr/local/lib/python2.7/dist-packages/em.py", line 41, in parse_emojis
return json.load(open(filename))
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/emojis.json'
elssar@r2d2:~/work/src$ em heart
Traceback (most recent call last):
File "/usr/local/bin/em", line 9, in <module>
load_entry_point('em-keyboard==0.0.3', 'console_scripts', 'em')()
File "/usr/local/lib/python2.7/dist-packages/em.py", line 105, in cli
lookup = parse_emojis()
File "/usr/local/lib/python2.7/dist-packages/em.py", line 41, in parse_emojis
return json.load(open(filename))
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/emojis.json'
Help works fine though.
I'm using Python 2.7.3, pip 1.5.6 on Ubuntu 12.04 (old, I know)
I think a -v would be useful, unless it clutters the help page (it looks nice and minimalistic right now).
Installing this on Windows, it doesn't include by default the dependency needed (xerox) to support the clipboard. To make this worse, xerox has broken dependencies, as it requires pywin32 on Windows, but doesn't declare that dependency.
Ideally, I'd like it if this project depended on pyperclip, which is a 0-dependencies clipboard solution on Windows.
Would a PR to:
be welcome? I have a PR prepared that implements that, if it would be useful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.