Name | smb-path JSON |
Version |
0.5.1
JSON |
| download |
home_page | None |
Summary | pathlib-like Path object for smb protocol |
upload_time | 2025-01-24 09:02:46 |
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
[](https://pypi.org/project/smb-path)
[](https://pypi.org/project/smb-path)
[](https://opensource.org/licenses/MIT)
[](https://github.com/m-birke/smb-path/actions/workflows/test-smb-path.yml)
-----
**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`
- `mkdir`
- **NOTE:** param `mode` has currently no effect, it falls back to `755` !
- `rmdir`
- `unlink`
- `rename`
- `symlink_to`
- `replace`
Missing operations (throwing exception) with current version (and questionable whether all of them will come) are:
- `touch`
- `chmod`
- `hardlink_to`
- `glob`
- `resolve`
- Resolves symlinks and makes relative paths absolute, latter is useless for SmbPath
## 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.
## 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[](https://pypi.org/project/smb-path)\n[](https://pypi.org/project/smb-path)\n[](https://opensource.org/licenses/MIT)\n[](https://github.com/m-birke/smb-path/actions/workflows/test-smb-path.yml)\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`\n - and hence dependent funtions like `read_bytes`, etc.\n- `stat`\n - and hence dependent functions like `lstat`, `is_file`, `is_dir`, `exists`, etc.\n- `iterdir`\n- `mkdir`\n - **NOTE:** param `mode` has currently no effect, it falls back to `755` !\n- `rmdir`\n- `unlink`\n- `rename`\n- `symlink_to`\n- `replace`\n\nMissing operations (throwing exception) with current version (and questionable whether all of them will come) are:\n\n- `touch`\n- `chmod`\n- `hardlink_to`\n- `glob`\n- `resolve`\n - Resolves symlinks and makes relative paths absolute, latter is useless for SmbPath\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## 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.5.1",
"project_urls": {
"Changelog": "https://github.com/m-birke/smb-path/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/m-birke/smb-path#readme",
"Homepage": "https://github.com/m-birke/smb-path",
"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": "d649a70f4c313067a73826489b2cd081c5b8c56099e298c8c0454115b007244a",
"md5": "72d485b2039dbe1399eff22e85886742",
"sha256": "2c312bc0e788c1ee539d309a31f85f9e3ed94a7c6cd00d78f27e521c4bd74b02"
},
"downloads": -1,
"filename": "smb_path-0.5.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "72d485b2039dbe1399eff22e85886742",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6022,
"upload_time": "2025-01-24T09:02:46",
"upload_time_iso_8601": "2025-01-24T09:02:46.411346Z",
"url": "https://files.pythonhosted.org/packages/d6/49/a70f4c313067a73826489b2cd081c5b8c56099e298c8c0454115b007244a/smb_path-0.5.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-24 09:02:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "m-birke",
"github_project": "smb-path",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "smb-path"
}