Browse Source

fabric as a CLI; poetry for dep management with latest versions; gitignore re-added

pull/65/head
agu3rra 9 months ago
parent
commit
688886451f
  1. 163
      .gitignore
  2. 19
      client/README.md
  3. BIN
      client/__pycache__/utils.cpython-311.pyc
  4. 1
      client/fabric/__init__.py
  5. 10
      client/fabric/fabric.py
  6. 0
      client/fabric/p.py
  7. 0
      client/fabric/utils.py
  8. 1330
      client/poetry.lock
  9. 39
      client/pyproject.toml
  10. 17
      client/requirements.txt

163
.gitignore vendored

@ -0,0 +1,163 @@
# macOS local stores
.DS_Store
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

19
client/README.md

@ -24,21 +24,22 @@ You can use the client in three different modes:
`git clone git@github.com:danielmiessler/fabric.git`
2. Navigate to the client's directory:
`cd client`
3. Set up a virtual environment:
`python3 -m venv .venv`
`source .venv/bin/activate`
3. Install poetry (if you don't have it already)
`pip3 install poetry`
4. Install the required packages:
`pip install -r requirements.txt`
5. Copy to path:
`echo export PATH=$PATH:$(pwd)` >> .bashrc` # or .zshrc
6. Copy your OpenAI API key to the `.env` file in your `nvim ~/.config/fabric/` directory (or create that file and put it in)
`poetry install`
5. Activate the virtual environment:
`poetry shell`
6. Copy to path:
`echo export PATH=$PATH:$(pwd) >> ~/.bashrc` # or .zshrc
7. Copy your OpenAI API key to the `.env` file in your `nvim ~/.config/fabric/` directory (or create that file and put it in)
`OPENAI_API_KEY=[Your_API_Key]`
## Usage
To use `fabric`, call it with your desired options:
To use `fabric`, call it with your desired options (remember to activate the virtual environment with `poetry shell` - step 5 above):
python fabric.py [options]
fabric [options]
Options include:
--pattern, -p: Select the module for analysis.

BIN
client/__pycache__/utils.cpython-311.pyc

Binary file not shown.

1
client/fabric/__init__.py

@ -0,0 +1 @@
from .fabric import main

10
client/fabric → client/fabric/fabric.py

@ -1,6 +1,4 @@
#!/usr/bin/env python3
from utils import Standalone, Update, Setup
from .utils import Standalone, Update, Setup
import argparse
import sys
import os
@ -8,8 +6,7 @@ import os
script_directory = os.path.dirname(os.path.realpath(__file__))
if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser(
description="An open source framework for augmenting humans using AI."
)
@ -87,3 +84,6 @@ if __name__ == "__main__":
standalone.streamMessage(text)
else:
standalone.sendMessage(text)
if __name__ == "__main__":
main()

0
client/p.py → client/fabric/p.py

0
client/utils.py → client/fabric/utils.py

1330
client/poetry.lock

File diff suppressed because it is too large Load Diff

39
client/pyproject.toml

@ -0,0 +1,39 @@
[tool.poetry]
name = "fabric"
version = "0.1.0"
description = "Fabric client"
authors = [
"Daniel Miessler <https://github.com/danielmiessler>",
"Jonathan Dunn <https://github.com/xssdoctor>",
"Scott Behrens <https://github.com/sbehrens>",
]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
pyyaml = "^6.0.1"
requests = "^2.31.0"
pyperclip = "^1.8.2"
python-socketio = "^5.11.0"
websocket-client = "^1.7.0"
flask = "^3.0.2"
flask-sqlalchemy = "^3.1.1"
flask-login = "^0.6.3"
flask-jwt-extended = "^4.6.0"
python-dotenv = "^1.0.1"
openai = "^1.11.0"
flask-socketio = "^5.3.6"
flask-sock = "^0.7.0"
gunicorn = "^21.2.0"
gevent = "^23.9.1"
httpx = "^0.26.0"
tqdm = "^4.66.1"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
# Turns this into a poetry install CLI command
[tool.poetry.scripts]
fabric = 'fabric:main'

17
client/requirements.txt

@ -1,17 +0,0 @@
pyyaml
requests
pyperclip
python-socketio
websocket-client
flask
flask_sqlalchemy
flask_login
flask_jwt_extended
python-dotenv
openai
flask-socketio
flask-sock
gunicorn
gevent
httpx
tqdm
Loading…
Cancel
Save