From d15e47d02f464e44e001eba8f9cf84b9603288a6 Mon Sep 17 00:00:00 2001 From: Mark Krasner Date: Tue, 24 Sep 2024 11:45:49 -0400 Subject: [PATCH] Adding readme with instructions --- .env.example | 8 + .gitignore | 1 + README.md | 63 ++++++++ examples.py | 7 +- myenv/bin/Activate.ps1 | 247 ----------------------------- myenv/bin/activate | 70 -------- myenv/bin/activate.csh | 27 ---- myenv/bin/activate.fish | 69 -------- myenv/bin/base58 | 8 - myenv/bin/cbor2 | 8 - myenv/bin/cygdb | 8 - myenv/bin/cython | 8 - myenv/bin/cythonize | 8 - myenv/bin/docutils | 8 - myenv/bin/dotenv | 8 - myenv/bin/f2py | 8 - myenv/bin/flask | 8 - myenv/bin/httpx | 8 - myenv/bin/jp.py | 54 ------- myenv/bin/jsondiff | 41 ----- myenv/bin/jsonpatch | 107 ------------- myenv/bin/jsonpointer | 67 -------- myenv/bin/normalizer | 8 - myenv/bin/numpy-config | 8 - myenv/bin/pip | 8 - myenv/bin/pip3 | 8 - myenv/bin/pip3.12 | 8 - myenv/bin/pybabel | 8 - myenv/bin/pygmentize | 8 - myenv/bin/python | 1 - myenv/bin/python3 | 1 - myenv/bin/python3.12 | 1 - myenv/bin/rst2html | 8 - myenv/bin/rst2html4 | 8 - myenv/bin/rst2html5 | 8 - myenv/bin/rst2latex | 8 - myenv/bin/rst2man | 8 - myenv/bin/rst2odt | 8 - myenv/bin/rst2pseudoxml | 8 - myenv/bin/rst2s5 | 8 - myenv/bin/rst2xetex | 8 - myenv/bin/rst2xml | 8 - myenv/bin/sphinx-apidoc | 8 - myenv/bin/sphinx-autogen | 8 - myenv/bin/sphinx-build | 8 - myenv/bin/sphinx-quickstart | 8 - myenv/pyvenv.cfg | 5 - myenv/share/doc/jwcrypto/LICENSE | 165 ------------------- myenv/share/doc/jwcrypto/README.md | 48 ------ requirements copy.txt | 27 ---- server.py | 2 +- 51 files changed, 76 insertions(+), 1183 deletions(-) create mode 100644 .env.example create mode 100644 README.md delete mode 100644 myenv/bin/Activate.ps1 delete mode 100644 myenv/bin/activate delete mode 100644 myenv/bin/activate.csh delete mode 100644 myenv/bin/activate.fish delete mode 100755 myenv/bin/base58 delete mode 100755 myenv/bin/cbor2 delete mode 100755 myenv/bin/cygdb delete mode 100755 myenv/bin/cython delete mode 100755 myenv/bin/cythonize delete mode 100755 myenv/bin/docutils delete mode 100755 myenv/bin/dotenv delete mode 100755 myenv/bin/f2py delete mode 100755 myenv/bin/flask delete mode 100755 myenv/bin/httpx delete mode 100755 myenv/bin/jp.py delete mode 100755 myenv/bin/jsondiff delete mode 100755 myenv/bin/jsonpatch delete mode 100755 myenv/bin/jsonpointer delete mode 100755 myenv/bin/normalizer delete mode 100755 myenv/bin/numpy-config delete mode 100755 myenv/bin/pip delete mode 100755 myenv/bin/pip3 delete mode 100755 myenv/bin/pip3.12 delete mode 100755 myenv/bin/pybabel delete mode 100755 myenv/bin/pygmentize delete mode 120000 myenv/bin/python delete mode 120000 myenv/bin/python3 delete mode 120000 myenv/bin/python3.12 delete mode 100755 myenv/bin/rst2html delete mode 100755 myenv/bin/rst2html4 delete mode 100755 myenv/bin/rst2html5 delete mode 100755 myenv/bin/rst2latex delete mode 100755 myenv/bin/rst2man delete mode 100755 myenv/bin/rst2odt delete mode 100755 myenv/bin/rst2pseudoxml delete mode 100755 myenv/bin/rst2s5 delete mode 100755 myenv/bin/rst2xetex delete mode 100755 myenv/bin/rst2xml delete mode 100755 myenv/bin/sphinx-apidoc delete mode 100755 myenv/bin/sphinx-autogen delete mode 100755 myenv/bin/sphinx-build delete mode 100755 myenv/bin/sphinx-quickstart delete mode 100644 myenv/pyvenv.cfg delete mode 100644 myenv/share/doc/jwcrypto/LICENSE delete mode 100644 myenv/share/doc/jwcrypto/README.md delete mode 100644 requirements copy.txt diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..f3e82e9 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +ENV_ID= +AGENT_ONE_SEED= +AGENT_TWO_SEED= +AGENT_THREE_SEED= +TABLE_ID=kjzl6hvfrbw6cac35814w419t0jesyz5ibs94hxla1fqputf2aazb9do5sxji9f +CONTEXT_ID= +CERAMIC_ENDPOINT="https://ceramic-orbisdb-mainnet-direct.hirenodes.io/" +ORBIS_ENDPOINT="https://studio.useorbis.com/api/db/query/json" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 864d357..24388d9 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,7 @@ coverage.xml # Environments .env +myenv/ .venv env/ venv/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..a7657d2 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +# OrbisDB Python Starter + +This repository is a modified version of the Index Network [Ceramic-Python](https://github.com/indexnetwork/ceramic-python) library that includes examples and slight modifications to be compatible with OrbisDB. + +## Overview + +This demo repository is structured as a simple Flask server that exposes a class called `CeramicActions` found in [examples.py](examples.py). This example architecture emulates an AI agent environment, and therefore assigns three imaginary agents individual Ceramic private keys so they can author data to the network. + +Additionally, for no reason in particlar, the demo uses a [pageview](definition.json) data model. This has already been deployed to Ceramic, and is therefore provided in the example .env file as the default table value. + +Finally, this demo only displays the use of raw SQL queries for reading data. However, OrbisDB also exposes a GraphQL endpoint for read capabilities (that you can easily incorporate into your code, if preferred). + +## Getting Started + +1. Create a copy of the example env file: + +```bash +cp .env.example .env +``` + +2. OrbisDB Setup + +To make things simple, we will use the hosted [OrbisDB Studio](https://studio.useorbis.com/) and the shared node instance it provides for this demo, but keep in mind that you can set up your separate instance whenever you want (more details at [OrbisDB](https://useorbis.com/)). + +First, sign in with your wallet. + +Once signed in, the studio will default to the `Contexts` tab at the top. On the right-hand side, you will see the shared node endpoints (already provided for you in your env file), as well as your environment ID. Go ahead and assign that value to `ENV_ID` in your new `.env` file. + +Next, set up a context. These help developers segment their data models and usage based on the applications they are meant for. Create a new context (call it whatever you like), and assign the resulting string to `CONTEXT_ID` in your `.env` file. + +3. Create your virtual environment and install dependencies: + +```bash +python3 -m venv myenv +source myenv/bin/activate +pip3 install -r requirements.txt +``` + +4. Create and assign private Ceramic seeds to each of the agents in your .env file: + +```bash +python3 seeds.py +``` + +Copy the strings corresponding to each agent from your terminal log and assign to each agent. + +5. Finally, start your server: + +```bash +python3 server.py +``` + +Your server will now be running on `http://127.0.0.1:5000/` + +## Reading and Creating Data + +You can reference the pseudocode provided in the [server.py](server.py) file. For example, creating a document: + +```bash +curl -X POST "http://127.0.0.1:5000/create_document?agent=agent_three" \ + -H "Content-Type: application/json" \ + -d '{"page": "/home", "address": "0x8071f6F971B438f7c0EA72C950430EE7655faBCe", "customer_user_id": 3}' +``` \ No newline at end of file diff --git a/examples.py b/examples.py index ab44f11..5b93853 100644 --- a/examples.py +++ b/examples.py @@ -19,8 +19,7 @@ AGENT_TWO_SEED = os.getenv("AGENT_TWO_SEED") AGENT_THREE_SEED = os.getenv("AGENT_THREE_SEED") CERAMIC_ENDPOINT = os.getenv("CERAMIC_ENDPOINT") - -orbis_url = "https://studio.useorbis.com/api/db/query/json" +ORBIS_ENDPOINT = os.getenv("ORBIS_ENDPOINT") switcher = { "agent_one": AGENT_ONE_SEED, @@ -86,7 +85,7 @@ def get_all_documents(self): headers = { "Content-Type": "application/json" } - response = requests.post(url=orbis_url, headers=headers, json=body) + response = requests.post(url=ORBIS_ENDPOINT, headers=headers, json=body) pprint(response.json()) return response.json() @@ -112,6 +111,6 @@ def get_with_filter(self, filter): headers = { "Content-Type": "application/json" } - response = requests.post(url=orbis_url, headers=headers, json=body) + response = requests.post(url=ORBIS_ENDPOINT, headers=headers, json=body) pprint(response.json()) return response.json() \ No newline at end of file diff --git a/myenv/bin/Activate.ps1 b/myenv/bin/Activate.ps1 deleted file mode 100644 index b49d77b..0000000 --- a/myenv/bin/Activate.ps1 +++ /dev/null @@ -1,247 +0,0 @@ -<# -.Synopsis -Activate a Python virtual environment for the current PowerShell session. - -.Description -Pushes the python executable for a virtual environment to the front of the -$Env:PATH environment variable and sets the prompt to signify that you are -in a Python virtual environment. Makes use of the command line switches as -well as the `pyvenv.cfg` file values present in the virtual environment. - -.Parameter VenvDir -Path to the directory that contains the virtual environment to activate. The -default value for this is the parent of the directory that the Activate.ps1 -script is located within. - -.Parameter Prompt -The prompt prefix to display when this virtual environment is activated. By -default, this prompt is the name of the virtual environment folder (VenvDir) -surrounded by parentheses and followed by a single space (ie. '(.venv) '). - -.Example -Activate.ps1 -Activates the Python virtual environment that contains the Activate.ps1 script. - -.Example -Activate.ps1 -Verbose -Activates the Python virtual environment that contains the Activate.ps1 script, -and shows extra information about the activation as it executes. - -.Example -Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv -Activates the Python virtual environment located in the specified location. - -.Example -Activate.ps1 -Prompt "MyPython" -Activates the Python virtual environment that contains the Activate.ps1 script, -and prefixes the current prompt with the specified string (surrounded in -parentheses) while the virtual environment is active. - -.Notes -On Windows, it may be required to enable this Activate.ps1 script by setting the -execution policy for the user. You can do this by issuing the following PowerShell -command: - -PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser - -For more information on Execution Policies: -https://go.microsoft.com/fwlink/?LinkID=135170 - -#> -Param( - [Parameter(Mandatory = $false)] - [String] - $VenvDir, - [Parameter(Mandatory = $false)] - [String] - $Prompt -) - -<# Function declarations --------------------------------------------------- #> - -<# -.Synopsis -Remove all shell session elements added by the Activate script, including the -addition of the virtual environment's Python executable from the beginning of -the PATH variable. - -.Parameter NonDestructive -If present, do not remove this function from the global namespace for the -session. - -#> -function global:deactivate ([switch]$NonDestructive) { - # Revert to original values - - # The prior prompt: - if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { - Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt - Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT - } - - # The prior PYTHONHOME: - if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { - Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME - Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME - } - - # The prior PATH: - if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { - Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH - Remove-Item -Path Env:_OLD_VIRTUAL_PATH - } - - # Just remove the VIRTUAL_ENV altogether: - if (Test-Path -Path Env:VIRTUAL_ENV) { - Remove-Item -Path env:VIRTUAL_ENV - } - - # Just remove VIRTUAL_ENV_PROMPT altogether. - if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { - Remove-Item -Path env:VIRTUAL_ENV_PROMPT - } - - # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: - if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { - Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force - } - - # Leave deactivate function in the global namespace if requested: - if (-not $NonDestructive) { - Remove-Item -Path function:deactivate - } -} - -<# -.Description -Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the -given folder, and returns them in a map. - -For each line in the pyvenv.cfg file, if that line can be parsed into exactly -two strings separated by `=` (with any amount of whitespace surrounding the =) -then it is considered a `key = value` line. The left hand string is the key, -the right hand is the value. - -If the value starts with a `'` or a `"` then the first and last character is -stripped from the value before being captured. - -.Parameter ConfigDir -Path to the directory that contains the `pyvenv.cfg` file. -#> -function Get-PyVenvConfig( - [String] - $ConfigDir -) { - Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" - - # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). - $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue - - # An empty map will be returned if no config file is found. - $pyvenvConfig = @{ } - - if ($pyvenvConfigPath) { - - Write-Verbose "File exists, parse `key = value` lines" - $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath - - $pyvenvConfigContent | ForEach-Object { - $keyval = $PSItem -split "\s*=\s*", 2 - if ($keyval[0] -and $keyval[1]) { - $val = $keyval[1] - - # Remove extraneous quotations around a string value. - if ("'""".Contains($val.Substring(0, 1))) { - $val = $val.Substring(1, $val.Length - 2) - } - - $pyvenvConfig[$keyval[0]] = $val - Write-Verbose "Adding Key: '$($keyval[0])'='$val'" - } - } - } - return $pyvenvConfig -} - - -<# Begin Activate script --------------------------------------------------- #> - -# Determine the containing directory of this script -$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition -$VenvExecDir = Get-Item -Path $VenvExecPath - -Write-Verbose "Activation script is located in path: '$VenvExecPath'" -Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" -Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" - -# Set values required in priority: CmdLine, ConfigFile, Default -# First, get the location of the virtual environment, it might not be -# VenvExecDir if specified on the command line. -if ($VenvDir) { - Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" -} -else { - Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." - $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") - Write-Verbose "VenvDir=$VenvDir" -} - -# Next, read the `pyvenv.cfg` file to determine any required value such -# as `prompt`. -$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir - -# Next, set the prompt from the command line, or the config file, or -# just use the name of the virtual environment folder. -if ($Prompt) { - Write-Verbose "Prompt specified as argument, using '$Prompt'" -} -else { - Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" - if ($pyvenvCfg -and $pyvenvCfg['prompt']) { - Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" - $Prompt = $pyvenvCfg['prompt']; - } - else { - Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" - Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" - $Prompt = Split-Path -Path $venvDir -Leaf - } -} - -Write-Verbose "Prompt = '$Prompt'" -Write-Verbose "VenvDir='$VenvDir'" - -# Deactivate any currently active virtual environment, but leave the -# deactivate function in place. -deactivate -nondestructive - -# Now set the environment variable VIRTUAL_ENV, used by many tools to determine -# that there is an activated venv. -$env:VIRTUAL_ENV = $VenvDir - -if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { - - Write-Verbose "Setting prompt to '$Prompt'" - - # Set the prompt to include the env name - # Make sure _OLD_VIRTUAL_PROMPT is global - function global:_OLD_VIRTUAL_PROMPT { "" } - Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT - New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt - - function global:prompt { - Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " - _OLD_VIRTUAL_PROMPT - } - $env:VIRTUAL_ENV_PROMPT = $Prompt -} - -# Clear PYTHONHOME -if (Test-Path -Path Env:PYTHONHOME) { - Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME - Remove-Item -Path Env:PYTHONHOME -} - -# Add the venv to the PATH -Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH -$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/myenv/bin/activate b/myenv/bin/activate deleted file mode 100644 index 90eb4bd..0000000 --- a/myenv/bin/activate +++ /dev/null @@ -1,70 +0,0 @@ -# This file must be used with "source bin/activate" *from bash* -# You cannot run it directly - -deactivate () { - # reset old environment variables - if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then - PATH="${_OLD_VIRTUAL_PATH:-}" - export PATH - unset _OLD_VIRTUAL_PATH - fi - if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then - PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" - export PYTHONHOME - unset _OLD_VIRTUAL_PYTHONHOME - fi - - # Call hash to forget past commands. Without forgetting - # past commands the $PATH changes we made may not be respected - hash -r 2> /dev/null - - if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then - PS1="${_OLD_VIRTUAL_PS1:-}" - export PS1 - unset _OLD_VIRTUAL_PS1 - fi - - unset VIRTUAL_ENV - unset VIRTUAL_ENV_PROMPT - if [ ! "${1:-}" = "nondestructive" ] ; then - # Self destruct! - unset -f deactivate - fi -} - -# unset irrelevant variables -deactivate nondestructive - -# on Windows, a path can contain colons and backslashes and has to be converted: -if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then - # transform D:\path\to\venv to /d/path/to/venv on MSYS - # and to /cygdrive/d/path/to/venv on Cygwin - export VIRTUAL_ENV=$(cygpath "/Users/markkrasner/ceramic-py/myenv") -else - # use the path as-is - export VIRTUAL_ENV="/Users/markkrasner/ceramic-py/myenv" -fi - -_OLD_VIRTUAL_PATH="$PATH" -PATH="$VIRTUAL_ENV/bin:$PATH" -export PATH - -# unset PYTHONHOME if set -# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) -# could use `if (set -u; : $PYTHONHOME) ;` in bash -if [ -n "${PYTHONHOME:-}" ] ; then - _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" - unset PYTHONHOME -fi - -if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then - _OLD_VIRTUAL_PS1="${PS1:-}" - PS1="(myenv) ${PS1:-}" - export PS1 - VIRTUAL_ENV_PROMPT="(myenv) " - export VIRTUAL_ENV_PROMPT -fi - -# Call hash to forget past commands. Without forgetting -# past commands the $PATH changes we made may not be respected -hash -r 2> /dev/null diff --git a/myenv/bin/activate.csh b/myenv/bin/activate.csh deleted file mode 100644 index 34f353b..0000000 --- a/myenv/bin/activate.csh +++ /dev/null @@ -1,27 +0,0 @@ -# This file must be used with "source bin/activate.csh" *from csh*. -# You cannot run it directly. - -# Created by Davide Di Blasi . -# Ported to Python 3.3 venv by Andrew Svetlov - -alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' - -# Unset irrelevant variables. -deactivate nondestructive - -setenv VIRTUAL_ENV "/Users/markkrasner/ceramic-py/myenv" - -set _OLD_VIRTUAL_PATH="$PATH" -setenv PATH "$VIRTUAL_ENV/bin:$PATH" - - -set _OLD_VIRTUAL_PROMPT="$prompt" - -if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then - set prompt = "(myenv) $prompt" - setenv VIRTUAL_ENV_PROMPT "(myenv) " -endif - -alias pydoc python -m pydoc - -rehash diff --git a/myenv/bin/activate.fish b/myenv/bin/activate.fish deleted file mode 100644 index 593d185..0000000 --- a/myenv/bin/activate.fish +++ /dev/null @@ -1,69 +0,0 @@ -# This file must be used with "source /bin/activate.fish" *from fish* -# (https://fishshell.com/). You cannot run it directly. - -function deactivate -d "Exit virtual environment and return to normal shell environment" - # reset old environment variables - if test -n "$_OLD_VIRTUAL_PATH" - set -gx PATH $_OLD_VIRTUAL_PATH - set -e _OLD_VIRTUAL_PATH - end - if test -n "$_OLD_VIRTUAL_PYTHONHOME" - set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME - set -e _OLD_VIRTUAL_PYTHONHOME - end - - if test -n "$_OLD_FISH_PROMPT_OVERRIDE" - set -e _OLD_FISH_PROMPT_OVERRIDE - # prevents error when using nested fish instances (Issue #93858) - if functions -q _old_fish_prompt - functions -e fish_prompt - functions -c _old_fish_prompt fish_prompt - functions -e _old_fish_prompt - end - end - - set -e VIRTUAL_ENV - set -e VIRTUAL_ENV_PROMPT - if test "$argv[1]" != "nondestructive" - # Self-destruct! - functions -e deactivate - end -end - -# Unset irrelevant variables. -deactivate nondestructive - -set -gx VIRTUAL_ENV "/Users/markkrasner/ceramic-py/myenv" - -set -gx _OLD_VIRTUAL_PATH $PATH -set -gx PATH "$VIRTUAL_ENV/bin" $PATH - -# Unset PYTHONHOME if set. -if set -q PYTHONHOME - set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME - set -e PYTHONHOME -end - -if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" - # fish uses a function instead of an env var to generate the prompt. - - # Save the current fish_prompt function as the function _old_fish_prompt. - functions -c fish_prompt _old_fish_prompt - - # With the original prompt function renamed, we can override with our own. - function fish_prompt - # Save the return status of the last command. - set -l old_status $status - - # Output the venv prompt; color taken from the blue of the Python logo. - printf "%s%s%s" (set_color 4B8BBE) "(myenv) " (set_color normal) - - # Restore the return status of the previous command. - echo "exit $old_status" | . - # Output the original/"old" prompt. - _old_fish_prompt - end - - set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" - set -gx VIRTUAL_ENV_PROMPT "(myenv) " -end diff --git a/myenv/bin/base58 b/myenv/bin/base58 deleted file mode 100755 index 136a254..0000000 --- a/myenv/bin/base58 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from base58.__main__ import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/cbor2 b/myenv/bin/cbor2 deleted file mode 100755 index f9393a2..0000000 --- a/myenv/bin/cbor2 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from cbor2.tool import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/cygdb b/myenv/bin/cygdb deleted file mode 100755 index 79d2e30..0000000 --- a/myenv/bin/cygdb +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from Cython.Debugger.Cygdb import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/cython b/myenv/bin/cython deleted file mode 100755 index aebc600..0000000 --- a/myenv/bin/cython +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from Cython.Compiler.Main import setuptools_main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(setuptools_main()) diff --git a/myenv/bin/cythonize b/myenv/bin/cythonize deleted file mode 100755 index 203bbad..0000000 --- a/myenv/bin/cythonize +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from Cython.Build.Cythonize import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/docutils b/myenv/bin/docutils deleted file mode 100755 index 4cbc7f7..0000000 --- a/myenv/bin/docutils +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.__main__ import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/dotenv b/myenv/bin/dotenv deleted file mode 100755 index 57b18b6..0000000 --- a/myenv/bin/dotenv +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from dotenv.__main__ import cli -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli()) diff --git a/myenv/bin/f2py b/myenv/bin/f2py deleted file mode 100755 index db1738b..0000000 --- a/myenv/bin/f2py +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from numpy.f2py.f2py2e import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/flask b/myenv/bin/flask deleted file mode 100755 index aefa4cc..0000000 --- a/myenv/bin/flask +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from flask.cli import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/httpx b/myenv/bin/httpx deleted file mode 100755 index 179f9eb..0000000 --- a/myenv/bin/httpx +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from httpx import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/jp.py b/myenv/bin/jp.py deleted file mode 100755 index a6da2e0..0000000 --- a/myenv/bin/jp.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 - -import sys -import json -import argparse -from pprint import pformat - -import jmespath -from jmespath import exceptions - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('expression') - parser.add_argument('-f', '--filename', - help=('The filename containing the input data. ' - 'If a filename is not given then data is ' - 'read from stdin.')) - parser.add_argument('--ast', action='store_true', - help=('Pretty print the AST, do not search the data.')) - args = parser.parse_args() - expression = args.expression - if args.ast: - # Only print the AST - expression = jmespath.compile(args.expression) - sys.stdout.write(pformat(expression.parsed)) - sys.stdout.write('\n') - return 0 - if args.filename: - with open(args.filename, 'r') as f: - data = json.load(f) - else: - data = sys.stdin.read() - data = json.loads(data) - try: - sys.stdout.write(json.dumps( - jmespath.search(expression, data), indent=4, ensure_ascii=False)) - sys.stdout.write('\n') - except exceptions.ArityError as e: - sys.stderr.write("invalid-arity: %s\n" % e) - return 1 - except exceptions.JMESPathTypeError as e: - sys.stderr.write("invalid-type: %s\n" % e) - return 1 - except exceptions.UnknownFunctionError as e: - sys.stderr.write("unknown-function: %s\n" % e) - return 1 - except exceptions.ParseError as e: - sys.stderr.write("syntax-error: %s\n" % e) - return 1 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/myenv/bin/jsondiff b/myenv/bin/jsondiff deleted file mode 100755 index 08f55c8..0000000 --- a/myenv/bin/jsondiff +++ /dev/null @@ -1,41 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- - -from __future__ import print_function - -import sys -import json -import jsonpatch -import argparse - - -parser = argparse.ArgumentParser(description='Diff two JSON files') -parser.add_argument('FILE1', type=argparse.FileType('r')) -parser.add_argument('FILE2', type=argparse.FileType('r')) -parser.add_argument('--indent', type=int, default=None, - help='Indent output by n spaces') -parser.add_argument('-u', '--preserve-unicode', action='store_true', - help='Output Unicode character as-is without using Code Point') -parser.add_argument('-v', '--version', action='version', - version='%(prog)s ' + jsonpatch.__version__) - - -def main(): - try: - diff_files() - except KeyboardInterrupt: - sys.exit(1) - - -def diff_files(): - """ Diffs two JSON files and prints a patch """ - args = parser.parse_args() - doc1 = json.load(args.FILE1) - doc2 = json.load(args.FILE2) - patch = jsonpatch.make_patch(doc1, doc2) - if patch.patch: - print(json.dumps(patch.patch, indent=args.indent, ensure_ascii=not(args.preserve_unicode))) - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/myenv/bin/jsonpatch b/myenv/bin/jsonpatch deleted file mode 100755 index 2c45eb0..0000000 --- a/myenv/bin/jsonpatch +++ /dev/null @@ -1,107 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- - -import sys -import os.path -import json -import jsonpatch -import tempfile -import argparse - - -parser = argparse.ArgumentParser( - description='Apply a JSON patch on a JSON file') -parser.add_argument('ORIGINAL', type=argparse.FileType('r'), - help='Original file') -parser.add_argument('PATCH', type=argparse.FileType('r'), - nargs='?', default=sys.stdin, - help='Patch file (read from stdin if omitted)') -parser.add_argument('--indent', type=int, default=None, - help='Indent output by n spaces') -parser.add_argument('-b', '--backup', action='store_true', - help='Back up ORIGINAL if modifying in-place') -parser.add_argument('-i', '--in-place', action='store_true', - help='Modify ORIGINAL in-place instead of to stdout') -parser.add_argument('-v', '--version', action='version', - version='%(prog)s ' + jsonpatch.__version__) -parser.add_argument('-u', '--preserve-unicode', action='store_true', - help='Output Unicode character as-is without using Code Point') - -def main(): - try: - patch_files() - except KeyboardInterrupt: - sys.exit(1) - - -def patch_files(): - """ Diffs two JSON files and prints a patch """ - args = parser.parse_args() - doc = json.load(args.ORIGINAL) - patch = json.load(args.PATCH) - result = jsonpatch.apply_patch(doc, patch) - - if args.in_place: - dirname = os.path.abspath(os.path.dirname(args.ORIGINAL.name)) - - try: - # Attempt to replace the file atomically. We do this by - # creating a temporary file in the same directory as the - # original file so we can atomically move the new file over - # the original later. (This is done in the same directory - # because atomic renames do not work across mount points.) - - fd, pathname = tempfile.mkstemp(dir=dirname) - fp = os.fdopen(fd, 'w') - atomic = True - - except OSError: - # We failed to create the temporary file for an atomic - # replace, so fall back to non-atomic mode by backing up - # the original (if desired) and writing a new file. - - if args.backup: - os.rename(args.ORIGINAL.name, args.ORIGINAL.name + '.orig') - fp = open(args.ORIGINAL.name, 'w') - atomic = False - - else: - # Since we're not replacing the original file in-place, write - # the modified JSON to stdout instead. - - fp = sys.stdout - - # By this point we have some sort of file object we can write the - # modified JSON to. - - json.dump(result, fp, indent=args.indent, ensure_ascii=not(args.preserve_unicode)) - fp.write('\n') - - if args.in_place: - # Close the new file. If we aren't replacing atomically, this - # is our last step, since everything else is already in place. - - fp.close() - - if atomic: - try: - # Complete the atomic replace by linking the original - # to a backup (if desired), fixing up the permissions - # on the temporary file, and moving it into place. - - if args.backup: - os.link(args.ORIGINAL.name, args.ORIGINAL.name + '.orig') - os.chmod(pathname, os.stat(args.ORIGINAL.name).st_mode) - os.rename(pathname, args.ORIGINAL.name) - - except OSError: - # In the event we could not actually do the atomic - # replace, unlink the original to move it out of the - # way and finally move the temporary file into place. - - os.unlink(args.ORIGINAL.name) - os.rename(pathname, args.ORIGINAL.name) - - -if __name__ == "__main__": - main() diff --git a/myenv/bin/jsonpointer b/myenv/bin/jsonpointer deleted file mode 100755 index af890ea..0000000 --- a/myenv/bin/jsonpointer +++ /dev/null @@ -1,67 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- - - -import argparse -import json -import sys - -import jsonpointer - -parser = argparse.ArgumentParser( - description='Resolve a JSON pointer on JSON files') - -# Accept pointer as argument or as file -ptr_group = parser.add_mutually_exclusive_group(required=True) - -ptr_group.add_argument('-f', '--pointer-file', type=argparse.FileType('r'), - nargs='?', - help='File containing a JSON pointer expression') - -ptr_group.add_argument('POINTER', type=str, nargs='?', - help='A JSON pointer expression') - -parser.add_argument('FILE', type=argparse.FileType('r'), nargs='+', - help='Files for which the pointer should be resolved') -parser.add_argument('--indent', type=int, default=None, - help='Indent output by n spaces') -parser.add_argument('-v', '--version', action='version', - version='%(prog)s ' + jsonpointer.__version__) - - -def main(): - try: - resolve_files() - except KeyboardInterrupt: - sys.exit(1) - - -def parse_pointer(args): - if args.POINTER: - ptr = args.POINTER - elif args.pointer_file: - ptr = args.pointer_file.read().strip() - else: - parser.print_usage() - sys.exit(1) - - return ptr - - -def resolve_files(): - """ Resolve a JSON pointer on JSON files """ - args = parser.parse_args() - - ptr = parse_pointer(args) - - for f in args.FILE: - doc = json.load(f) - try: - result = jsonpointer.resolve_pointer(doc, ptr) - print(json.dumps(result, indent=args.indent)) - except jsonpointer.JsonPointerException as e: - print('Could not resolve pointer: %s' % str(e), file=sys.stderr) - - -if __name__ == "__main__": - main() diff --git a/myenv/bin/normalizer b/myenv/bin/normalizer deleted file mode 100755 index d3c1c9b..0000000 --- a/myenv/bin/normalizer +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from charset_normalizer.cli import cli_detect -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(cli_detect()) diff --git a/myenv/bin/numpy-config b/myenv/bin/numpy-config deleted file mode 100755 index f1f0338..0000000 --- a/myenv/bin/numpy-config +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from numpy._configtool import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/pip b/myenv/bin/pip deleted file mode 100755 index b032147..0000000 --- a/myenv/bin/pip +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/pip3 b/myenv/bin/pip3 deleted file mode 100755 index b032147..0000000 --- a/myenv/bin/pip3 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/pip3.12 b/myenv/bin/pip3.12 deleted file mode 100755 index b032147..0000000 --- a/myenv/bin/pip3.12 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from pip._internal.cli.main import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/pybabel b/myenv/bin/pybabel deleted file mode 100755 index fbaedd6..0000000 --- a/myenv/bin/pybabel +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from babel.messages.frontend import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/pygmentize b/myenv/bin/pygmentize deleted file mode 100755 index 5147938..0000000 --- a/myenv/bin/pygmentize +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from pygments.cmdline import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/python b/myenv/bin/python deleted file mode 120000 index 11b9d88..0000000 --- a/myenv/bin/python +++ /dev/null @@ -1 +0,0 @@ -python3.12 \ No newline at end of file diff --git a/myenv/bin/python3 b/myenv/bin/python3 deleted file mode 120000 index 11b9d88..0000000 --- a/myenv/bin/python3 +++ /dev/null @@ -1 +0,0 @@ -python3.12 \ No newline at end of file diff --git a/myenv/bin/python3.12 b/myenv/bin/python3.12 deleted file mode 120000 index a3f0508..0000000 --- a/myenv/bin/python3.12 +++ /dev/null @@ -1 +0,0 @@ -/opt/homebrew/opt/python@3.12/bin/python3.12 \ No newline at end of file diff --git a/myenv/bin/rst2html b/myenv/bin/rst2html deleted file mode 100755 index a2733d6..0000000 --- a/myenv/bin/rst2html +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2html -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2html()) diff --git a/myenv/bin/rst2html4 b/myenv/bin/rst2html4 deleted file mode 100755 index 4e3b8e8..0000000 --- a/myenv/bin/rst2html4 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2html4 -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2html4()) diff --git a/myenv/bin/rst2html5 b/myenv/bin/rst2html5 deleted file mode 100755 index d9266e8..0000000 --- a/myenv/bin/rst2html5 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2html5 -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2html5()) diff --git a/myenv/bin/rst2latex b/myenv/bin/rst2latex deleted file mode 100755 index df6702b..0000000 --- a/myenv/bin/rst2latex +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2latex -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2latex()) diff --git a/myenv/bin/rst2man b/myenv/bin/rst2man deleted file mode 100755 index 3ef8a16..0000000 --- a/myenv/bin/rst2man +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2man -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2man()) diff --git a/myenv/bin/rst2odt b/myenv/bin/rst2odt deleted file mode 100755 index 7e5801a..0000000 --- a/myenv/bin/rst2odt +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2odt -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2odt()) diff --git a/myenv/bin/rst2pseudoxml b/myenv/bin/rst2pseudoxml deleted file mode 100755 index d2d4f8d..0000000 --- a/myenv/bin/rst2pseudoxml +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2pseudoxml -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2pseudoxml()) diff --git a/myenv/bin/rst2s5 b/myenv/bin/rst2s5 deleted file mode 100755 index 3fe93b8..0000000 --- a/myenv/bin/rst2s5 +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2s5 -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2s5()) diff --git a/myenv/bin/rst2xetex b/myenv/bin/rst2xetex deleted file mode 100755 index e2e84a7..0000000 --- a/myenv/bin/rst2xetex +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2xetex -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2xetex()) diff --git a/myenv/bin/rst2xml b/myenv/bin/rst2xml deleted file mode 100755 index 629ba33..0000000 --- a/myenv/bin/rst2xml +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from docutils.core import rst2xml -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(rst2xml()) diff --git a/myenv/bin/sphinx-apidoc b/myenv/bin/sphinx-apidoc deleted file mode 100755 index 0cc3ad2..0000000 --- a/myenv/bin/sphinx-apidoc +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from sphinx.ext.apidoc import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/sphinx-autogen b/myenv/bin/sphinx-autogen deleted file mode 100755 index 2a4d3fd..0000000 --- a/myenv/bin/sphinx-autogen +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from sphinx.ext.autosummary.generate import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/sphinx-build b/myenv/bin/sphinx-build deleted file mode 100755 index 3f9a553..0000000 --- a/myenv/bin/sphinx-build +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from sphinx.cmd.build import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/bin/sphinx-quickstart b/myenv/bin/sphinx-quickstart deleted file mode 100755 index 32b6ad7..0000000 --- a/myenv/bin/sphinx-quickstart +++ /dev/null @@ -1,8 +0,0 @@ -#!/Users/markkrasner/ceramic-py/myenv/bin/python3.12 -# -*- coding: utf-8 -*- -import re -import sys -from sphinx.cmd.quickstart import main -if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) - sys.exit(main()) diff --git a/myenv/pyvenv.cfg b/myenv/pyvenv.cfg deleted file mode 100644 index 0dcddd7..0000000 --- a/myenv/pyvenv.cfg +++ /dev/null @@ -1,5 +0,0 @@ -home = /opt/homebrew/opt/python@3.12/bin -include-system-site-packages = false -version = 3.12.6 -executable = /opt/homebrew/Cellar/python@3.12/3.12.6/Frameworks/Python.framework/Versions/3.12/bin/python3.12 -command = /opt/homebrew/opt/python@3.12/bin/python3.12 -m venv /Users/markkrasner/ceramic-py/myenv diff --git a/myenv/share/doc/jwcrypto/LICENSE b/myenv/share/doc/jwcrypto/LICENSE deleted file mode 100644 index 65c5ca8..0000000 --- a/myenv/share/doc/jwcrypto/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/myenv/share/doc/jwcrypto/README.md b/myenv/share/doc/jwcrypto/README.md deleted file mode 100644 index c777d51..0000000 --- a/myenv/share/doc/jwcrypto/README.md +++ /dev/null @@ -1,48 +0,0 @@ -[![PyPI](https://img.shields.io/pypi/v/jwcrypto.svg)](https://pypi.org/project/jwcrypto/) -[![Changelog](https://img.shields.io/github/v/release/latchset/jwcrypto?label=changelog)](https://github.com/latchset/jwcrypto/releases) -[![Build Status](https://github.com/latchset/jwcrypto/actions/workflows/build.yml/badge.svg)](https://github.com/latchset/jwcrypto/actions/workflows/build.yml) -[![ppc64le Build](https://github.com/latchset/jwcrypto/actions/workflows/ppc64le.yml/badge.svg)](https://github.com/latchset/jwcrypto/actions/workflows/ppc64le.yml) -[![Code Scan](https://github.com/latchset/jwcrypto/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/latchset/jwcrypto/actions/workflows/codeql-analysis.yml) -[![Documentation Status](https://readthedocs.org/projects/jwcrypto/badge/?version=latest)](https://jwcrypto.readthedocs.io/en/latest/?badge=latest) - -JWCrypto -======== - -An implementation of the JOSE Working Group documents: -- RFC 7515 - JSON Web Signature (JWS) -- RFC 7516 - JSON Web Encryption (JWE) -- RFC 7517 - JSON Web Key (JWK) -- RFC 7518 - JSON Web Algorithms (JWA) -- RFC 7519 - JSON Web Token (JWT) -- RFC 7520 - Examples of Protecting Content Using JSON Object Signing and - Encryption (JOSE) - -Installation -============ - - pip install jwcrypto - -Documentation -============= - -http://jwcrypto.readthedocs.org - -Deprecation Notices -=================== - -2020.12.11: The RSA1_5 algorithm is now considered deprecated due to numerous -implementation issues that make it a very problematic tool to use safely. -The algorithm can still be used but requires explicitly allowing it on object -instantiation. If your application depends on it there are examples of how to -re-enable RSA1_5 usage in the tests files. - -Note: if you enable support for `RSA1_5` and the attacker can send you chosen -ciphertext and is able to measure the processing times of your application, -then your application will be vulnerable to a Bleichenbacher RSA padding -oracle, allowing the so-called "Million messages attack". That attack allows -to decrypt intercepted messages (even if they were encrypted with RSA-OAEP) or -forge signatures (both RSA-PKCS#1 v1.5 and RSASSA-PSS). - -Given JWT is generally used in tokens to sign authorization assertions or to -encrypt private key material, this is a particularly severe issue, and must -not be underestimated. diff --git a/requirements copy.txt b/requirements copy.txt deleted file mode 100644 index 51e5a00..0000000 --- a/requirements copy.txt +++ /dev/null @@ -1,27 +0,0 @@ -base58 -cryptography -jwcrypto -multiformats -web3 -cbor2 -anyio -flask -base32-lib -boto3 -botocore -certifi -charset-normalizer -Cython -h11 -httpcore -httpx -idna -jmespath -openrank-sdk -python-dateutil -requests -s3transfer -six -sniffio -urllib3 -python-dotenv diff --git a/server.py b/server.py index dd1210c..9bff615 100644 --- a/server.py +++ b/server.py @@ -15,7 +15,7 @@ def get(): return json.dumps(ceramic.did) # POST http://127.0.0.1:5000/create_document?agent=agent_three -# payload example: {"page": "/home", "address": "0x8071f6F971B438f7c0EA72C950430EE7655faBCe", "customer_user_id": "A2"} +# payload example: {"page": "/home", "address": "0x8071f6F971B438f7c0EA72C950430EE7655faBCe", "customer_user_id": 3} @app.route('/create_document', methods=['POST']) def create_document(): agent = request.args.get('agent')