semvec/pypi-packages huggingface dataset:
pyinspectx 0.0.1
A simple tool to help you debug and see all the final values of the variables in every scope.
Keywords: python,debugging,debugger,variables,scope,local


# PyInspectX

A simple Python package to access all variables, per scope after a runtime. Can be used
for multiple purposes. (Ex: debugging, visual tool to highlight variables in runtime, ...)

## Installation

```bash
pip install pyinspectx
```

## Usage

The main class of the program is the ```Inspector``` class. This class can be used to inspect the variables inside the runtime.

> We start generating the modified code. This code can be run as you wish.
> The snippet below shows how to generate the modified code.

```python
from pyinspectx import Inspector

testCode = open(os.path.abspath(os.path.join(os.getcwd(), 'example.py')), 'r', encoding='utf-8').read()

inspector = PyInspectX.Inspector()
inspector.modify_code(testCode)

modified_code = inspector.get_modified_code()
print(modified_code)
```

> There is a built in method that generates a temp file inside the current working directory and runs the result for you. The output can be accessed inside a variable.

```python
from pyinspectx import Inspector

testCode = open(os.path.abspath(os.path.join(os.getcwd(), 'example.py')), 'r', encoding='utf-8').read()

inspector = PyInspectX.Inspector()
inspector.modify_code(testCode)

output = inspector.run_modified_code()
print(output)
```

**IMPORTANT: Do not run the code using __exec()__ or __eval()__! Wrong results will occur.**

Inside the ``./tests/`` folder you can find a few examples on how to use the package.

## TODO
- [ ] Add general (regex and keyword) support to block basic variable names inside the runtime.
- [x] Make injected variables names random.
- [ ] Make a better viewer for the raw data
- [ ] New JSON output format so it can be used for automation and testing.
- [ ] Find more edge cases
- [ ] Check for compatibility with other Python versions and systems.
- [ ] Setup Github action for pytest and flake8
db-migration-tool 0.1.1
A command line utility
Requires Python: >=3.7

# database-migration-tool

Database migration made simple.

## Database support

- MySQL
- SQLite

## Functions

### Validations

- Only run sql querys that has not been run before
- Checks that all checksum are same on installed and on the scripts
- New versions can't be inserted between two installed scripts

## Command line

```
<command> --changelog-file=config.yaml migrate
```

commands:

| command | Description |
| ------- | ----------- |
| clean   |             |
| info    |             |
| migrate |             |

## Changelog file

yaml file with changelog settings for the database migrations

example.yaml

```yaml
database:
  database_plugin: mysql
  host: localhost
  port: 3306
  username: ${env:MYSQL_USER}
  password: ${env:MYSQL_PASS}

xxxxxxxx:
  allow_clean: True

databaseMigrations:
  - changeSet: 1
    author: Mike <mike@email.com>
    changes:
    sqlFile: baseline.sql
  - changeSet: 2
    author: Matt <matt@email.com>
    changes:
    sqlFile: test.sql
    parameters:
      - userName: test
      - email: test@email.com
  - changeSet: 3
    author: Matt <matt@email.com>
    changes:
    scriptFile: test.py

parameters:
  - tableName: users
  - name: test
```

baseline.sql

```sql
--- sql with parameter inputs from changelog file
CREATE TABLE ${tableName} (
  name VARCHAR(30) NOT NULL,
  PRIMARY KEY(name)
);

INSERT INTO ${tableName} (name) VALUES ('${name}');

--- sql with parameter input from enviroment variables
CREATE TABLE ${env:TABLE_NAME} (
  test VARCHAR(10) NOT NULL,
  PRIMARY KEY(test)
);

--- normal sql
CREATE TABLE email (
  email VARCHAR(255) NOT NULL,
  PRIMARY KEY(email)
);
```

## Tables

### database-change-log

Table for tracking changes to the database

| Column       | Data type    | Description                               |
| ------------ | ------------ | ----------------------------------------- |
| id           | INT          | ID                                        |
| description  | VARCHAR(255) | description from the script               |
| script       | VARCHAR(255) | filename of the script                    |
| checksum     | VARCHAR(64)  | SHA256 checksum of the script file        |
| installed_on | TIMESTAMP    | date and time when successfully migrtated |
| total_querys | INT          | total sql querys in file                  |
| done_querys  | INT          | number of last successful query           |
| success      | INT          | 1 for success 0 for failure               |

### database-change-lock

Table for storing database lock to prevent only one instanse of xxx to be running against the database

| Column    | Data type    | Description                    |
| --------- | ------------ | ------------------------------ |
| id        | INT          | ID of the lock                 |
| locked    | INT          | 1 if locked otherwise 0        |
| granted   | DATETIME     | Date and time lock was granted |
| locked_by | VARCHAR(255) | DB username                    |