aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-11-05 06:43:35 -0400
committerBobby <[email protected]>2022-11-05 06:43:35 -0400
commita498477551af4e54bfa09f5ee1d6bbaf8f6056fe (patch)
treec4ed68127b551f75e6d19f15d6fba2cad1d47782
parent43823882c7ae18b19b03134fb57862a8df0ca8a1 (diff)
downloadtexty-a498477551af4e54bfa09f5ee1d6bbaf8f6056fe.tar.xz
texty-a498477551af4e54bfa09f5ee1d6bbaf8f6056fe.zip
refactor: auto sort and format code on commit
-rw-r--r--.isort.cfg6
-rwxr-xr-xcommit.sh6
-rw-r--r--scripts/maintainers.py29
-rw-r--r--src/texty.py6
4 files changed, 34 insertions, 13 deletions
diff --git a/.isort.cfg b/.isort.cfg
new file mode 100644
index 0000000..e74b905
--- /dev/null
+++ b/.isort.cfg
@@ -0,0 +1,6 @@
+# isort config file
+
+[settings]
+skip_glob = env
+profile = black
+src_paths = src,scripts \ No newline at end of file
diff --git a/commit.sh b/commit.sh
index 405a9fc..575e237 100755
--- a/commit.sh
+++ b/commit.sh
@@ -40,6 +40,12 @@ commands() {
# Example:
# echo "Hello World"
+ # Sort imports
+ python3 -m isort .
+
+ # Format code
+ python3 -m black .
+
# Generate Requirements.txt
pipreqs --force .
diff --git a/scripts/maintainers.py b/scripts/maintainers.py
index 2ab3b0f..27639c0 100644
--- a/scripts/maintainers.py
+++ b/scripts/maintainers.py
@@ -4,37 +4,42 @@
import yaml
+
def main():
# Load the maintainers.yml file
- with open('maintainers.yml', 'r') as f:
+ with open("maintainers.yml", "r") as f:
maintainers = yaml.safe_load(f)
# Load the README.md file
- with open('README.md', 'r') as f:
+ with open("README.md", "r") as f:
readme = f.read()
# Generate the list of maintainers
maintainers_list = ""
maintainer_images = ""
for maintainer in maintainers:
- if not maintainer['name'] or not maintainer['github']:
+ if not maintainer["name"] or not maintainer["github"]:
# Skip maintainers without a name or github username
continue
# Generate the markdown for the maintainer
- maintainers_list += "- [{}]({})".format(maintainer['name'], maintainer['github'])
- if maintainer['email']:
- maintainers_list += "<{}>".format(maintainer['email'])
+ maintainers_list += "- [{}]({})".format(
+ maintainer["name"], maintainer["github"]
+ )
+ if maintainer["email"]:
+ maintainers_list += "<{}>".format(maintainer["email"])
- if maintainer['website']:
- maintainers_list += " - [{}]({})".format(maintainer['website'], maintainer['website'])
+ if maintainer["website"]:
+ maintainers_list += " - [{}]({})".format(
+ maintainer["website"], maintainer["website"]
+ )
# Move to next line
maintainers_list += "\r"
# Generate the markdown for the maintainer's image
- image_url = "https://github.com/{}.png?size=40".format(maintainer['github'])
- maintainer_images += "![{}]({}) ".format(maintainer['name'], image_url)
+ image_url = "https://github.com/{}.png?size=40".format(maintainer["github"])
+ maintainer_images += "![{}]({}) ".format(maintainer["name"], image_url)
# Remove everything below "<!-- maintainers -->" in the README.md file
readme = readme.split("<!-- maintainers -->")[0]
@@ -43,9 +48,9 @@ def main():
readme += "<!-- maintainers -->\r" + maintainers_list + "\r" + maintainer_images
# Save the README.md file
- with open('README.md', 'w') as f:
+ with open("README.md", "w") as f:
f.write(readme)
-if __name__ == '__main__':
+if __name__ == "__main__":
main()
diff --git a/src/texty.py b/src/texty.py
index e75154b..e9be7d1 100644
--- a/src/texty.py
+++ b/src/texty.py
@@ -1 +1,5 @@
-print("hello world") \ No newline at end of file
+# Texty is a text editor written in Python using the Tkinter. It is a simple
+# text editor focused on simplicity and ease of use while being powerful and
+# extensible. It is a work in progress and is not yet ready for use.
+
+import tkinter as tk