sharedlib


Namesharedlib JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryShare packages for monorepo services
upload_time2024-10-05 23:19:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Pavel Kutsenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords monorepo shared sharedlib lib repo
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sharedlib

Pythonic way for use "shared" folder of packages (utils).

## Usage

First, we need to import “sharedlib” into the file where we will use the shared packages: 

```py
import sharedlib
```

Then import a “shared” package with the same name as specified in the config settings:

```py
import my_shared_pkg
from my_shared_pkg import a, b, c
from my_shared_pkg.a.b.c import d
```

And it's working! Python registers a package with the specified name and you can use that in your files. 

A complete example: 

```py
# file: service1/routes/admin.py
import sharedlib

# file: service2/models/user.py
import sharedlib

# original folder: custom_shared/
import my_shared_pkg

# original folders: custom_shared/a, custom_shared/b, custom_shared/c
from my_shared_pkg import a, b, c

# original folder: custom_shared/a/b/c, file: d.py
from my_shared_pkg.a.b.c import d

print(a, b, c, d)
```

## Configuration file

### `sharedlib.ini`

To work with “sharedlib” it is necessary to specify the file `sharedlib.ini` in the root of the project (repository):

```ini
[sharedlib]
folder_name = custom_shared
import_name = my_shared_pkg
```

If the file is not found, an exception will be raised. 

> Important: The configuration file must be located in the root of the project. Otherwise imports will not work properly. 

### `pyproject.toml`

You can also use `pyproject.toml` for customization:

```toml
[tool.sharedlib]
folder_name = "custom_shared"
import_name = "my_shared_pkg"
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sharedlib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "monorepo, shared, sharedlib, lib, repo",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/bb/81/5cb485d60a182949a0d419bb053a1060f3ef034c7d39d1c94302974bd0ec/sharedlib-0.0.1.tar.gz",
    "platform": null,
    "description": "# sharedlib\n\nPythonic way for use \"shared\" folder of packages (utils).\n\n## Usage\n\nFirst, we need to import \u201csharedlib\u201d into the file where we will use the shared packages: \n\n```py\nimport sharedlib\n```\n\nThen import a \u201cshared\u201d package with the same name as specified in the config settings:\n\n```py\nimport my_shared_pkg\nfrom my_shared_pkg import a, b, c\nfrom my_shared_pkg.a.b.c import d\n```\n\nAnd it's working! Python registers a package with the specified name and you can use that in your files. \n\nA complete example: \n\n```py\n# file: service1/routes/admin.py\nimport sharedlib\n\n# file: service2/models/user.py\nimport sharedlib\n\n# original folder: custom_shared/\nimport my_shared_pkg\n\n# original folders: custom_shared/a, custom_shared/b, custom_shared/c\nfrom my_shared_pkg import a, b, c\n\n# original folder: custom_shared/a/b/c, file: d.py\nfrom my_shared_pkg.a.b.c import d\n\nprint(a, b, c, d)\n```\n\n## Configuration file\n\n### `sharedlib.ini`\n\nTo work with \u201csharedlib\u201d it is necessary to specify the file `sharedlib.ini` in the root of the project (repository):\n\n```ini\n[sharedlib]\nfolder_name = custom_shared\nimport_name = my_shared_pkg\n```\n\nIf the file is not found, an exception will be raised. \n\n> Important: The configuration file must be located in the root of the project. Otherwise imports will not work properly. \n\n### `pyproject.toml`\n\nYou can also use `pyproject.toml` for customization:\n\n```toml\n[tool.sharedlib]\nfolder_name = \"custom_shared\"\nimport_name = \"my_shared_pkg\"\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Pavel Kutsenko  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Share packages for monorepo services",
    "version": "0.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/paqstd-dev/sharedlib/issues",
        "Homepage": "https://github.com/paqstd-dev/sharedlib"
    },
    "split_keywords": [
        "monorepo",
        " shared",
        " sharedlib",
        " lib",
        " repo"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0d0ae1cec8f2b0ed155f821a998585371014e1e1063e01d0da801d3c84cd7a9c",
                "md5": "bd98668c7711fd4701a34459dea22596",
                "sha256": "f9ca44fed807ac7a09b1c1f5b8cbf7456f399ec5b327cf61a62e460d8723db66"
            },
            "downloads": -1,
            "filename": "sharedlib-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bd98668c7711fd4701a34459dea22596",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5001,
            "upload_time": "2024-10-05T23:19:48",
            "upload_time_iso_8601": "2024-10-05T23:19:48.772137Z",
            "url": "https://files.pythonhosted.org/packages/0d/0a/e1cec8f2b0ed155f821a998585371014e1e1063e01d0da801d3c84cd7a9c/sharedlib-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bb815cb485d60a182949a0d419bb053a1060f3ef034c7d39d1c94302974bd0ec",
                "md5": "ca69532e65931dccc60ce8b65cf8e665",
                "sha256": "410b790987c348269bac9a5df297da8886316234745b37d6d82f6e8074141709"
            },
            "downloads": -1,
            "filename": "sharedlib-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ca69532e65931dccc60ce8b65cf8e665",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3840,
            "upload_time": "2024-10-05T23:19:50",
            "upload_time_iso_8601": "2024-10-05T23:19:50.388923Z",
            "url": "https://files.pythonhosted.org/packages/bb/81/5cb485d60a182949a0d419bb053a1060f3ef034c7d39d1c94302974bd0ec/sharedlib-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-05 23:19:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paqstd-dev",
    "github_project": "sharedlib",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sharedlib"
}
        
Elapsed time: 0.71302s