# `miarec_smbfs` SMB filesystem for PyFilesystem2
[![Actions](https://img.shields.io/github/actions/workflow/status/miarec/miarec_smbfs/test_and_release.yml?branch=master&logo=github&style=flat-square&maxAge=300)](https://github.com/miarec/miarec_smbfs/actions)
[![License](https://img.shields.io/pypi/l/fs.smbfs.svg?style=flat-square&maxAge=300)](https://choosealicense.com/licenses/mit/)
This is a fork of [fs.smbfs](https://github.com/althonos/fs.smbfs)
The code was modified by MiaRec team to fullfill our needs.
## Notable differences between miarec_s3fs and fs-s3fs
1. Requires Python 3.7+. A support of older version of Python was removed.
2. The opener protocol prefix is `msmb://` (instead of the original `smb://`)
## Requirements
| **PyFilesystem2** | [![PyPI fs](https://img.shields.io/pypi/v/fs.svg?maxAge=300&style=flat-square)](https://pypi.python.org/pypi/fs) | [![Source fs](https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=36000&style=flat-square)](https://github.com/PyFilesystem/pyfilesystem2) | [![License fs](https://img.shields.io/pypi/l/fs.svg?maxAge=36000&style=flat-square)](https://choosealicense.com/licenses/mit/) |
|:-|:-|:-|:-|
| **six** | [![PyPI six](https://img.shields.io/pypi/v/six.svg?maxAge=300&style=flat-square)](https://pypi.python.org/pypi/six) | [![Source six]( https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=36000&style=flat-square )]( https://github.com/benjaminp/six) | [![License six](https://img.shields.io/pypi/l/six.svg?maxAge=36000&style=flat-square)](https://choosealicense.com/licenses/mit/) |
| **PySMB** | [![PyPI pysmb](https://img.shields.io/pypi/v/pysmb.svg?maxAge=300&style=flat-square)](https://pypi.python.org/pypi/pysmb) | [![Source pysmb]( https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=36000&style=flat-square )]( https://github.com/miketeo/pysmb) | [![License pysmb](https://img.shields.io/pypi/l/pysmb.svg?maxAge=36000&style=flat-square)](https://choosealicense.com/licenses/zlib/) |
`miarec_smbfs` supports Python versions 3.7+
## Installation
Install directly from PyPI, using [pip](https://pip.pypa.io/) :
```console
$ pip install miarec_smbfs
```
## Usage
### Opener
Use `fs.open_fs` to open a filesystem with an SMB [FS
URL](https://pyfilesystem2.readthedocs.io/en/latest/openers.html):
```python
import fs
smb_fs = fs.open_fs('msmb://username:password@SAMBAHOSTNAME:port/share')
```
The opener can use either an IPv4 address or a NetBIOS hostname, using the
[NetBIOS name service](https://en.wikipedia.org/wiki/NetBIOS#Name_service) to
find the other token. Otherwise, if NetBIOS is not available, a new SMB
connection can be established by using the IPv4 address and giving the
hostname with the `hostname` URL parameter.
The following parameters can be passed as URL parameters: `timeout`,
`name-port`, `direct-tcp`, `hostname`, and `domain`.
### Constructor
```python
import miarec_smbfs
smb_fs = miarec_smbfs.SMBFS(
host, username="guest", passwd="", timeout=15,
port=139, name_port=137, direct_tcp=False, domain=""
)
```
with each argument explained below:
- `host`: either the host name (*not* the [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name))
of the SMB server, its IP address, or both in a tuple.
*If either the IP address or the host name is not given, NETBIOS is queried to get the missing data.*
- `user`: the username to connect with, defaults to `"guest"` for anonymous
connection.
- `passwd`: an optional password to connect with, defaults to `""` for
anonymous connection.
- `timeout`: the timeout, in seconds, for NetBIOS and TCP requests.
- `port`: the port the SMB server is listening on.
- `name_port`: the port the NetBIOS naming service is listening on.
- `direct_tcp`: set to *True* if the server is accessible directly
through TCP, leave as *False* for maximum compatibility.
- `domain`: the network domain to connect with, i.e. the workgroup on
Windows. Usually safe to leave as empty string, the default.
Once created, the `SMBFS` filesystem behaves like any other filesystem
(see the [Pyfilesystem2 documentation](https://pyfilesystem2.readthedocs.io)),
except if it was open in the root directory of the server, in which case the
root directory of the `SMBFS` instance will be read-only (since SMB clients
cannot create new shares).
## Testing
Automated unit tests are run on [GitHub Actions](https://github.com/miarec/miarec_smbfs/actions)
To run the tests locally, do the following.
Install Docker on local machine.
Create activate python virtual environment:
python -m vevn venv
source venv\bin\activate
Install the project and test dependencies:
pip install -e ".[test]"
Run tests:
pytest
## Credits
`miarec_smbfs` is developed and maintained by [MiaRec](https://www.miarec.com)
The original code (`fs.smbfs`) was developed by:
- [Martin Larralde](https://github.com/althonos)
Raw data
{
"_id": null,
"home_page": "https://github.com/miarec/miarec_smbfs",
"name": "miarec-smbfs",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "filesystem,Pyfilesystem2,smb,cifs,samba",
"author": "MiaRec",
"author_email": "support@miarec.com",
"download_url": "https://files.pythonhosted.org/packages/f5/15/5b70bedc504e4090b2798c229a59614b5c69b299def4ed0c80d771f78da1/miarec_smbfs-2024.1.1.tar.gz",
"platform": "any",
"description": "# `miarec_smbfs` SMB filesystem for PyFilesystem2\n\n[![Actions](https://img.shields.io/github/actions/workflow/status/miarec/miarec_smbfs/test_and_release.yml?branch=master&logo=github&style=flat-square&maxAge=300)](https://github.com/miarec/miarec_smbfs/actions)\n[![License](https://img.shields.io/pypi/l/fs.smbfs.svg?style=flat-square&maxAge=300)](https://choosealicense.com/licenses/mit/)\n\n\nThis is a fork of [fs.smbfs](https://github.com/althonos/fs.smbfs)\n\nThe code was modified by MiaRec team to fullfill our needs.\n\n## Notable differences between miarec_s3fs and fs-s3fs\n\n1. Requires Python 3.7+. A support of older version of Python was removed.\n\n2. The opener protocol prefix is `msmb://` (instead of the original `smb://`)\n\n\n## Requirements\n\n| **PyFilesystem2** | [![PyPI fs](https://img.shields.io/pypi/v/fs.svg?maxAge=300&style=flat-square)](https://pypi.python.org/pypi/fs) | [![Source fs](https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=36000&style=flat-square)](https://github.com/PyFilesystem/pyfilesystem2) | [![License fs](https://img.shields.io/pypi/l/fs.svg?maxAge=36000&style=flat-square)](https://choosealicense.com/licenses/mit/) |\n|:-|:-|:-|:-|\n| **six** | [![PyPI six](https://img.shields.io/pypi/v/six.svg?maxAge=300&style=flat-square)](https://pypi.python.org/pypi/six) | [![Source six]( https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=36000&style=flat-square )]( https://github.com/benjaminp/six) | [![License six](https://img.shields.io/pypi/l/six.svg?maxAge=36000&style=flat-square)](https://choosealicense.com/licenses/mit/) |\n| **PySMB** | [![PyPI pysmb](https://img.shields.io/pypi/v/pysmb.svg?maxAge=300&style=flat-square)](https://pypi.python.org/pypi/pysmb) | [![Source pysmb]( https://img.shields.io/badge/source-GitHub-303030.svg?maxAge=36000&style=flat-square )]( https://github.com/miketeo/pysmb) | [![License pysmb](https://img.shields.io/pypi/l/pysmb.svg?maxAge=36000&style=flat-square)](https://choosealicense.com/licenses/zlib/) |\n\n`miarec_smbfs` supports Python versions 3.7+ \n\n## Installation\n\nInstall directly from PyPI, using [pip](https://pip.pypa.io/) :\n\n```console\n$ pip install miarec_smbfs\n```\n\n## Usage\n\n### Opener\n\nUse `fs.open_fs` to open a filesystem with an SMB [FS\nURL](https://pyfilesystem2.readthedocs.io/en/latest/openers.html):\n\n```python\nimport fs\nsmb_fs = fs.open_fs('msmb://username:password@SAMBAHOSTNAME:port/share')\n```\n\nThe opener can use either an IPv4 address or a NetBIOS hostname, using the\n[NetBIOS name service](https://en.wikipedia.org/wiki/NetBIOS#Name_service) to\nfind the other token. Otherwise, if NetBIOS is not available, a new SMB\nconnection can be established by using the IPv4 address and giving the\nhostname with the `hostname` URL parameter.\n\nThe following parameters can be passed as URL parameters: `timeout`,\n`name-port`, `direct-tcp`, `hostname`, and `domain`.\n\n\n### Constructor\n\n```python\nimport miarec_smbfs\nsmb_fs = miarec_smbfs.SMBFS(\n host, username=\"guest\", passwd=\"\", timeout=15,\n port=139, name_port=137, direct_tcp=False, domain=\"\"\n)\n```\n\nwith each argument explained below:\n\n- `host`: either the host name (*not* the [FQDN](https://en.wikipedia.org/wiki/Fully_qualified_domain_name))\n of the SMB server, its IP address, or both in a tuple.\n *If either the IP address or the host name is not given, NETBIOS is queried to get the missing data.*\n- `user`: the username to connect with, defaults to `\"guest\"` for anonymous\n connection.\n- `passwd`: an optional password to connect with, defaults to `\"\"` for\n anonymous connection.\n- `timeout`: the timeout, in seconds, for NetBIOS and TCP requests.\n- `port`: the port the SMB server is listening on.\n- `name_port`: the port the NetBIOS naming service is listening on.\n- `direct_tcp`: set to *True* if the server is accessible directly\n through TCP, leave as *False* for maximum compatibility.\n- `domain`: the network domain to connect with, i.e. the workgroup on\n Windows. Usually safe to leave as empty string, the default.\n\nOnce created, the `SMBFS` filesystem behaves like any other filesystem\n(see the [Pyfilesystem2 documentation](https://pyfilesystem2.readthedocs.io)),\nexcept if it was open in the root directory of the server, in which case the\nroot directory of the `SMBFS` instance will be read-only (since SMB clients\ncannot create new shares).\n\n## Testing\n\nAutomated unit tests are run on [GitHub Actions](https://github.com/miarec/miarec_smbfs/actions)\n\nTo run the tests locally, do the following.\n\nInstall Docker on local machine.\n\nCreate activate python virtual environment:\n\n python -m vevn venv\n source venv\\bin\\activate\n\nInstall the project and test dependencies:\n\n pip install -e \".[test]\"\n\nRun tests:\n\n pytest\n\n## Credits\n\n`miarec_smbfs` is developed and maintained by [MiaRec](https://www.miarec.com)\n\nThe original code (`fs.smbfs`) was developed by:\n- [Martin Larralde](https://github.com/althonos)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pyfilesystem2 over SMB using pysmb",
"version": "2024.1.1",
"project_urls": {
"Bug Tracker": "https://github.com/miarec/miarec_smbfs/issues",
"Builds": "https://github.com/miarec/miarec_smbfs/actions",
"Changelog": "https://github.com/miarec/miarec_smbfs/blob/master/CHANGELOG.md",
"Coverage": "https://codecov.io/gh/miarec/miarec_smbfs",
"Homepage": "https://github.com/miarec/miarec_smbfs"
},
"split_keywords": [
"filesystem",
"pyfilesystem2",
"smb",
"cifs",
"samba"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e26cfb08e72db74493034ed7d82cc610c3519c0f9d4f4958ab2dd583f1a7a10f",
"md5": "7b325ce968e8be5a5e0742c238b86820",
"sha256": "c026cf131201e1240cd9e2c7622e06c352ee85a15c81ce045fceb91c9cdcb9e4"
},
"downloads": -1,
"filename": "miarec_smbfs-2024.1.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "7b325ce968e8be5a5e0742c238b86820",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.7",
"size": 15173,
"upload_time": "2024-01-15T23:57:10",
"upload_time_iso_8601": "2024-01-15T23:57:10.235948Z",
"url": "https://files.pythonhosted.org/packages/e2/6c/fb08e72db74493034ed7d82cc610c3519c0f9d4f4958ab2dd583f1a7a10f/miarec_smbfs-2024.1.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f5155b70bedc504e4090b2798c229a59614b5c69b299def4ed0c80d771f78da1",
"md5": "c2a2a0d25348047123f234c8d962e069",
"sha256": "272fa4e817c4abf670d19f1af27037f5bb590c1e2b484ea78784b2076b7440b4"
},
"downloads": -1,
"filename": "miarec_smbfs-2024.1.1.tar.gz",
"has_sig": false,
"md5_digest": "c2a2a0d25348047123f234c8d962e069",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 18793,
"upload_time": "2024-01-15T23:57:12",
"upload_time_iso_8601": "2024-01-15T23:57:12.055541Z",
"url": "https://files.pythonhosted.org/packages/f5/15/5b70bedc504e4090b2798c229a59614b5c69b299def4ed0c80d771f78da1/miarec_smbfs-2024.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-15 23:57:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "miarec",
"github_project": "miarec_smbfs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "miarec-smbfs"
}