Skip to content

Commit 548f378

Browse files
committed
add pyproject.toml materials (snakesay)
1 parent 3db3e17 commit 548f378

File tree

8 files changed

+97
-11
lines changed

8 files changed

+97
-11
lines changed

python-pyproject-toml/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python pyproject.toml Project Example
2+
3+
Here are supporting materials for the Real Python tutorial [How to Manage Python Projects With `pyproject.toml`](https://realpython.com/python-pyproject-toml/).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
__pycache__
2+
*.pyc
3+
*.pyo
4+
*.egg-info
5+
venv/
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2024 Real Python
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Snakesay
2+
3+
A simple Python project that prints a message in a speech bubble inspired by the classic [`cowsay`](https://en.wikipedia.org/wiki/Cowsay) program. Originally created by [Ian Currie](https://realpython.com/team/icurrie/) and [Geir Arne Hjelle](https://realpython.com/team/gahjelle/) for the [Everyday Project Packaging With `pyproject.toml`](https://realpython.com/courses/packaging-with-pyproject-toml/) course on Real Python.
4+
5+
```console
6+
$ ssay Hello World!
7+
8+
______________
9+
( Hello World! )
10+
‾‾‾‾‾‾‾‾‾‾‾‾‾‾
11+
\
12+
\ ___
13+
\ (o o)
14+
\_/ \
15+
λ \ \
16+
_\ \_
17+
(_____)_
18+
(________)=Oo°
19+
```
Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,45 @@
11
[build-system]
2-
requires = ["setuptools", "setuptools-scm"]
2+
requires = ["setuptools>=75.3.0"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "snakesay"
7-
version = "1.0.0"
7+
dependencies = ["rich>=13.9.0"]
8+
authors = [{name = "Jin Doe", email = "[email protected]"}]
9+
keywords = ["CLI", "ASCII Art"]
10+
readme = {file = "README.md", content-type = "text/markdown"}
11+
requires-python = ">=3.9"
12+
classifiers = [
13+
"Development Status :: 3 - Alpha",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: MIT License",
16+
"Programming Language :: Python :: 3",
17+
"Programming Language :: Python :: 3.9",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
"Programming Language :: Python :: 3.13",
22+
]
23+
dynamic = ["version"]
24+
25+
[project.urls]
26+
Repository = "https://github.com/me/spam.git"
27+
Issues = "https://github.com/me/spam/issues"
28+
29+
[project.optional-dependencies]
30+
dev = ["black>=24.1.0", "isort>=5.13.0", "build", "twine"]
831

932
[project.scripts]
10-
snakey = "snakesay.__main__:main"
33+
ssay = "snakesay.__main__:main"
34+
35+
[tool.setuptools.packages.find]
36+
where = ["."]
37+
38+
[tool.setuptools.dynamic]
39+
version = {attr = "snakesay.__version__"}
40+
41+
[tool.black]
42+
line-length = 88
43+
44+
[tool.isort]
45+
profile = "black"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Snakesay - cowsay, but with a snake."""
2+
3+
__version__ = "0.1.0"

python-pyproject-toml/snakesay-project/snakesay/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
from snakesay import snake
44

5+
56
def main():
67
snake.say(" ".join(sys.argv[1:]))
78

9+
810
if __name__ == "__main__":
9-
main()
11+
main()
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
SNAKE = r""" \
2-
\ __
3-
\ {oo}
4-
(__)\
5-
λ \\
6-
_\\__
2+
\ ___
3+
\ (o o)
4+
\_/ \
5+
λ \ \
6+
_\ \_
77
(_____)_
88
(________)=Oo°
99
"""
@@ -18,5 +18,5 @@ def bubble(message):
1818

1919

2020
def say(message):
21-
print(bubble(message))
22-
print(SNAKE)
21+
print(bubble(message.replace("s", "ss").replace("S", "SS")))
22+
print(SNAKE)

0 commit comments

Comments
 (0)