Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev fixups #19

Merged
merged 147 commits into from
Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
185d0ab
cleanup root [build] test build
neural-loop Nov 26, 2022
bf624de
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
a93b9fc
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
7fbc38c
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
013aabb
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
a2aa992
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
461a8c1
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
9f074f8
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
03ab8d5
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
b988be9
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
619c6b5
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
2f7a35a
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
d6298de
cleanup root [build] test build test ftp
neural-loop Nov 26, 2022
fc3542c
setting up linux binary
neural-loop Nov 26, 2022
e3505aa
setting up linux binary [build]
neural-loop Nov 26, 2022
a570eb6
setting up linux binary [build]
neural-loop Nov 26, 2022
804854b
setting up linux binary [build]
neural-loop Nov 26, 2022
3b1fe60
setting up linux binary [build]
neural-loop Nov 26, 2022
16dfd34
setting up linux binary [build]
neural-loop Nov 26, 2022
dfc7d78
setting up linux binary [build]
neural-loop Nov 26, 2022
afec641
setting up linux binary [build]
neural-loop Nov 26, 2022
74c2b81
setting up linux binary [build]
neural-loop Nov 26, 2022
af29051
setting up linux binary [build]
neural-loop Nov 26, 2022
a3c5b95
setting up linux binary [build]
neural-loop Nov 26, 2022
0daf0ae
setting up linux binary [build]
neural-loop Nov 26, 2022
06949e9
setting up linux binary [build]
neural-loop Nov 26, 2022
24714d6
setting up linux binary [build]
neural-loop Nov 26, 2022
e69969a
Merge remote-tracking branch 'origin/build_exe_2' into build_exe_2
neural-loop Nov 26, 2022
372f304
possible fix for changelog
Rayrsn Nov 26, 2022
0bd1227
possible fix for changelog [build]
Rayrsn Nov 26, 2022
0d232c6
switch @ for HEAD
Rayrsn Nov 26, 2022
987b472
switch @ for HEAD [build]
Rayrsn Nov 26, 2022
d7f36d3
possible fix for #14
Rayrsn Nov 27, 2022
328b688
added workflow_dispatch to build trigger
Rayrsn Nov 27, 2022
c756805
Merge branch 'main' into build_exe_2
neural-loop Nov 28, 2022
9196f8e
update action [build] [tests]
neural-loop Nov 28, 2022
bc7cdc4
Update pyinstaller.yml
neural-loop Nov 28, 2022
05b0955
[build] [tests]
neural-loop Nov 28, 2022
81d9c65
fix check-update function
Rayrsn Nov 28, 2022
32085b1
update action [build] [tests]
neural-loop Nov 28, 2022
3ee6a6d
Merge branch 'dev' into dev-fixups
neural-loop Nov 28, 2022
77c5bed
version bump
neural-loop Nov 29, 2022
7eb2031
version bump scripted console record test 1 [docs]
neural-loop Nov 29, 2022
d13eb7d
version bump scripted console record test 1 [docs]
neural-loop Nov 29, 2022
6effc90
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
bdd7be9
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
c94148d
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
de05231
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
fa251bd
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
add67df
Update terminal.gif
Nov 29, 2022
a23f1e6
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
5afb1ca
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
8b8a78a
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
9ab0a7d
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
7668773
Update terminal.gif
Nov 29, 2022
982f0bd
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
59e53e9
Merge remote-tracking branch 'origin/dev-fixups' into dev-fixups
neural-loop Nov 29, 2022
4555f94
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
5045974
Update terminal.gif
Nov 29, 2022
fe3be54
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
c631014
Merge remote-tracking branch 'origin/dev-fixups' into dev-fixups
neural-loop Nov 29, 2022
3936110
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
b825c6e
Update terminal.gif
Nov 29, 2022
1da438c
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
1cb35b2
Merge remote-tracking branch 'origin/dev-fixups' into dev-fixups
neural-loop Nov 29, 2022
227f700
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
263b221
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
3f4f457
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
2d339bb
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
c3751d6
Update terminal.gif
Nov 29, 2022
a36958b
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
d5b9056
Merge remote-tracking branch 'origin/dev-fixups' into dev-fixups
neural-loop Nov 29, 2022
59e8fb8
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
f8693f7
Update terminal.gif
Nov 29, 2022
770e83b
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
dc55e23
Merge remote-tracking branch 'origin/dev-fixups' into dev-fixups
neural-loop Nov 29, 2022
4d64645
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
c7f2d5f
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
60fd9d9
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
affb176
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
4fca2de
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
9faac69
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
d438829
Update terminal.gif
Nov 29, 2022
7f263d6
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
a19f954
Merge remote-tracking branch 'origin/dev-fixups' into dev-fixups
neural-loop Nov 29, 2022
f5ea2b5
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
6ffbfa5
Update terminal.gif
Nov 29, 2022
30eb37e
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
2525012
Merge remote-tracking branch 'origin/dev-fixups' into dev-fixups
neural-loop Nov 29, 2022
683d20f
version bump scripted console record test 1 [docs] debug
neural-loop Nov 29, 2022
a19f6ab
Update terminal.gif
Nov 29, 2022
4b5df21
testing debian build [build]
neural-loop Dec 1, 2022
f934885
testing debian build [build]
neural-loop Dec 1, 2022
621f71e
testing debian build [build]
neural-loop Dec 1, 2022
04efc8f
testing debian build [build]
neural-loop Dec 2, 2022
4481839
testing debian build [build-linux]
neural-loop Dec 2, 2022
bdf0139
testing debian build
neural-loop Dec 2, 2022
6620368
test [build-win]
neural-loop Dec 2, 2022
b174dc3
test [build-win]
neural-loop Dec 2, 2022
7543325
test [build-win]
neural-loop Dec 2, 2022
a916e36
test [build-win]
neural-loop Dec 2, 2022
c479057
test [build-win]
neural-loop Dec 2, 2022
4c4d560
test [build-win]
neural-loop Dec 2, 2022
40caf1e
test [build-win]
neural-loop Dec 2, 2022
7061367
test [build-win]
neural-loop Dec 2, 2022
2b383bb
test [build-win]
neural-loop Dec 2, 2022
a27dd4f
test [build-win]
neural-loop Dec 2, 2022
b8aed93
test [build-win]
neural-loop Dec 2, 2022
f70745f
test [build-win]
neural-loop Dec 2, 2022
c8f5cf2
test [build-win]
neural-loop Dec 2, 2022
2272e66
test [build-win]
neural-loop Dec 2, 2022
407494e
test [build-win]
neural-loop Dec 2, 2022
e63889e
test [build-win]
neural-loop Dec 2, 2022
1317a6f
test [build-win]
neural-loop Dec 2, 2022
c3c6103
test [build-win] [build-linux]
neural-loop Dec 2, 2022
2a9791a
test [build-win] [build-linux]
neural-loop Dec 2, 2022
cf48e89
test [build-win] [build-linux]
neural-loop Dec 2, 2022
e383fdc
test [build-linux]
neural-loop Dec 2, 2022
f61968c
test [build-mac]
neural-loop Dec 2, 2022
090a9fe
Merge branch 'main' into dev
neural-loop Dec 3, 2022
3ad23e1
Merge remote-tracking branch 'origin/build_exe_2' into dev
neural-loop Dec 3, 2022
ecece8b
Merge remote-tracking branch 'origin/debtest' into dev
neural-loop Dec 3, 2022
5ac8ca6
Merge remote-tracking branch 'origin/dev-fixups' into dev
neural-loop Dec 3, 2022
d5f7c20
Added picklescan
Rayrsn Dec 3, 2022
5cd7f31
Automate gif generation
Rayrsn Dec 3, 2022
f238f97
Automating asc to gif
Rayrsn Dec 3, 2022
f9934d6
Added workflow_dispatch support to record
Rayrsn Dec 3, 2022
77e23bb
fix record bugs
Rayrsn Dec 3, 2022
7cf28fb
Update gifs
Dec 3, 2022
fb7c59d
changed python version to 3.10
Rayrsn Dec 3, 2022
fea1ef5
Update gifs
Dec 3, 2022
a4c083b
fix visual bug
Rayrsn Dec 3, 2022
96f70a8
Update gifs
Dec 3, 2022
a440535
better gitignore check
Rayrsn Dec 3, 2022
e406ae1
Added name_version support to picklescan
Rayrsn Dec 3, 2022
55f082e
moved get_model_path to base_funcs
Rayrsn Dec 3, 2022
ef27306
fix files not getting added to lock file
Rayrsn Dec 3, 2022
3f086c2
better gitignore check
Rayrsn Dec 3, 2022
9b16abe
removed base_funcs from call
Rayrsn Dec 3, 2022
47ec738
use forward slash instead of backslash
Rayrsn Dec 3, 2022
a276211
made input case insensitive
Rayrsn Dec 3, 2022
ed91c74
support for when no version is specified
Rayrsn Dec 3, 2022
ee86209
Added lock file support to add command
Rayrsn Dec 3, 2022
0050357
fix security check bypass in add command
Rayrsn Dec 3, 2022
f924cb4
fix lock file not getting created
Rayrsn Dec 3, 2022
a8c6e7c
credentials shouldn't be under packages
Rayrsn Dec 3, 2022
b97ad42
updating status and error messages
neural-loop Dec 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions .github/workflows/record.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,64 @@ name: Record

on:
push:
branches: [ dev, main, build_exe_2 ]
branches: [ dev, main, dev-fixups ]
workflow_dispatch:
jobs:
make-gif:
if: contains(github.event.head_commit.message, '[docs]') # only run if commit message contains [docs]
if: ${{ contains(github.event.head_commit.message, '[docs]') || github.event_name == 'workflow_dispatch' }} # only run if commit message contains [docs] or workflow_dispatch
runs-on: ubuntu-latest
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install termcolor
- name: Install asciinema
run: |
sudo apt-add-repository ppa:zanchey/asciinema -y
sudo apt-get update -y
sudo apt-get install asciinema -y
- name: Record
- name: Recording
run: |
chmod +x docs/gif_automate.sh
asciinema rec terminal.asc -c resources/docs/gif_automate.sh
# go through all json in src, put sh into dist
python3 resources/actions/autocon/gif_automate.py asc
- name: Download agg
run: wget https://github.com/asciinema/agg/releases/latest/download/agg-x86_64-unknown-linux-gnu -O agg
- name: Make agg executable
run: chmod +x agg
- name: Convert to gif
run: ./agg terminal.asc terminal.gif
run: python3 resources/actions/autocon/gif_automate.py gif
- name: Upload gif
uses: actions/upload-artifact@v3
with:
name: terminal.gif
path: terminal.gif
# upload all gifs in resources/actions/autocon/dist
name: gifs
path: resources/actions/autocon/dist
- name: Upload asciinema
uses: actions/upload-artifact@v3
with:
name: terminal.asc
path: terminal.asc
# upload all ascs in resources/actions/autocon/src
name: ascs
path: resources/actions/autocon/src/*.asc
- name: Move gif
run: |
mkdir -p docs
mv terminal.gif resources/docs/terminal.gif
mv resources/actions/autocon/dist/*.gif resources/docs/
- name: Commit changes
run: |
git config --local user.name "GitHub Actions"
git add resources/docs/terminal.gif
git commit -m 'Update terminal.gif'
git add resources/docs/
git commit -m 'Update gifs'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: build_exe_2
branch: ${{ env.BRANCH_NAME }}

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,5 @@ aimodels-lock.json
/ldm/
/.fleet/

# For local aimodels packages
aimodels-lock.json
2 changes: 1 addition & 1 deletion aimm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
WEBSITE = "https://aimodels.org"
API_SERVER = "https://api.aimodels.org"
GITHUB_REPO = "visioninit/aimm"
VERSION = "0.3.0"
VERSION = "alpha-1"


def init():
Expand Down
5 changes: 3 additions & 2 deletions cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# initialize the info command
# initialize the commands
from cli import (base_funcs,
install,
uninstall,
Expand All @@ -9,5 +9,6 @@
add,
remove,
security,
credentials
credentials,
pickle
)
9 changes: 6 additions & 3 deletions cli/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

app = aimmApp.app
@app.command()
def add(name_version: str):
def add(name_version: str, mut_path: bool = typer.Option(False, "--allow-mutable-paths")):
"""
Add a model to local aimodels.json.
"""
Expand All @@ -22,9 +22,12 @@ def add(name_version: str):
sys.exit(1)

if base_funcs.should_install(name, version):
install.install(name_version)
install.install(name_version,mut_path=mut_path)
else:
typer.echo(f"{name}:{version} already installed.")
# add to aimodels-lock.json
save_path = os.path.join(aimmApp.main_dir, name, version)
base_funcs.update_ai_models_lock(name, version, save_path)
typer.echo(f"Is this used: {name}:{version}")

# parse aimodels.json as a json
try:
Expand Down
3 changes: 2 additions & 1 deletion cli/aimmApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def show_help(program_name):
print(" info <model_name>:[version] Get info about a model (name, version, description, etc).")
print(" install <model_name>:[version] Install a model to system.")
print(" uninstall <model_name>:[version] Uninstall a model.")
print(" scan <model_name>:[version] Scan model for pickles and potential issues.")
print()
print("Search:")
print(" search <query> Search for a model.")
Expand All @@ -77,7 +78,7 @@ def check_for_updates(repo, current_version):
try:
r = requests.get(url, timeout=10)
if r.status_code == 200:
latest_version = r.json()[0]["tag_name"]
latest_version = r.json()["tag_name"]
latest_version_list = latest_version.split(".")
current_version_list = current_version.split(".")
if (latest_version_list[0] > current_version_list[0]) or (latest_version_list[1] > current_version_list[1]) or (latest_version_list[2] > current_version_list[2]):
Expand Down
20 changes: 16 additions & 4 deletions cli/base_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ def update_ai_models_lock(name, version, path):
aimodels_lock_file = os.path.join(cwd, "aimodels-lock.json")
# get a list of files in path
files = os.listdir(path)

# path should use forward slashes instead of backslashes
path = path.replace("\\", "/")
# check if aimodels-lock.json exists
if not os.path.exists(aimodels_lock_file):
# create aimodels-lock.json
Expand All @@ -137,8 +138,8 @@ def update_ai_models_lock(name, version, path):
"path": path,
"files": files
},
},
"credentials": {}
}
}
# write aimodels-lock.json
with open("aimodels-lock.json", "w") as f:
Expand Down Expand Up @@ -183,7 +184,7 @@ def update_ai_models_lock(name, version, path):
else:
with open(".gitignore", "r") as f:
gitignore = f.read()
if gitignore_text not in gitignore:
if "aimodels-lock.json" not in gitignore:
# append to end
with open(".gitignore", "a") as f:
f.write(gitignore_text)
Expand Down Expand Up @@ -212,4 +213,15 @@ def get_creds(download_url):
with open("aimodels-lock.json", "r") as f:
aimodels_lock = json.load(f)
# return username and password
return aimodels_lock["credentials"][domain]["username"], aimodels_lock["credentials"][domain]["password"]
return aimodels_lock["credentials"][domain]["username"], aimodels_lock["credentials"][domain]["password"]

def get_model_path(name_version):
name, version = extract_name_version(name_version)
if version is None:
version = get_last_version(name)
for package in aimmApp.installed["packages"]:
if package["name"].lower() == name.lower() and package["version"] == version:
return package["paths"]
else:
typer.echo(f"Error: {name}:{version} not found")
return None
32 changes: 22 additions & 10 deletions cli/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def install(name_version: Optional[str] = typer.Argument(None),
return

if base_funcs.should_install(name, version):
typer.echo(f"Installing {name}:{version}...")
typer.echo(f"Install Pre-Check: {name}:{version}...")
# download the model
# if data doesn't have entries exit
if base_funcs.models_json(name,version)["data"] == []:
Expand All @@ -61,13 +61,23 @@ def install(name_version: Optional[str] = typer.Argument(None),
if not file["download_url"]:
typer.echo(f"Error: Model {name}:{version} not found")
return
# check if md5 exists
# check if mut_path is passed
# check if mut_path is passed
if not mut_path:
if not file["md5"]:
typer.echo(f"Error: {name}:{version}")
typer.echo(" Remote URL file could be changed and no checksum provided to validate file.")
sys.exit(1)
typer.echo(f"Error: Unverifiable download path in request")
typer.echo(" * Remote file is mutable\n"
" Immutable download paths always point to the same file. In cases\n"
" where the file is mutable, the file could be changed.\n\n"
" Example of immutable paths:\n"
" - github.com/{user}}/{repo_name}/tree/{commit_hash}\n"
" - huggingface.co/spaces/{space_name}/{repo_name}/tree/{commit_hash}\n\n"
" Mutable paths in your request:\n"
" - somemodel:version\n"
" "+file['download_url']+"\n"
" - othermodel:version\n"
" "+file['download_url']+"\n")
typer.echo(" To allow mutable files, run command again with argument:\n"
"\t --allow-mutable-paths")
sys.exit(1)

save_path = os.path.join(aimmApp.main_dir, name, version)
if not os.path.exists(save_path):
Expand All @@ -88,8 +98,8 @@ def install(name_version: Optional[str] = typer.Argument(None),
else:
base_funcs.download_file(file["download_url"], save_path)

# add to aimodels-lock.json
base_funcs.update_ai_models_lock(name, version, save_path)
# add to aimodels-lock.json
base_funcs.update_ai_models_lock(name, version, save_path)
# make a list of links
links = []
# only execute if there are links
Expand All @@ -109,4 +119,6 @@ def install(name_version: Optional[str] = typer.Argument(None),
json.dump(aimmApp.installed, file, indent=4)
typer.echo(f"Installed {name}:{version}!")
else:
typer.echo(f"{name}:{version} already installed.")
save_path = os.path.join(aimmApp.main_dir, name, version)
base_funcs.update_ai_models_lock(name, version, save_path)
typer.echo(f"Found Local: {name}:{version}")
68 changes: 68 additions & 0 deletions cli/pickle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import os
import hashlib
import json
import typer
from picklescan import scanner

from cli import aimmApp, base_funcs

app = aimmApp.app

def hash_file(filename):
hash_obj = hashlib.sha256()
with open(filename, 'rb') as file:
chunk = 0
while chunk != b'':
chunk = file.read(1024)
hash_obj.update(chunk)

return hash_obj.hexdigest()


def get_maximum_danger(result_globals) -> str:
safety = None
for module in result_globals:
if safety is None:
safety = module.safety
elif safety.value < module.safety.value:
safety = module.safety
match safety:
case scanner.SafetyLevel.Innocuous:
safety = "innocuous"
case scanner.SafetyLevel.Suspicious:
safety = "suspicious"
case scanner.SafetyLevel.Dangerous:
safety = "dangerous"
return safety

@app.command()
def scan(name_version: str, raw: bool = typer.Option(False, "--raw", "-r")):
"""
Scan a file for malicious code.
"""
model_path = base_funcs.get_model_path(name_version)
if model_path:
for file in os.listdir(model_path):
path = os.path.join(model_path, file)
result = scanner.scan_file_path(path)
if not raw:
print(f"Scanning {path}...")
print(f"scanned files: {result.scanned_files}")
print(f"issues count: {result.issues_count}")
print(f"infected files: {result.infected_files}")
print("safety level of modules:")
for module in result.globals:
print(
f" * {module.module}.{module.name} - {(module.safety.value).title()}")
print(f"Hash: {hash_file(path)}")
else:
safety = get_maximum_danger(result.globals)
print(json.dumps({
"hash": hash_file(path),
"picklescan": {
"scanned_files": result.scanned_files,
"issues_count": result.issues_count,
"infected_files": result.infected_files,
"safety_level": safety
}
},indent=4))
2 changes: 1 addition & 1 deletion cli/remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def remove(name_version: str):
if package_name.lower() == name.lower() and package_version.lower() == version.lower():
aimodels.pop(package_name)
typer.echo(f"Removed {name_version} from aimodels.json")
typer.echo(f"The package is still available system-wide, to uninstall it run aimm uninstall {name}:{version}")
typer.echo(f"The package is still available system-wide, to uninstall (delete files):\n\t aimm uninstall {name}:{version}")
break
else:
typer.echo(f"{name_version} not found in aimodels.json")
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ tqdm==4.57.0
typer==0.7.0
urllib3==1.26.12
wcwidth==0.2.5
pip-licenses==4.0.1
pip-licenses==4.0.1
picklescan==0.0.5
25 changes: 25 additions & 0 deletions resources/actions/autocon/gif_automate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import os
import sys

DEFAULT_COMMAND = "asciinema rec"
DEFAULT_DIR = "resources/actions/autocon"

if __name__ == '__main__':
if len(sys.argv) >= 2:
# change working directory to the main directory
os.chdir(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
# for every json file run json_typing.py
if sys.argv[1] == "asc":
for file in os.listdir(f"{DEFAULT_DIR}/src"):
if file.endswith('.json'):
name = file.split('.json')[0]
os.system(f'{DEFAULT_COMMAND} {DEFAULT_DIR}/src/{name}.asc -c "python3 {DEFAULT_DIR}/json_typing.py {DEFAULT_DIR}/src/{name}.json"')
elif sys.argv[1] == "gif":
# make dist folder
if not os.path.exists(f"{DEFAULT_DIR}/dist"):
os.mkdir(f"{DEFAULT_DIR}/dist")
for file in os.listdir(f"{DEFAULT_DIR}/src"):
if file.endswith('.asc'):
name = file.split('.asc')[0]
os.system(f'./agg {DEFAULT_DIR}/src/{name}.asc {DEFAULT_DIR}/dist/{name}.gif')

Loading