Compare commits
16 Commits
f77fd3d6c9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 35dd01f7fe | |||
| 85a52f2ae4 | |||
| bd18a69862 | |||
| 122f1ef235 | |||
| ca5d0a1b6e | |||
| 2286b76664 | |||
| be1ed37f65 | |||
| cd61d42115 | |||
| 1381575476 | |||
| 5ec1bdd16a | |||
| c4ad6bed2e | |||
| 7d3fea659f | |||
| 1736992a79 | |||
| edea91ee8c | |||
| d7b8fef42f | |||
| f21db4cd33 |
+3
-1
@@ -2,4 +2,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.idea/
|
.idea/
|
||||||
/log
|
/log
|
||||||
/__pycache__
|
/__pycache__
|
||||||
|
/custom_lib.egg-info
|
||||||
|
.venv/
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## v1.0.4
|
||||||
|
- Modified if modules are not install, pass
|
||||||
|
- Moved `my_image/my_crawling.py`
|
||||||
|
- Added `__init__.py`
|
||||||
|
- Added `pyproject.toml` and `CHANGELOG/README.md`
|
||||||
|
- Modified `.gitignore`
|
||||||
|
|
||||||
|
## v1.0.3
|
||||||
|
- Added `my_crawling.py`
|
||||||
|
- Deleted `__pycache__`
|
||||||
|
|
||||||
|
## v1.0.2
|
||||||
|
- Modified print style
|
||||||
|
- Added my_image version and comment
|
||||||
|
- Added my_image function
|
||||||
|
- Added my image.py
|
||||||
|
|
||||||
|
## v1.0.1
|
||||||
|
- First commit
|
||||||
+32
-8
@@ -1,27 +1,51 @@
|
|||||||
__version__ = "1.0.2"
|
__version__ = "1.0.4"
|
||||||
|
|
||||||
# --- custom ---
|
# --- required modules ---
|
||||||
from custom_lib import my_file_config
|
from custom_lib import my_file_config
|
||||||
from custom_lib import my_logger
|
from custom_lib import my_logger
|
||||||
from custom_lib import my_uuid
|
from custom_lib import my_uuid
|
||||||
# 20260527 tak add my image
|
|
||||||
from custom_lib import my_image
|
|
||||||
|
|
||||||
MODULES = [
|
MODULES = [
|
||||||
my_file_config,
|
my_file_config,
|
||||||
my_logger,
|
my_logger,
|
||||||
my_uuid,
|
my_uuid,
|
||||||
my_image,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def print_versions():
|
# --- optional modules ---
|
||||||
for module in MODULES:
|
OPTIONAL_MODULES = []
|
||||||
|
MISSING_MODULES = []
|
||||||
|
|
||||||
|
def _try_import_optional(module_path):
|
||||||
|
try:
|
||||||
|
module = __import__(f"custom_lib.{module_path}", fromlist=["*"])
|
||||||
|
OPTIONAL_MODULES.append(module)
|
||||||
|
return True
|
||||||
|
except ImportError:
|
||||||
|
MISSING_MODULES.append(module_path.split(".")[1])
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
# 20260507 tak add my_image
|
||||||
|
_try_import_optional("image.my_image")
|
||||||
|
|
||||||
|
# 20260508 tak add my_crawling
|
||||||
|
_try_import_optional("crawling.my_crawling")
|
||||||
|
|
||||||
|
def print_modules():
|
||||||
|
for module in MODULES + OPTIONAL_MODULES:
|
||||||
version = getattr(module, "__version__", "unknown")
|
version = getattr(module, "__version__", "unknown")
|
||||||
print(f"# [MODULE] {module.__name__} v{version}")
|
print(f"# [MODULE] {module.__name__} v{version}")
|
||||||
|
|
||||||
|
def print_missing_modules():
|
||||||
|
for module in MISSING_MODULES:
|
||||||
|
print(f"# [MISSING] {module}")
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
print("\n" + "#" * 60)
|
print("\n" + "#" * 60)
|
||||||
print(f"# Custom_Lib v{__version__}")
|
print(f"# Custom_Lib v{__version__}")
|
||||||
print("=" * 60)
|
print("=" * 60)
|
||||||
print_versions()
|
|
||||||
|
print_modules()
|
||||||
|
print_missing_modules()
|
||||||
|
|
||||||
print("#" * 60)
|
print("#" * 60)
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
# Custom Lib
|
||||||
|
|
||||||
|
My Custom Python Library.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- File utility
|
||||||
|
- Logger
|
||||||
|
- UUID
|
||||||
|
- Image utility
|
||||||
|
- Crawling utility
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Python 3.9+
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Note
|
||||||
|
|
||||||
|
- Move `pyproject.toml` to the project directory.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
### Common
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pip install -e .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Image
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pip install -e .[image]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Crawling
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pip install -e .[crawling]
|
||||||
|
```
|
||||||
|
|
||||||
|
### All
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pip install -e .[all]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```python
|
||||||
|
from custom_lib import Custom_Lib as custom
|
||||||
|
|
||||||
|
custom.init()
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Modules
|
||||||
|
|
||||||
|
| Module | Description |
|
||||||
|
|----------------|------------------|
|
||||||
|
| my_file_config | File utility |
|
||||||
|
| my_logger | Logger |
|
||||||
|
| my_uuid | UUID |
|
||||||
|
| my_image | Image utility |
|
||||||
|
| my_crawling | Crawling utility |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Optional Dependencies
|
||||||
|
|
||||||
|
| Option | Packages |
|
||||||
|
|---|-----------------------|
|
||||||
|
| image | Pillow, OpenCV, Nump |
|
||||||
|
| crawling | Requests, BeautifulSoup |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```text
|
||||||
|
custom_lib/
|
||||||
|
├─ crawling/
|
||||||
|
│ └─ __init__.py
|
||||||
|
│ └─ my_crawling.py
|
||||||
|
├─ image/
|
||||||
|
│ └─ __init__.py
|
||||||
|
│ └─ my_image.py
|
||||||
|
├─ __init__.py
|
||||||
|
├─ CHANGELOG.md
|
||||||
|
├─ Custom_Lib.py
|
||||||
|
├─ my_file_config.py
|
||||||
|
├─ my_logger.py
|
||||||
|
├─ my_uuid.py
|
||||||
|
├─ pyproject.toml
|
||||||
|
└─ README.md
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Version
|
||||||
|
|
||||||
|
### v1.0.4
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
|||||||
|
__version__ = "1.0.0"
|
||||||
|
|
||||||
|
# --- package ---
|
||||||
|
# --- crawling ---
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
from urllib import request
|
||||||
|
|
||||||
|
def get_lxml(target_url):
|
||||||
|
request_url = request.urlopen(target_url)
|
||||||
|
bs = BeautifulSoup(request_url, "lxml", from_encoding='utf-8')
|
||||||
|
|
||||||
|
return bs
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,33 @@
|
|||||||
|
[project]
|
||||||
|
name = "custom_lib"
|
||||||
|
version = "1.0.4"
|
||||||
|
description = "My Custom Python Library"
|
||||||
|
requires-python = ">=3.9"
|
||||||
|
|
||||||
|
# --- required ---
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
# --- optional ---
|
||||||
|
[project.optional-dependencies]
|
||||||
|
image = [
|
||||||
|
"webcolors==1.13",
|
||||||
|
"pillow==9.4.0",
|
||||||
|
"opencv-contrib-python==4.5.2.52",
|
||||||
|
"numpy<2"
|
||||||
|
]
|
||||||
|
crawling = [
|
||||||
|
"requests==2.26.0",
|
||||||
|
"beautifulsoup4==4.11.2"
|
||||||
|
]
|
||||||
|
all = [
|
||||||
|
"webcolors==1.13",
|
||||||
|
"pillow==9.4.0",
|
||||||
|
"opencv-contrib-python==4.5.2.52",
|
||||||
|
"numpy<2",
|
||||||
|
"requests==2.26.0",
|
||||||
|
"beautifulsoup4==4.11.2"
|
||||||
|
]
|
||||||
|
|
||||||
|
# --- path ---
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["custom_lib*"]
|
||||||
Reference in New Issue
Block a user