pyfilename


Namepyfilename JSON
Version 0.6.0.post1 PyPI version JSON
download
home_pageNone
SummaryMake names comply various filename constraints of Windows.
upload_time2024-10-12 10:02:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords file files windows
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyfilename

[![Sponsoring](https://img.shields.io/badge/Github_Sponsor-blue?logo=githubsponsors&logoColor=white&labelColor=gray)](https://github.com/sponsors/ilotoki0804)
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Filotoki0804%2Fpyfilename&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://github.com/ilotoki0804/pyfilename)
[![Coverage Status](https://coveralls.io/repos/github/ilotoki0804/pyfilename/badge.svg?branch=master)](https://coveralls.io/github/ilotoki0804/pyfilename?branch=master)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pyfilename)](https://pypi.org/project/pyfilename/)
[![image](https://img.shields.io/pypi/l/pyfilename.svg)](https://github.com/ilotoki0804/pyfilename/blob/main/LICENSE)
[![image](https://img.shields.io/pypi/pyversions/pyfilename.svg)](https://pypi.org/project/pyfilename/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/ilotoki0804/pyfilename/blob/main/pyproject.toml)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/ilotoki0804/pyfilename/blob/main/pyproject.toml)

**Make names comply various filename constraints of Windows.**

**윈도우의 복잡한 파일명 제한들을 만족시키는 안전한 이름을 만듭니다.**

윈도우는 POSIX 운영체제들과 달리 파일 이름에 매우 엄격한 제약이 있습니다.
pyfilename을 사용하면 제한된 문자를 제거하거나 전각 문자로 변환하여 기존 문자의 의미를 손상시키지 않고
윈도우에서 유효한 파일명을 생성해낼 수 있습니다.

> [!NOTE]
> 파일명과 폴더명은 같은 것이니 폴더명에도 안심하고 사용하세요.

## Installation

pip을 통해 이 프로젝트를 설치할 수 있습니다.

```console
pip install -U pyfilename
```

## Features

아래에서는 pyfilename에 있는 함수들을 간단히 설명합니다.

각 함수의 메소드나 자세한 기능에 대한 설명은 각 함수의 docstring을 참고하세요.

* `convert`: 안전한 파일명을 생성합니다.
* `revert`: 안전해진 파일명을 다시 원래 문자열로 되돌립니다.
* `is_safe`: 파일명이 안전하고 온전한지 확인합니다.
* `is_creatable`: 파일명이 '생성 가능한지' 확인합니다. 생성 시 파일명이 변경되는 것을 원하지 않으면 `is_safe`를 사용하세요.

## 예시

```python
>>> import pyfilename as pf
>>>
>>> pf.is_safe('hello_world?.txt')  # Character '?' is invalid to use in file name
False
>>> safe_name = pf.convert('hello_world?.txt')  # Convert to safe name
>>> safe_name
'hello_world?.txt'
>>> pf.is_safe(safe_name)  # Now it's True.
True
```

## 주의사항

* 백슬래시(\\)의 대안 문자(⧵, REVERSE SOLIDUS OPERATOR)는 윈도우 기본 zip 파일 제작기에서 입력되지 못합니다. [반디집](https://kr.bandisoft.com/bandizip/)과 같은 다른 zip파일 생성 툴을 이용하거나 fullwidth 모드 대신 다른 모드를 사용하세요.

## 비슷한 프로젝트

[pathvalidate](https://github.com/thombashi/pathvalidate)는 파일 경로 문자열을 검사합니다. 하지만 대체 문자를 사용하는 등의 기능은 없습니다.

## 파일명 길이

pyfilename은 전체 경로가 아닌 파일명을 확인하는 라이브러리이고, 윈도우에서는 최대 경로 길이를 조절할 수 있기 때문에 일반화가 어려워 모든 함수들에서 파일명 길이는 확인되지 않습니다.

## Relese Note

* 0.6.0 (2024/10/12): 빌드 현대화 및 기타 기능 및 문서 개선
* 0.5.1 (2024/04/15): 잘못 표기된 호환 버전 표시 수정
* _yanked_ 0.5.0 (2024/04/15): 현대화 및 전체적인 개선 및 오류 수정 >> 0.5.1 사용하세요!
* 0.2.0 (2023/09/10): 전체적인 구현 변경
* 0.1.0: 첫 릴리즈

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyfilename",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "file, files, windows",
    "author": null,
    "author_email": "ilotoki0804 <ilotoki0804@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/7f/1fb286878d92e6407fe1b275c7c555d8568b389f245ae9bbbd5672dc8d47/pyfilename-0.6.0.post1.tar.gz",
    "platform": null,
    "description": "# pyfilename\n\n[![Sponsoring](https://img.shields.io/badge/Github_Sponsor-blue?logo=githubsponsors&logoColor=white&labelColor=gray)](https://github.com/sponsors/ilotoki0804)\n[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Filotoki0804%2Fpyfilename&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://github.com/ilotoki0804/pyfilename)\n[![Coverage Status](https://coveralls.io/repos/github/ilotoki0804/pyfilename/badge.svg?branch=master)](https://coveralls.io/github/ilotoki0804/pyfilename?branch=master)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pyfilename)](https://pypi.org/project/pyfilename/)\n[![image](https://img.shields.io/pypi/l/pyfilename.svg)](https://github.com/ilotoki0804/pyfilename/blob/main/LICENSE)\n[![image](https://img.shields.io/pypi/pyversions/pyfilename.svg)](https://pypi.org/project/pyfilename/)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/ilotoki0804/pyfilename/blob/main/pyproject.toml)\n[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/ilotoki0804/pyfilename/blob/main/pyproject.toml)\n\n**Make names comply various filename constraints of Windows.**\n\n**\uc708\ub3c4\uc6b0\uc758 \ubcf5\uc7a1\ud55c \ud30c\uc77c\uba85 \uc81c\ud55c\ub4e4\uc744 \ub9cc\uc871\uc2dc\ud0a4\ub294 \uc548\uc804\ud55c \uc774\ub984\uc744 \ub9cc\ub4ed\ub2c8\ub2e4.**\n\n\uc708\ub3c4\uc6b0\ub294 POSIX \uc6b4\uc601\uccb4\uc81c\ub4e4\uacfc \ub2ec\ub9ac \ud30c\uc77c \uc774\ub984\uc5d0 \ub9e4\uc6b0 \uc5c4\uaca9\ud55c \uc81c\uc57d\uc774 \uc788\uc2b5\ub2c8\ub2e4.\npyfilename\uc744 \uc0ac\uc6a9\ud558\uba74 \uc81c\ud55c\ub41c \ubb38\uc790\ub97c \uc81c\uac70\ud558\uac70\ub098 \uc804\uac01 \ubb38\uc790\ub85c \ubcc0\ud658\ud558\uc5ec \uae30\uc874 \ubb38\uc790\uc758 \uc758\ubbf8\ub97c \uc190\uc0c1\uc2dc\ud0a4\uc9c0 \uc54a\uace0\n\uc708\ub3c4\uc6b0\uc5d0\uc11c \uc720\ud6a8\ud55c \ud30c\uc77c\uba85\uc744 \uc0dd\uc131\ud574\ub0bc \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n> [!NOTE]\n> \ud30c\uc77c\uba85\uacfc \ud3f4\ub354\uba85\uc740 \uac19\uc740 \uac83\uc774\ub2c8 \ud3f4\ub354\uba85\uc5d0\ub3c4 \uc548\uc2ec\ud558\uace0 \uc0ac\uc6a9\ud558\uc138\uc694.\n\n## Installation\n\npip\uc744 \ud1b5\ud574 \uc774 \ud504\ub85c\uc81d\ud2b8\ub97c \uc124\uce58\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.\n\n```console\npip install -U pyfilename\n```\n\n## Features\n\n\uc544\ub798\uc5d0\uc11c\ub294 pyfilename\uc5d0 \uc788\ub294 \ud568\uc218\ub4e4\uc744 \uac04\ub2e8\ud788 \uc124\uba85\ud569\ub2c8\ub2e4.\n\n\uac01 \ud568\uc218\uc758 \uba54\uc18c\ub4dc\ub098 \uc790\uc138\ud55c \uae30\ub2a5\uc5d0 \ub300\ud55c \uc124\uba85\uc740 \uac01 \ud568\uc218\uc758 docstring\uc744 \ucc38\uace0\ud558\uc138\uc694.\n\n* `convert`: \uc548\uc804\ud55c \ud30c\uc77c\uba85\uc744 \uc0dd\uc131\ud569\ub2c8\ub2e4.\n* `revert`: \uc548\uc804\ud574\uc9c4 \ud30c\uc77c\uba85\uc744 \ub2e4\uc2dc \uc6d0\ub798 \ubb38\uc790\uc5f4\ub85c \ub418\ub3cc\ub9bd\ub2c8\ub2e4.\n* `is_safe`: \ud30c\uc77c\uba85\uc774 \uc548\uc804\ud558\uace0 \uc628\uc804\ud55c\uc9c0 \ud655\uc778\ud569\ub2c8\ub2e4.\n* `is_creatable`: \ud30c\uc77c\uba85\uc774 '\uc0dd\uc131 \uac00\ub2a5\ud55c\uc9c0' \ud655\uc778\ud569\ub2c8\ub2e4. \uc0dd\uc131 \uc2dc \ud30c\uc77c\uba85\uc774 \ubcc0\uacbd\ub418\ub294 \uac83\uc744 \uc6d0\ud558\uc9c0 \uc54a\uc73c\uba74 `is_safe`\ub97c \uc0ac\uc6a9\ud558\uc138\uc694.\n\n## \uc608\uc2dc\n\n```python\n>>> import pyfilename as pf\n>>>\n>>> pf.is_safe('hello_world?.txt')  # Character '?' is invalid to use in file name\nFalse\n>>> safe_name = pf.convert('hello_world?.txt')  # Convert to safe name\n>>> safe_name\n'hello_world\uff1f.txt'\n>>> pf.is_safe(safe_name)  # Now it's True.\nTrue\n```\n\n## \uc8fc\uc758\uc0ac\ud56d\n\n* \ubc31\uc2ac\ub798\uc2dc(\\\\)\uc758 \ub300\uc548 \ubb38\uc790(\u29f5, REVERSE SOLIDUS OPERATOR)\ub294 \uc708\ub3c4\uc6b0 \uae30\ubcf8 zip \ud30c\uc77c \uc81c\uc791\uae30\uc5d0\uc11c \uc785\ub825\ub418\uc9c0 \ubabb\ud569\ub2c8\ub2e4. [\ubc18\ub514\uc9d1](https://kr.bandisoft.com/bandizip/)\uacfc \uac19\uc740 \ub2e4\ub978 zip\ud30c\uc77c \uc0dd\uc131 \ud234\uc744 \uc774\uc6a9\ud558\uac70\ub098 fullwidth \ubaa8\ub4dc \ub300\uc2e0 \ub2e4\ub978 \ubaa8\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc138\uc694.\n\n## \ube44\uc2b7\ud55c \ud504\ub85c\uc81d\ud2b8\n\n[pathvalidate](https://github.com/thombashi/pathvalidate)\ub294 \ud30c\uc77c \uacbd\ub85c \ubb38\uc790\uc5f4\uc744 \uac80\uc0ac\ud569\ub2c8\ub2e4. \ud558\uc9c0\ub9cc \ub300\uccb4 \ubb38\uc790\ub97c \uc0ac\uc6a9\ud558\ub294 \ub4f1\uc758 \uae30\ub2a5\uc740 \uc5c6\uc2b5\ub2c8\ub2e4.\n\n## \ud30c\uc77c\uba85 \uae38\uc774\n\npyfilename\uc740 \uc804\uccb4 \uacbd\ub85c\uac00 \uc544\ub2cc \ud30c\uc77c\uba85\uc744 \ud655\uc778\ud558\ub294 \ub77c\uc774\ube0c\ub7ec\ub9ac\uc774\uace0, \uc708\ub3c4\uc6b0\uc5d0\uc11c\ub294 \ucd5c\ub300 \uacbd\ub85c \uae38\uc774\ub97c \uc870\uc808\ud560 \uc218 \uc788\uae30 \ub54c\ubb38\uc5d0 \uc77c\ubc18\ud654\uac00 \uc5b4\ub824\uc6cc \ubaa8\ub4e0 \ud568\uc218\ub4e4\uc5d0\uc11c \ud30c\uc77c\uba85 \uae38\uc774\ub294 \ud655\uc778\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.\n\n## Relese Note\n\n* 0.6.0 (2024/10/12): \ube4c\ub4dc \ud604\ub300\ud654 \ubc0f \uae30\ud0c0 \uae30\ub2a5 \ubc0f \ubb38\uc11c \uac1c\uc120\n* 0.5.1 (2024/04/15): \uc798\ubabb \ud45c\uae30\ub41c \ud638\ud658 \ubc84\uc804 \ud45c\uc2dc \uc218\uc815\n* _yanked_ 0.5.0 (2024/04/15): \ud604\ub300\ud654 \ubc0f \uc804\uccb4\uc801\uc778 \uac1c\uc120 \ubc0f \uc624\ub958 \uc218\uc815 >> 0.5.1 \uc0ac\uc6a9\ud558\uc138\uc694!\n* 0.2.0 (2023/09/10): \uc804\uccb4\uc801\uc778 \uad6c\ud604 \ubcc0\uacbd\n* 0.1.0: \uccab \ub9b4\ub9ac\uc988\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Make names comply various filename constraints of Windows.",
    "version": "0.6.0.post1",
    "project_urls": {
        "Funding": "https://github.com/sponsors/ilotoki0804",
        "Repository": "https://github.com/ilotoki0804/pyfilename"
    },
    "split_keywords": [
        "file",
        " files",
        " windows"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ba0860a5fe1819e0243e5c221177932b0f9e0ada982e920b5cd37bf95d444e3a",
                "md5": "d94c04b543b858d77182bc1d8fac418f",
                "sha256": "8fc82883f4d72581038490a4e286633b7902f6b065ce652dfc79d03b6c4f0a7f"
            },
            "downloads": -1,
            "filename": "pyfilename-0.6.0.post1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d94c04b543b858d77182bc1d8fac418f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8706,
            "upload_time": "2024-10-12T10:02:11",
            "upload_time_iso_8601": "2024-10-12T10:02:11.175197Z",
            "url": "https://files.pythonhosted.org/packages/ba/08/60a5fe1819e0243e5c221177932b0f9e0ada982e920b5cd37bf95d444e3a/pyfilename-0.6.0.post1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cb7f1fb286878d92e6407fe1b275c7c555d8568b389f245ae9bbbd5672dc8d47",
                "md5": "a2c0679564ab341e11960261d3bdf1f3",
                "sha256": "4fecb8d0474a16a169a0b292d340d3a0c3e2569efa53feb720ed358c14cc99c6"
            },
            "downloads": -1,
            "filename": "pyfilename-0.6.0.post1.tar.gz",
            "has_sig": false,
            "md5_digest": "a2c0679564ab341e11960261d3bdf1f3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 47263,
            "upload_time": "2024-10-12T10:02:13",
            "upload_time_iso_8601": "2024-10-12T10:02:13.674576Z",
            "url": "https://files.pythonhosted.org/packages/cb/7f/1fb286878d92e6407fe1b275c7c555d8568b389f245ae9bbbd5672dc8d47/pyfilename-0.6.0.post1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-12 10:02:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sponsors",
    "github_project": "ilotoki0804",
    "github_not_found": true,
    "lcname": "pyfilename"
}
        
Elapsed time: 0.43302s