Name | smb-path JSON |
Version |
0.4.0
JSON |
| download |
home_page | None |
Summary | pathlib-like Path object for smb protocol |
upload_time | 2023-10-20 10:14:49 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | None |
keywords |
fileshare
path
smb
smbv2
smbv3
pathlib
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# smb-path
[![PyPI - Version](https://img.shields.io/pypi/v/smb-path.svg)](https://pypi.org/project/smb-path)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/smb-path.svg)](https://pypi.org/project/smb-path)
-----
**Table of Contents**
- [About](#about)
- [Installation](#installation)
- [Usage](#usage)
- [Compatibility](#compatibility)
- [License](#license)
## About
Many tools make use of `pathlib.Path` internally. This is a problem if the files are located on a fileshare. `smb-path` provides wrapper of `Path` which acts accordingly but using the SMB protocol for file operations instead of the local hosts file system. Atm. `smb-path` focuses on pure reading of the data. The SMB protocol implementation of [smbprotocol](https://pypi.org/project/smbprotocol/) is used.
All the utility functions of `Path` should work for `SmbPath` as well (like the `/` operator, `with_suffix`, `parents`, etc.).
Currently the following SMB dependent functions are implemented:
- `open` (and hence dependent funtions like `read_bytes`, etc.)
- `stat` (and hence dependent functions like `lstat`, `is_file`, `is_dir`, `exists`, etc.)
- `iterdir`
In future versions, some functions probably get overwritten with a dummy since functions like `resolve` have no use for a SMB path.
Missing write operations with current version (and questionable whether all of them will come) are:
- `touch`
- `mkdir`
- `rmdir`
- `chmod`
- `unlink`
- `rename`
- `replace`
- `symlink_to`
- `hardlink_to`
## Installation
```console
pip install smb-path
```
## Usage
`smb-path` just needs to be installed. After the installation, you just use `Path()` to instantiate a `SmbPath`. It is checked whether the provided path string applies to the regex pattern `r"(//|\\\\)([a-z0-9]+)((\.[a-z0-9]+)*)(\.[a-z]+){1}"`.
The path string
- must start with `//` or `\\`
- must continue with a server name, a-z and 0-9 allowed, eg. `filshr33`
- optionally an arbitrary number of periods separated by a `.`, a-z and 0-9 allowed, eg. `.us.dieterscompany`
- must continue with an url closing with `.` then a-z, eg. `.com`
- can contain trailing fileshare names, directories or files, eg. `/myShare/myDir/myFile.txt`
Hence `//filshr33.us.dieterscompany.com/myShare/myDir/myFile.txt` would be a valid SMB path.
**If the pattern does not match, a `Path` object like you are used to it is returned** (`WindowsPath` or `PosixPath`).
### SMB Configuration
Use `smbclient.ClientConfig` to configure the SMB connection. Eg. `smbclient.ClientConfig(username="itsme", password="myPW")`. Refer to [smbprotocol](https://pypi.org/project/smbprotocol/) for further information.
## Compatibility
`smbprotocol` is platform agnostic since it does not care about the path separator.
Tested with installation into a `python -m venv` virtual environment.
| OS | Python | Supported |
| ------- | ------------------------- | --------- |
| Windows | 3.11 | ✅ |
| Windows | 3.7, 3.8, 3.9, 3.10 | ❓ |
| Windows | 3.12 | ❌ |
| Linux | 3.7, 3.8, 3.9, 3.10, 3.11 | ✅ |
| Linux | 3.12 | ❌ |
## License
`smb-path` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Raw data
{
"_id": null,
"home_page": null,
"name": "smb-path",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "Fileshare,Path,SMB,SMBv2,SMBv3,pathlib",
"author": null,
"author_email": "Birkenbach Marius <wesci@web.de>",
"download_url": null,
"platform": null,
"description": "# smb-path\n\n[![PyPI - Version](https://img.shields.io/pypi/v/smb-path.svg)](https://pypi.org/project/smb-path)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/smb-path.svg)](https://pypi.org/project/smb-path)\n\n-----\n\n**Table of Contents**\n\n- [About](#about)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Compatibility](#compatibility)\n- [License](#license)\n\n## About\n\nMany tools make use of `pathlib.Path` internally. This is a problem if the files are located on a fileshare. `smb-path` provides wrapper of `Path` which acts accordingly but using the SMB protocol for file operations instead of the local hosts file system. Atm. `smb-path` focuses on pure reading of the data. The SMB protocol implementation of [smbprotocol](https://pypi.org/project/smbprotocol/) is used.\n\nAll the utility functions of `Path` should work for `SmbPath` as well (like the `/` operator, `with_suffix`, `parents`, etc.).\n\nCurrently the following SMB dependent functions are implemented:\n\n- `open` (and hence dependent funtions like `read_bytes`, etc.)\n- `stat` (and hence dependent functions like `lstat`, `is_file`, `is_dir`, `exists`, etc.)\n- `iterdir`\n\nIn future versions, some functions probably get overwritten with a dummy since functions like `resolve` have no use for a SMB path.\n\nMissing write operations with current version (and questionable whether all of them will come) are:\n\n- `touch`\n- `mkdir`\n- `rmdir`\n- `chmod`\n- `unlink`\n- `rename`\n- `replace`\n- `symlink_to`\n- `hardlink_to`\n\n## Installation\n\n```console\npip install smb-path\n```\n\n## Usage\n\n`smb-path` just needs to be installed. After the installation, you just use `Path()` to instantiate a `SmbPath`. It is checked whether the provided path string applies to the regex pattern `r\"(//|\\\\\\\\)([a-z0-9]+)((\\.[a-z0-9]+)*)(\\.[a-z]+){1}\"`.\n\nThe path string\n\n- must start with `//` or `\\\\`\n- must continue with a server name, a-z and 0-9 allowed, eg. `filshr33`\n- optionally an arbitrary number of periods separated by a `.`, a-z and 0-9 allowed, eg. `.us.dieterscompany`\n- must continue with an url closing with `.` then a-z, eg. `.com`\n- can contain trailing fileshare names, directories or files, eg. `/myShare/myDir/myFile.txt`\n\nHence `//filshr33.us.dieterscompany.com/myShare/myDir/myFile.txt` would be a valid SMB path.\n\n**If the pattern does not match, a `Path` object like you are used to it is returned** (`WindowsPath` or `PosixPath`).\n\n### SMB Configuration\n\nUse `smbclient.ClientConfig` to configure the SMB connection. Eg. `smbclient.ClientConfig(username=\"itsme\", password=\"myPW\")`. Refer to [smbprotocol](https://pypi.org/project/smbprotocol/) for further information.\n\n## Compatibility\n\n`smbprotocol` is platform agnostic since it does not care about the path separator.\n\nTested with installation into a `python -m venv` virtual environment.\n\n| OS | Python | Supported |\n| ------- | ------------------------- | --------- |\n| Windows | 3.11 | \u2705 |\n| Windows | 3.7, 3.8, 3.9, 3.10 | \u2753 |\n| Windows | 3.12 | \u274c |\n| Linux | 3.7, 3.8, 3.9, 3.10, 3.11 | \u2705 |\n| Linux | 3.12 | \u274c |\n\n## License\n\n`smb-path` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
"bugtrack_url": null,
"license": null,
"summary": "pathlib-like Path object for smb protocol",
"version": "0.4.0",
"project_urls": {
"Documentation": "https://github.com/m-birke/smb-path#readme",
"Issues": "https://github.com/m-birke/smb-path/issues",
"Source": "https://github.com/m-birke/smb-path"
},
"split_keywords": [
"fileshare",
"path",
"smb",
"smbv2",
"smbv3",
"pathlib"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9105b510684e7136ecb98dab2fa46dd3ba65075db7b62f2c1c046c3086d56b6e",
"md5": "e4a0c3409202bb4f3727e87d2b77685a",
"sha256": "c044a1a6377f80aada1b149d332604674e3f4c6d3fc7dffe52bd36e93f69fae0"
},
"downloads": -1,
"filename": "smb_path-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e4a0c3409202bb4f3727e87d2b77685a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5268,
"upload_time": "2023-10-20T10:14:49",
"upload_time_iso_8601": "2023-10-20T10:14:49.832574Z",
"url": "https://files.pythonhosted.org/packages/91/05/b510684e7136ecb98dab2fa46dd3ba65075db7b62f2c1c046c3086d56b6e/smb_path-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-20 10:14:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "m-birke",
"github_project": "smb-path#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "smb-path"
}