Skip to content

Commit

Permalink
Merge pull request #19 from caffeine-addictt/dev
Browse files Browse the repository at this point in the history
v0.1.3
  • Loading branch information
caffeine-addictt authored Dec 10, 2023
2 parents e176e27 + e437d49 commit 8a95b01
Show file tree
Hide file tree
Showing 18 changed files with 284 additions and 134 deletions.
Binary file modified .coverage
Binary file not shown.
7 changes: 5 additions & 2 deletions .github/workflows/test-worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U coverage pytest pytest-cov
python -m pip install -U coverage pytest pytest-cov poetry
python -m poetry install
python -m poetry self add poetry-plugin-export
python -m poetry export -f requirements.txt --output requirements.txt
python -m pip install -r requirements.txt
- name: Lint with Ruff
run: |
python -m pip install -U ruff
ruff -v --per-file-ignores="__init__.py:F401" .
ruff --per-file-ignores="__init__.py:F401" --per-file-ignores="__init__.py:E402" .
continue-on-error: true

- name: Test with pytest
Expand Down
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@


<!-- PROJECT SHIELDS -->
<!--
*** I'm using markdown "reference style" links for readability.
*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
*** See the bottom of this document for the declaration of the reference variables
*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
*** https://www.markdownguide.org/basic-syntax/#reference-style-links
-->
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![BSD-3-Clause License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]
<div align="center">

<a href="[contributors-url]">[![Contributors][contributors-shield]][contributors-url]</a>
<a href="[forks-url]">[![Forks][forks-shield]][forks-url]</a>
<a href="[stars-url]">[![Stargazers][stars-shield]][stars-url]</a>
<a href="[issues-url]">[![Issues][issues-shield]][issues-url]</a>
<a href="[license-url]">[![BSD-3-Clause License][license-shield]][license-url]</a>
<a href="[linkedin-url]">[![LinkedIn][linkedin-shield]][linkedin-url]</a>

</div>

<!-- PROJECT LOGO -->
<br />
Expand Down Expand Up @@ -94,11 +91,11 @@ Our docs are [here!](/docs/getting-started.md)
<!-- ROADMAP -->
## Roadmap

- [x] Bug fixes
- [x] Set Thread class to inherit from threading.Thread
- [x] Add kill method
- [x] Docs Update
- [ ] v0.1.2 Release
- [x] v0.1.3 Release
- [ ] Bug fixes
- [ ] New features
- [ ] Testing
- [ ] Next release...

See the [open issues](https://github.com/caffeine-addictt/thread/issues) for a full list of proposed features (and known issues).

Expand Down Expand Up @@ -138,6 +135,8 @@ Distributed under the BSD-3-Clause License. See `LICENSE.txt` for more informati

Alex - [email protected]

Project Board: https://github.com/users/caffeine-addictt/projects/5

Project Link: [https://github.com/caffeine-addictt/thread](https://github.com/caffeine-addictt/thread)

<p align="right">(<a href="#readme-top">back to top</a>)</p>
Expand Down
39 changes: 32 additions & 7 deletions docs/command-line.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ I will lay out how to use the comamnd line!
<details>
<summary>Jump to</summary>
<ul>
<li><a href='#importing-the-class'> Import the class</a></li>
<li><a href='#initializing-a-thread'> Initialize a thread </a></li>
<li><a href='#parameters'> Parameters </a></li>
<li><a href='#attributes'> Attributes </a></li>
<li><a href='#methods'> Class Methods </a></li>
<li><a href='#behviours'> Behaviours </a></li>
<li><a href='#getting-started'> Getting Started </a></li>
<li><a href='#log-levels'> Log Levels </a></li>
<li><a href='#commands'> Commands </a></li>
<details>
<summary>List</summary>
<ul>
<li><a href='#documentation-thread-docs'> thread docs </a></li>
<li><a href='#help-thread-help'> thread help </a></li>
<li><a href='#report-thread-report'> thread report </a></li>
<li><a href='#configuration-thread-config'> thread config </a></li>
<li><a href='#parallel-processing-thread-process'> thread process ... </a></li>
</ul>
</details>
</ul>

</details>


Expand Down Expand Up @@ -58,6 +66,9 @@ List of commands

### Documentation (thread docs)

```sh
$ thread docs
```
Ran with no arguments and options, this command will attempt to open your brower to this MD file!
<br />
If unable, will instead print out the link.
Expand All @@ -67,6 +78,9 @@ If unable, will instead print out the link.

### Help (thread help)

```sh
$ thread help
```
Ran with no arguments and options, this command will attempt to open your brower to the issue tracker!
<br />
If unable, will instead print out the link.
Expand All @@ -76,6 +90,9 @@ If unable, will instead print out the link.

### Report (thread report)

```sh
$ thread report
```
Ran with no arguments and options, this command will attempt to open your brower to this MD file!
<br />
If unable, will instead print out the link.
Expand All @@ -85,6 +102,9 @@ If unable, will instead print out the link.

### Configuration (thread config ...)

```sh
$ thread config
```
Comming soon.


Expand All @@ -93,7 +113,11 @@ Comming soon.

### Parallel Processing (thread process ...)

```sh
$ thread process
```
Invokes the [parallel processing class](parallel-processing.md#importing-the-class)<br />
<br />

> **Help Command Output**
Expand All @@ -107,14 +131,15 @@ $ thread process 'lambda x: x**2' '[ i for i in range(1000) ]'
$ thread process home.Downloads.clean_data:clean ./dataset.csv -t 20
=> The same as:
from home.Downloads.clean_data import clean
dataset = open('dataset.csv', 'r')
dataset = open('./dataset.csv', 'r')

newProcess = ParallelProcess(
target = clean,
dataset = dataset,
max_threads = 20
)
newProcess.start()
dataset.close()

prints or writes to file the result
```
Expand Down
43 changes: 43 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Thread Configuration Documentation

I will lay out the configuration options!

<br />
<details>
<summary>Jump to</summary>
<ul>
<li><a href='#importing-the-class'> Import the class </a></li>
<li><a href='#graceful-exiting'> Graceful Exit </a></li>
</ul>
</details>


Don't have the thread library? [See here](./getting-started.md) for installing thread

---

## Importing the class

```py
from thread import Thread
```

<br />


## Graceful Exiting

```py
from thread import Settings

# Enable/Disable graceful exiting
Settings.set_graceful_exit(True)
Settings.set_graceful_exit(False)
```

<br />


Now you know the configuration options available!

[See here](./parallel-processing.md) for how to using the `thread.ParallelProcessing` class!
Binary file modified docs/images/process_help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/threading.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ I will lay out how to use the `thread.Thread` class!
<details>
<summary>Jump to</summary>
<ul>
<li><a href='#importing-the-class'> Import the class</a></li>
<li><a href='#importing-the-class'> Import the class </a></li>
<li><a href='#initializing-a-thread'> Initialize a thread </a></li>
<li><a href='#parameters'> Parameters </a></li>
<li><a href='#attributes'> Attributes </a></li>
Expand Down
56 changes: 28 additions & 28 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "thread"
version = "0.1.2"
version = "0.1.3"
description = "Threading module extension"
authors = ["Alex <[email protected]>"]
license = "BSD-3-Clause"
Expand All @@ -12,7 +12,7 @@ repository = "https://github.com/caffeine-addictt/thread"
documentation = "https://github.com/caffeine-addictt/thread/blob/main/docs/getting-started.md"
keywords = ["threading", "extension", "multiprocessing"]
classifiers = [
"Development Status :: 1 - Planning",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License"
]
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

4 changes: 3 additions & 1 deletion src/thread/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

from . import (
exceptions
)
)

from .utils import Settings
10 changes: 7 additions & 3 deletions src/thread/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
Import and config CLI commands
"""

__version__ = '0.1.2'
from ..config import logging, ColorLogger
__version__ = '0.1.3'
from ..utils.logging_config import logging, ColorLogger
logging.setLoggerClass(ColorLogger)


# Import #
from .base import cli_base as app
from .process import process as process_cli

app.command(name = 'process')(process_cli)
app.command(
name = 'process',
no_args_is_help = True,
context_settings = {'allow_extra_args': True}
)(process_cli)
Loading

0 comments on commit 8a95b01

Please sign in to comment.