Skip to content

Commit

Permalink
Add all needed files to release 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMarto committed Feb 22, 2024
1 parent 40bce0c commit bfa7f95
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 18 deletions.
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# eth-logo

[//]: # ([![PyPI version](https://badge.fury.io/py/eth-account.svg)](https://badge.fury.io/py/eth-logo))
[//]: # ([![Python versions](https://img.shields.io/pypi/pyversions/eth-account.svg)](https://pypi.python.org/pypi/eth-logo))
Print Ethereum logo of any size on your stout.

Print Ethereum logo of your selected size on your stout.
## Quickstart
```sh
python3 -m pip install eth-logo
```

### Usage (in terminal)
```python
# Optionals: print-eth SIZE CHAR [defaults: size=20 char='#']
print-eth
print-eth 30 %
```

## Quickstart
### Usage (in python)
```python
from eth_logo import print_eth

```sh
python -m pip install eth-logo
# Optionals: Size, Character, Background, Padding
print_eth(size=20, char='#', back=' ', pad=' ')
```

### Development Environment Setup

### Contribute
You can set up your dev environment with:

```sh
git clone [email protected]:0xMarto/eth-logo.git
cd eth-logo
Expand Down
14 changes: 12 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,15 @@ classifiers =

[options]
python_requires = >=3.6
py_modules =
eth-logo
packages = find:
package_dir =
= src
scripts =
src/eth_logo/eth_logo_script.py

[options.packages.find]
where = src

[options.entry_points]
console_scripts =
print-eth = eth_logo:print_eth_script
2 changes: 2 additions & 0 deletions src/eth_logo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from eth_logo.eth_logo_core import print_eth
from eth_logo.eth_logo_script import print_eth_script
5 changes: 2 additions & 3 deletions eth_logo.py → src/eth_logo/eth_logo_core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Eth Logo is a little library to print an Ethereum logo on sout
#!/usr/bin/python


def print_logo(size=20, char='#', back=' ', pad=' ') -> None:
def print_eth(size=20, char='#', back=' ', pad=' '):
"""
Usage example: print_logo()
Expand Down
15 changes: 9 additions & 6 deletions eth_logo_debug.py → src/eth_logo/eth_logo_debug.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/python
"""
Print next ascii art using only `loop` statements (size: 38x37):
This a development file to test new features with no optimizations.
Focused on readability to test things before migration to `eth_logo_core.py`
Example:
> Size: 20
#
###
Expand All @@ -24,7 +28,7 @@
#
> Printed size: (21, 19)
# TODO Next Version:
# TODO Make printed logo more accurate (losing top/bottom symetry)
# #
# ###
# #####
Expand Down Expand Up @@ -83,10 +87,11 @@
gap = GAP * 5
mid_hashes = HASH
else:
# x == middle - 1 (last)
# Case: x == middle - 1 (last)
side_hashes = HASH * (x * 2)
gap = GAP * 1
mid_hashes = gap
# Next version test code
# spaces = SPACE * x

hashes = side_hashes + gap + mid_hashes + gap + side_hashes
Expand All @@ -95,8 +100,8 @@
print(PAD + spaces + hashes + spaces, f' | i: {i}, end: {top + middle}, x: {x}') # Only for debug

for i in range(top + middle, height + 1):
# Next version test code
# if i % 2 != 0 or i == top + middle:
# if i % 2 != 0 or i <= top + middle + 1:
# continue

hashes = HASH * (2 * (height - i) + 1)
Expand All @@ -110,5 +115,3 @@ def get_logo_size(size):
_height = _height + 2 if _height % 2 == 0 else _height - 1
_width = _height - 1
return _height + 1, _width


41 changes: 41 additions & 0 deletions src/eth_logo/eth_logo_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/python
"""
Usage:
print-eth SIZE CHAR [defaults: size=20 char='#']
Examples:
print-eth
print-eth 30 %
Code:
https://github.com/0xMarto/eth-logo
"""
import sys
from eth_logo import print_eth


def main():
parameter_amount = len(sys.argv) - 1
if parameter_amount == 1 and (sys.argv[1] == '-h' or sys.argv[1] == '--help'):
print(__doc__)
sys.exit(1)
try:
if parameter_amount == 1:
size = int(sys.argv[1])
print_eth(size)
elif parameter_amount == 2:
size, char = int(sys.argv[1]), str(sys.argv[2])
print_eth(size, char)
else:
print_eth()
except Exception as e:
print(e)
sys.exit(1)


def print_eth_script():
main()


if __name__ == "__main__":
main()

0 comments on commit bfa7f95

Please sign in to comment.