# import export
## A Python package methods decorator
![Lines of code](https://img.shields.io/tokei/lines/github/ablaternae/py-export)
![Downloads](https://img.shields.io/pypi/dm/import-export)
[![Statistic](https://pepy.tech/badge/import-export/week)](https://pepy.tech/project/import-export)
![GitHub](https://img.shields.io/github/license/ablaternae/py-export)
Let me show here
### 1. install
```bash
pip install -U import-export
```
### 2. use
```python
"""mypack.py"""
import export
def fee():
return 'twee'
@export
def moo():
return 'moow'
@export
class C(object):
pass
```
```python
> from mypack import *
> print(fee())
NameError: name 'fee' is not defined
> print(moo())
moow
> print(C())
<mypack.C object at 0x00********>
```
**NB:**
```python
> import mypack
> print(mypack.fee())
twee
```
### How it work
* just add decorated resource name to the tuple `module.__all__`
### Implementation features
* no requirements, but `sys` only
* uses some hack `from sys import modules` and so won't leave _beta_
* does not store itself in module variables
* runs for all version python
## License
* It's free software, see the [LICENSE](https://github.com/ablaternae/py-export/blob/main/LICENSE.md) for more details.
## Credits
* This project is inspired [export v.0.1.2](https://pypi.org/project/export/0.1.2/) by http://github.com/zsiciarz/export
* Written in [CudaText](https://cudatext.github.io/) by [@Alexey-T](https://github.com/Alexey-T/CudaText/)
* Lot a thnx SO topic authors https://stackoverflow.com/q/44834
## TODO
* [x] `export(None)` == raise Exception('doesn\'t work')
* [ ] ~may be implement `private()` `public()` etc decorator to classes as new version of competing library~
* [ ] next part coming soon!
Raw data
{
"_id": null,
"home_page": "https://github.com/ablaternae/py-export",
"name": "import-export",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,import,module,package,export",
"author": "JL Connor",
"author_email": "AbLaternae@outlook.com",
"download_url": "https://files.pythonhosted.org/packages/d0/cd/1a8c0719058ad9869758a3b4b2417519241c2c9f57ebc074730dbf664adf/import-export-0.3.1.tar.gz",
"platform": "any",
"description": "# import export\r\n## A Python package methods decorator\r\n\r\n![Lines of code](https://img.shields.io/tokei/lines/github/ablaternae/py-export)\r\n![Downloads](https://img.shields.io/pypi/dm/import-export)\r\n[![Statistic](https://pepy.tech/badge/import-export/week)](https://pepy.tech/project/import-export)\r\n![GitHub](https://img.shields.io/github/license/ablaternae/py-export)\r\n\r\nLet me show here\r\n\r\n### 1. install\r\n```bash\r\npip install -U import-export\r\n```\r\n\r\n### 2. use \r\n```python\r\n\"\"\"mypack.py\"\"\"\r\nimport export\r\n\r\ndef fee():\r\n return 'twee'\r\n\t\r\n@export\r\ndef moo():\r\n return 'moow'\r\n \r\n@export\r\nclass C(object):\r\n pass\r\n```\r\n```python\r\n> from mypack import *\r\n> print(fee())\r\nNameError: name 'fee' is not defined\r\n> print(moo())\r\nmoow\r\n> print(C())\r\n<mypack.C object at 0x00********>\r\n```\r\n**NB:**\r\n```python\r\n> import mypack\r\n> print(mypack.fee())\r\ntwee\r\n```\r\n\r\n### How it work\r\n* just add decorated resource name to the tuple `module.__all__`\r\n\r\n### Implementation features\r\n* no requirements, but `sys` only\r\n* uses some hack `from sys import modules` and so won't leave _beta_\r\n* does not store itself in module variables\r\n* runs for all version python\r\n\r\n## License\r\n* It's free software, see the [LICENSE](https://github.com/ablaternae/py-export/blob/main/LICENSE.md) for more details.\r\n\r\n\r\n## Credits\r\n* This project is inspired [export v.0.1.2](https://pypi.org/project/export/0.1.2/) by http://github.com/zsiciarz/export\r\n* Written in [CudaText](https://cudatext.github.io/) by [@Alexey-T](https://github.com/Alexey-T/CudaText/)\r\n* Lot a thnx SO topic authors https://stackoverflow.com/q/44834\r\n\r\n\r\n## TODO\r\n* [x] `export(None)` == raise Exception('doesn\\'t work')\r\n* [ ] ~may be implement `private()` `public()` etc decorator to classes as new version of competing library~\r\n* [ ] next part coming soon! \r\n",
"bugtrack_url": null,
"license": "GLWTPL",
"summary": "A Python module methods decorator",
"version": "0.3.1",
"split_keywords": [
"python",
"import",
"module",
"package",
"export"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d46d1d4560d79618ef2c579166ecb157",
"sha256": "1e47906ef2cb35bedaf5082e37ead4f332f35757005a7eff85bf9aef85ea6a7b"
},
"downloads": -1,
"filename": "import-export-0.3.1.tar.gz",
"has_sig": false,
"md5_digest": "d46d1d4560d79618ef2c579166ecb157",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5060,
"upload_time": "2022-11-30T22:39:51",
"upload_time_iso_8601": "2022-11-30T22:39:51.629259Z",
"url": "https://files.pythonhosted.org/packages/d0/cd/1a8c0719058ad9869758a3b4b2417519241c2c9f57ebc074730dbf664adf/import-export-0.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-11-30 22:39:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "ablaternae",
"github_project": "py-export",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "import-export"
}