diff --git a/README.md b/README.md index b172600..55af7e4 100644 --- a/README.md +++ b/README.md @@ -2184,9 +2184,9 @@ first_element = op.methodcaller('pop', 0)() Introspection ------------- ```python - = dir() # Names of local variables (incl. functions). - = vars() # Dict of local variables. Also locals(). - = globals() # Dict of global variables. + = dir() # Names of local variables, functions, classes, etc. + = vars() # Dict of local variables, etc. Also locals(). + = globals() # Dict of global vars, etc. (incl. '__builtins__'). ``` ### Attributes @@ -3537,15 +3537,16 @@ cdef class : cdef enum : , , ... ``` -### PyInstaller +### Virtual Environments +**System for installing libraries directly into project's directory.** + ```bash -$ pip3 install pyinstaller -$ pyinstaller script.py # Compiles into './dist/script' directory. -$ pyinstaller script.py --onefile # Compiles into './dist/script' console app. -$ pyinstaller script.py --windowed # Compiles into './dist/script' windowed app. -$ pyinstaller script.py --add-data ':.' # Adds file to the root of the executable. +$ python3 -m venv # Creates virtual environment in current directory. +$ source /bin/activate # Activates venv. On Windows run `\Scripts\activate`. +$ pip3 install # Installs the library into active environment. +$ python3 # Runs the script in active environment. Also `./`. +$ deactivate # Deactivates virtual environment. ``` -* **File paths need to be updated to `'os.path.join(sys._MEIPASS, )'`.** ### Basic Script Template ```python diff --git a/index.html b/index.html index 6391334..6324e2e 100644 --- a/index.html +++ b/index.html @@ -54,7 +54,7 @@
- +
@@ -1805,9 +1805,9 @@ first_element = op.methodcaller('pop', Bitwise operators require objects to have and(), or() and xor() special methods, unlike logical operators that work on all types of objects.
  • Also: '<bool> = <bool> &|^ <bool>' and '<int> = <bool> &|^ <int>'.
  • -

    #Introspection

    <list> = dir()                             # Names of local variables (incl. functions).
    -<dict> = vars()                            # Dict of local variables. Also locals().
    -<dict> = globals()                         # Dict of global variables.
    +

    #Introspection

    <list> = dir()                             # Names of local variables, functions, classes, etc.
    +<dict> = vars()                            # Dict of local variables, etc. Also locals().
    +<dict> = globals()                         # Dict of global vars, etc. (incl. '__builtins__').
     

    Attributes

    <list> = dir(<object>)                     # Names of object's attributes (incl. methods).
    @@ -2886,16 +2886,14 @@ cdef <ctype/void> <func_name>(<ctype> <arg_name>): ...
     
    cdef enum <enum_name>: <member_name>, <member_name>, ...
     
    -

    PyInstaller

    $ pip3 install pyinstaller
    -$ pyinstaller script.py                        # Compiles into './dist/script' directory.
    -$ pyinstaller script.py --onefile              # Compiles into './dist/script' console app.
    -$ pyinstaller script.py --windowed             # Compiles into './dist/script' windowed app.
    -$ pyinstaller script.py --add-data '<path>:.'  # Adds file to the root of the executable.
    +

    Virtual Environments

    System for installing libraries directly into project's directory.

    $ python3 -m venv <name>      # Creates virtual environment in current directory.
    +$ source <name>/bin/activate  # Activates venv. On Windows run `<name>\Scripts\activate`.
    +$ pip3 install <library>      # Installs the library into active environment.
    +$ python3 <path>              # Runs the script in active environment. Also `./<path>`.
    +$ deactivate                  # Deactivates virtual environment.
     
    -
      -
    • File paths need to be updated to 'os.path.join(sys._MEIPASS, <path>)'.
    • -
    +

    Basic Script Template

    #!/usr/bin/env python3
     #
     # Usage: .py
    @@ -2932,7 +2930,7 @@ $ pyinstaller script.py --add-data '<path>:.'