semvec/pypi-packages huggingface dataset:
jsonlogger 1.0.0
A simple json logger for Python
Requires Python: >=3.6

# 📖 A Python json-logger

A simple way to log data to json-files from within your code.

## Installation

You can use the python package manager (`pip`) to install the file-logger:

```bash
pip install jsonlogger
```

## Usage

Create a `LogWriter`:

```python
from jsonlogger.logger import LogWriter

writer = LogWriter(folder="./", filename="log.json", threshold=10)
```

Log data to the logfile:

```python
writer.log({"key_int": 1,
            "key_string": "logger",
            "key_boolean": True,
            "key_double": 1.337,
            "key_list": ["element1", "element2"],
            "key_none": None})
```

Create a `LogReader`:

```python
from jsonlogger.logger import LogReader

reader = LogReader(folder="./", filename="log.json")
```

Read data from the logfile:

```python
data = reader.retrieve()
```

Other methods:

| Class |  Method  | Explanation |
|:-----|:--------|:------|
| LogReader, LogWriter | `.reset()` | This method clears the contents of the logfile. |
| LogReader, LogWriter | `.remove()` | This methode removes the logfile. |
| LogWriter | `.with_datetime(folder: str, threshold: int)` | This method creates a logfile in the folder with the current timestamp as filename. |
| LogWriter | `.log(data)` | This method logs the data (dictionary) in the logfile. |
| LogWriter | `.flush()` | This method flushes the buffer in the writer. The threshold of the buffer is given in the constructor |
| LogReader | `.retrieve()` | This method retrieves all the data from the logfile and returns it as a list of dictionaries. |

## Example usage

An example of how to use this logger is given. Imagine one has created a [major breakthrough AI system](https://i.pinimg.com/originals/ae/fb/01/aefb01c27ddfdfa2cef723f5056252f7.jpg) that still has to be trained. 
During training one want's to keep an eye on the performance of the progress. To do this, the LogWriter can be added in the learning iterations (e.g. in one Jupyter notebook). 
In another process (e.g. in another Jupyter notebook) it is then possible to read in the data and make amazing visualisations (yay, visualisations!) of how your breakthrough model is performing...

```python
from jsonlogger.logger import LogWriter

writer = LogWriter.with_datetime(folder="./", threshold=10)

super_great_ai_model = ...
iteration = 0
while iteration < 100_000:
    score, other_data = super_great_ai_model.do_iteration()
    writer.log({
        score: score,
        other_data: other_data
    })
writer.flush()
```

```python
from jsonlogger.logger import LogReader
import glob

logs_files = sorted(glob.glob("./[0-9]*.json"))
reader = LogReader(folder="./", filename=logs_files[-1])

data = reader.retrieve()

# Make awesome visualisations!
...
```

There may also be other use cases, you can use this logger as you want!

## Tests

You can run the tests yourselves by:

```bash
cd tests
pip3 install -r requirements.txt
pytest
```

## License

This software is licensed under the [MIT](LICENSE) license.

## Bugs/ Ideas?

In case of questions, ideas or bugs you can always create an issue or [contact me](https://mdebuck.org).
pacmine 1.2.3
Simple package manager-esque mod manager for Minecraft
Requires Python: >=3.9,<4.0

# Pacmine
[![python](https://img.shields.io/pypi/pyversions/minecraft-mod-manager.svg)](https://pypi.org/project/pacmine/1.2.2/)
[![Latest PyPI version](https://img.shields.io/pypi/v/minecraft-mod-manager.svg)](https://pypi.org/project/pacmine/1.2.2/)

![](https://i.imgur.com/ciTThKT.png)

Pacmine makes use of various icons/glyphs from the [NerdFonts](https://www.nerdfonts.com/) collection, so any patched fonts are highly recommended. I personally use Fira Code, but you've got options. Full-color terminals are also recommended -- Windows users can use the [new terminal](https://github.com/microsoft/terminal).  

## Installation
### [pipx](https://github.com/pypa/pipx) (Recommended)
`pipx install pacmine`

### Python
`python -m pip install --user pacmine`

Make sure to add pacmine to your path if user/pipx scripts aren't already.

## Usage
Each command should be prefaced with `pacmine`. Arguments are shown as `{argument_name}`. Arguments with ellipses like `{mods...}` indicate a variable (≥ 1) number of arguments. 

| Command | Description |
| ------ | ------ |
| `add {slugs...}` | Adds 1 or more mods to the local repository, specified by their slugs. Mods cannot be installed multiple times. If you don't know the slug(s), use `search` first.  |
| `remove {slugs...}` | Removes 1 or more mods from the local repository, specified by their slugs. Mods cannot be removed multiple times, nor removed if they are not installed. If you don't know the slug(s), use `list` first. |
| `update` | Checks for and installs any updates to currently installed mods.  | 
| `search {search_term}` | Searches remote repositories and lists any matches to `{search_term}`. | 
| `list` | Lists locally installed mods. |
| `dump` | Dumps a string of slugs for all locally installed mods. Useful with `add` for migrating your mods to another location. | 
| `new {version} {modloader}` | Creates a repository in the current directory for version `{version}` using the `{modloader}` mod loader. It does this with a file called `mods.pkl`, which you shouldn't rename or delete. | 
| `info` | Prints information about pacmine and the local repository, if it exists. | 

Try to avoid deleting files manually from directories managed by pacmine, if possible — pacmine doesn't watch directories to see changes, so it'll become out of sync.