I am a cyber security researcher and programmer.
Do you want to be one too? Check out my advice for learning hacking and programming.
You can support my work with a few bucks, here.
Print awesomely in terminals.
License: GNU General Public License v3.0
I am a cyber security researcher and programmer.
Do you want to be one too? Check out my advice for learning hacking and programming.
You can support my work with a few bucks, here.
E.G: colorama.
It will help choosing between libs.
Clean install via pip, imports just fine, but none of the options work, all produce the same error.
example:
➜ ~ python
Python 3.7.2 (default, Jan 10 2019, 23:51:51)
[GCC 8.2.1 20181127] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from huepy import *
>>> print red('This string is red')
File "<stdin>", line 1
print red('This string is red')
^
SyntaxError: invalid syntax
>>> print ("regular print test")
regular print test
>>>
The first thing i tried was putting a colored string inside another colored string to see if they play nice with each other, and they didn't 😢
This exact problem is also an issue with kennethreitz/crayons. This the issue [0] (i copied issue title) and this is the solution [1] *
0: https://github.com/kennethreitz/crayons/issues/9
1: https://github.com/kennethreitz/crayons/pull/13
Windows users can use colorama to convert from ansi.
import huepy
import colorama
colorama.init()
Not sure how to get the colors bright though. Not sure if that has to be done in colorama or hue.
This project is currently under CC BY 4.0 according to the README, which is not a license considered suitable for software works (it's intended to be applied to non-software works such as documentation).
I would advise switching to the MIT license or similar, see Choose a License for more information.
First of all, thank you for this package. It works great.
Because Python stops supporting Python2.7 on January 1, 2020, it seems logical to port hue
to Python3. Do you want me to do this and create a PR? It doesn't seems like it's much work, but happy to help.
Have a nice day,
@yochem
When attempting to install huepy v1.1 using pip, I see the following error:
Installing collected packages: huepy
Running setup.py install for huepy ... error
ERROR: Command errored out with exit status 1:
command: /home/pi/.pyenv/versions/3.7.5/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ohrb0trx/huepy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ohrb0trx/huepy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ng40dn_2/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-ohrb0trx/huepy/
Complete output (28 lines):
running install
running build
running build_py
file huepy.py (for module huepy) not found
creating build
creating build/lib
creating build/lib/huepy
copying huepy/huepy.py -> build/lib/huepy
copying huepy/test.py -> build/lib/huepy
copying huepy/__init__.py -> build/lib/huepy
running egg_info
writing huepy.egg-info/PKG-INFO
writing dependency_links to huepy.egg-info/dependency_links.txt
writing top-level names to huepy.egg-info/top_level.txt
file huepy.py (for module huepy) not found
reading manifest file 'huepy.egg-info/SOURCES.txt'
writing manifest file 'huepy.egg-info/SOURCES.txt'
file huepy.py (for module huepy) not found
running install_lib
creating /home/pi/.pyenv/versions/3.7.5/lib/python3.7/site-packages/huepy
copying build/lib/huepy/huepy.py -> /home/pi/.pyenv/versions/3.7.5/lib/python3.7/site-packages/huepy
copying build/lib/huepy/test.py -> /home/pi/.pyenv/versions/3.7.5/lib/python3.7/site-packages/huepy
copying build/lib/huepy/__init__.py -> /home/pi/.pyenv/versions/3.7.5/lib/python3.7/site-packages/huepy
byte-compiling /home/pi/.pyenv/versions/3.7.5/lib/python3.7/site-packages/huepy/huepy.py to huepy.cpython-37.pyc
byte-compiling /home/pi/.pyenv/versions/3.7.5/lib/python3.7/site-packages/huepy/test.py to test.cpython-37.pyc
byte-compiling /home/pi/.pyenv/versions/3.7.5/lib/python3.7/site-packages/huepy/__init__.py to __init__.cpython-37.pyc
running install_data
error: can't copy 'LICENSE': doesn't exist or not a regular file
huepy 1.0 installs fine. This is using Python 3.7.
hello there, this is amazing! I was looking for something like this.
There is a problem with the functions, the black and lightred are duplicated. Both lightred are the same, you just have to delete one, but the two black functions have different values.
I hope this helps.
Hi,
When using huepy with python2 I face a problem when the string to be printed includes non-ascii characters.
Python3 works fine though.
Here is a minimal working example that demonstrates this behavior.
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from huepy import *
def main():
pizza = 'John’s Pizza'
print('Pizza: |' + green(pizza) + '|' )
if __name__ == '__main__':
main()
Python3 execution:
❯ python3 huepy_unicode_test.py
Pizza: |John’s Pizza|
Python2 execution:
❯ python2 huepy_unicode_test.py
Traceback (most recent call last):
File "huepy_unicode_test.py", line 10, in <module>
main()
File "huepy_unicode_test.py", line 7, in main
print('Pizza: |' + green(pizza) + '|' )
File "/usr/local/lib/python2.7/dist-packages/huepy/__init__.py", line 53, in <lambda>
locals()[key] = lambda s, prefix=prefix, key=value: _gen(s, prefix, key)
File "/usr/local/lib/python2.7/dist-packages/huepy/__init__.py", line 47, in _gen
return '\033[{}m{}\033[0m{}'.format(key, colored, not_colored)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 4: ordinal not in range(128)
it does not install code just metadata
Like ora
(npm package) use unichar and threading supported text for success, fail, info etc prints
len("Hello World!")
returns 12. This is expected.
len(huepy.red("Hello World!"))
returns 21. This is not expected.
(Is there something I'm missing out on here?)
Came across this today, looks great!
I think it could be helpful if there was a way for users to add their own labels, colors, and styles in addition to the preset values.
The readme is kind of inconsistent:
the last bit of code in it is
from hue import *
which yields an error for me in Python 3.6
the above mentioned
from huepy import *
works. The difference between the both should be explained somewhere
It is very simple, which is a strength. I would suggest only to add ...
to info,que etc to have more like logger output
[+]... text
During the day my terminal is in the tomorrow-light theme. This results in print(run(...))
not really rendering the prefix because it uses the same white color as the background. Can run
be changed to either use the foreground/text color (most people probably use something similar to a white on black or black on white terminal) or the grey color?
Hi, this is awesome but i'm having some issues with light colors and styles, it's like they don't do anything at all. (Under and itallic work correctly)
I use python 3.7 in Windows 10
also, when I write anything from huepy it says: 'red' may be undefined, or defined from star
imports: huepy
but still works.
it will not work on windows
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.