Name | licenzy JSON |
Version |
1.0.0
JSON |
| download |
home_page | None |
Summary | ๐ Simple, Pythonic license management for AI tools and indie projects |
upload_time | 2025-08-17 15:32:28 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
license | MIT License
Copyright (c) 2025 Licenzy
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 |
ai
authentication
license
licensing
tools
validation
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<div align="center">
<img src="assets/licenzy.svg" alt="Licenzy Logo" width="200"/>
# ๐ Licenzy
> Simple, Pythonic license management for AI tools and indie projects
[](https://badge.fury.io/py/licenzy)
[](https://pypi.org/project/licenzy/)
[](https://opensource.org/licenses/MIT)
</div>
Licenzy provides a clean, minimal API for adding license validation to your Python projects. Perfect for independent developers and small teams building AI tools who need secure but lightweight licensing.
## โจ Features
- **๐จ @licensed decorator** - Protect functions with a simple, elegant decorator
- **๐ Simple API** - `check_license()` for manual validation
- **๐ Flexible Storage** - Environment variables, home directory, or project files
- **๐ HMAC Security** - Cryptographically secure license validation
- **๐ฅ๏ธ CLI Tools** - Easy license management from command line
- **๐ Zero Dependencies** - Core functionality works standalone (Click only for CLI)
- **๐ Startup-Friendly** - Designed for indie developers and small teams
## ๐ Quick Start
### Installation
```bash
pip install licenzy
```
### Basic Usage
```python
from licenzy import licensed, check_license
# Protect premium features with a decorator
@licensed
def premium_ai_model():
return "๐ค Running advanced AI model!"
# Manual license checking
if check_license():
print("โ
All features unlocked!")
else:
print("โ License required for premium features")
```
### Activate a License
```bash
# Via CLI
licenzy activate your-license-key-here
# Via environment variable
export LICENZY_LICENSE_KEY=your-license-key-here
# Check status
licenzy status
```
## ๐ API Reference
### Core Functions
#### `@licensed`
The main decorator for protecting functions that require a valid license.
```python
from licenzy import licensed
@licensed
def premium_feature():
return "This requires a license!"
# With custom error message
@licensed(message="Pro plan required")
def pro_feature():
return "Pro-only functionality"
```
#### `check_license()`
Simple function to check if a license is valid.
```python
from licenzy import check_license
if check_license():
# License is valid
enable_premium_features()
else:
# No valid license
show_upgrade_prompt()
```
### Decorator Aliases
Licenzy provides friendly aliases for different use cases:
```python
from licenzy import unlock, require_key
@unlock # Same as @licensed
def feature_one():
return "Unlocked!"
@require_key # Same as @licensed
def feature_two():
return "Key required!"
```
### Function Aliases
```python
from licenzy import access_granted
# Same as check_license() but more expressive
if access_granted():
print("Welcome to premium features!")
```
## ๐ฅ๏ธ CLI Commands
### Activate License
```bash
licenzy activate your-license-key
```
### Check Status
```bash
licenzy status
```
### Quick Validation
```bash
licenzy check # Returns exit code 0 if valid, 1 if invalid
```
### Deactivate License
```bash
licenzy deactivate
```
### Show Help
```bash
licenzy info # Shows integration examples and usage
```
## โ๏ธ Configuration
### License Storage Locations
Licenzy checks for licenses in this order:
1. **Environment Variable**: `LICENZY_LICENSE_KEY`
2. **User Directory**: `~/.licenzy/license.key`
3. **Project Directory**: `.licenzy_license`
### Development Mode
Bypass license checks during development:
```bash
export LICENZY_DEV_MODE=true
```
### License Key Format
License keys follow this format:
```
user_id:plan:expires_timestamp:signature
```
Example:
```
john123:pro:1735689600:a1b2c3d4e5f6
```
## ๐ง Integration Examples
### FastAPI Integration
```python
from fastapi import FastAPI, HTTPException
from licenzy import licensed, LicenseError
app = FastAPI()
@app.get("/premium-endpoint")
@licensed
def premium_endpoint():
return {"message": "Premium feature accessed!"}
# Global error handler
@app.exception_handler(LicenseError)
async def license_error_handler(request, exc):
raise HTTPException(status_code=402, detail=str(exc))
```
### Flask Integration
```python
from flask import Flask, jsonify
from licenzy import licensed, LicenseError
app = Flask(__name__)
@app.route('/premium')
@licensed
def premium_route():
return jsonify({"message": "Premium content!"})
@app.errorhandler(LicenseError)
def handle_license_error(e):
return jsonify({"error": str(e)}), 402
```
### Class Method Protection
```python
from licenzy import licensed
class AIService:
@licensed
def premium_analysis(self, data):
return "Advanced analysis results"
@licensed(message="Enterprise plan required")
def enterprise_feature(self):
return "Enterprise-only functionality"
```
## ๐งช Testing
Licenzy makes testing easy with development mode:
```python
import os
from licenzy import check_license
def test_premium_feature():
# Enable dev mode for testing
os.environ['LICENZY_DEV_MODE'] = 'true'
assert check_license() == True
# Your test code here
```
## ๐๏ธ Building and Development
### Local Development Setup
```bash
git clone https://github.com/yourusername/licenzy
cd licenzy
pip install -e ".[dev]"
```
### Running Tests
```bash
pytest tests/ -v
```
### Code Formatting
```bash
black licenzy/
```
### Type Checking
```bash
mypy licenzy/
```
## ๐ License
MIT License - see [LICENSE](LICENSE) file for details.
## ๐ค Contributing
Contributions welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.
## ๐ Support
- ๐ **Documentation**: [licenzy.readthedocs.io](https://licenzy.readthedocs.io)
- ๐ **Bug Reports**: [GitHub Issues](https://github.com/yourusername/licenzy/issues)
- ๐ฌ **Discussions**: [GitHub Discussions](https://github.com/yourusername/licenzy/discussions)
---
Built with โค๏ธ for the indie developer community. Perfect for AI tools, SaaS products, and any Python project that needs simple, secure licensing.
Raw data
{
"_id": null,
"home_page": null,
"name": "licenzy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "ai, authentication, license, licensing, tools, validation",
"author": null,
"author_email": "Your Name <your.email@example.com>",
"download_url": "https://files.pythonhosted.org/packages/ba/b1/9ce901cbdb152715ce1e708c5e1cfe46b82bae1f6ef3009862b2d2715f6d/licenzy-1.0.0.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <img src=\"assets/licenzy.svg\" alt=\"Licenzy Logo\" width=\"200\"/>\n \n # \ud83d\udd11 Licenzy\n \n > Simple, Pythonic license management for AI tools and indie projects\n \n [](https://badge.fury.io/py/licenzy)\n [](https://pypi.org/project/licenzy/)\n [](https://opensource.org/licenses/MIT)\n</div>\n\nLicenzy provides a clean, minimal API for adding license validation to your Python projects. Perfect for independent developers and small teams building AI tools who need secure but lightweight licensing.\n\n## \u2728 Features\n\n- **\ud83c\udfa8 @licensed decorator** - Protect functions with a simple, elegant decorator\n- **\ud83d\udd0d Simple API** - `check_license()` for manual validation\n- **\ud83d\udcc1 Flexible Storage** - Environment variables, home directory, or project files\n- **\ud83d\udd12 HMAC Security** - Cryptographically secure license validation\n- **\ud83d\udda5\ufe0f CLI Tools** - Easy license management from command line\n- **\ud83d\udc0d Zero Dependencies** - Core functionality works standalone (Click only for CLI)\n- **\ud83d\ude80 Startup-Friendly** - Designed for indie developers and small teams\n\n## \ud83d\ude80 Quick Start\n\n### Installation\n\n```bash\npip install licenzy\n```\n\n### Basic Usage\n\n```python\nfrom licenzy import licensed, check_license\n\n# Protect premium features with a decorator\n@licensed\ndef premium_ai_model():\n return \"\ud83e\udd16 Running advanced AI model!\"\n\n# Manual license checking\nif check_license():\n print(\"\u2705 All features unlocked!\")\nelse:\n print(\"\u274c License required for premium features\")\n```\n\n### Activate a License\n\n```bash\n# Via CLI\nlicenzy activate your-license-key-here\n\n# Via environment variable\nexport LICENZY_LICENSE_KEY=your-license-key-here\n\n# Check status\nlicenzy status\n```\n\n## \ud83d\udccb API Reference\n\n### Core Functions\n\n#### `@licensed`\nThe main decorator for protecting functions that require a valid license.\n\n```python\nfrom licenzy import licensed\n\n@licensed\ndef premium_feature():\n return \"This requires a license!\"\n\n# With custom error message\n@licensed(message=\"Pro plan required\")\ndef pro_feature():\n return \"Pro-only functionality\"\n```\n\n#### `check_license()`\nSimple function to check if a license is valid.\n\n```python\nfrom licenzy import check_license\n\nif check_license():\n # License is valid\n enable_premium_features()\nelse:\n # No valid license\n show_upgrade_prompt()\n```\n\n### Decorator Aliases\n\nLicenzy provides friendly aliases for different use cases:\n\n```python\nfrom licenzy import unlock, require_key\n\n@unlock # Same as @licensed\ndef feature_one():\n return \"Unlocked!\"\n\n@require_key # Same as @licensed \ndef feature_two():\n return \"Key required!\"\n```\n\n### Function Aliases\n\n```python\nfrom licenzy import access_granted\n\n# Same as check_license() but more expressive\nif access_granted():\n print(\"Welcome to premium features!\")\n```\n\n## \ud83d\udda5\ufe0f CLI Commands\n\n### Activate License\n```bash\nlicenzy activate your-license-key\n```\n\n### Check Status\n```bash\nlicenzy status\n```\n\n### Quick Validation\n```bash\nlicenzy check # Returns exit code 0 if valid, 1 if invalid\n```\n\n### Deactivate License\n```bash\nlicenzy deactivate\n```\n\n### Show Help\n```bash\nlicenzy info # Shows integration examples and usage\n```\n\n## \u2699\ufe0f Configuration\n\n### License Storage Locations\n\nLicenzy checks for licenses in this order:\n\n1. **Environment Variable**: `LICENZY_LICENSE_KEY`\n2. **User Directory**: `~/.licenzy/license.key`\n3. **Project Directory**: `.licenzy_license`\n\n### Development Mode\n\nBypass license checks during development:\n\n```bash\nexport LICENZY_DEV_MODE=true\n```\n\n### License Key Format\n\nLicense keys follow this format:\n```\nuser_id:plan:expires_timestamp:signature\n```\n\nExample:\n```\njohn123:pro:1735689600:a1b2c3d4e5f6\n```\n\n## \ud83d\udd27 Integration Examples\n\n### FastAPI Integration\n\n```python\nfrom fastapi import FastAPI, HTTPException\nfrom licenzy import licensed, LicenseError\n\napp = FastAPI()\n\n@app.get(\"/premium-endpoint\")\n@licensed\ndef premium_endpoint():\n return {\"message\": \"Premium feature accessed!\"}\n\n# Global error handler\n@app.exception_handler(LicenseError)\nasync def license_error_handler(request, exc):\n raise HTTPException(status_code=402, detail=str(exc))\n```\n\n### Flask Integration\n\n```python\nfrom flask import Flask, jsonify\nfrom licenzy import licensed, LicenseError\n\napp = Flask(__name__)\n\n@app.route('/premium')\n@licensed\ndef premium_route():\n return jsonify({\"message\": \"Premium content!\"})\n\n@app.errorhandler(LicenseError)\ndef handle_license_error(e):\n return jsonify({\"error\": str(e)}), 402\n```\n\n### Class Method Protection\n\n```python\nfrom licenzy import licensed\n\nclass AIService:\n @licensed\n def premium_analysis(self, data):\n return \"Advanced analysis results\"\n \n @licensed(message=\"Enterprise plan required\")\n def enterprise_feature(self):\n return \"Enterprise-only functionality\"\n```\n\n## \ud83e\uddea Testing\n\nLicenzy makes testing easy with development mode:\n\n```python\nimport os\nfrom licenzy import check_license\n\ndef test_premium_feature():\n # Enable dev mode for testing\n os.environ['LICENZY_DEV_MODE'] = 'true'\n \n assert check_license() == True\n \n # Your test code here\n```\n\n## \ud83c\udfd7\ufe0f Building and Development\n\n### Local Development Setup\n\n```bash\ngit clone https://github.com/yourusername/licenzy\ncd licenzy\npip install -e \".[dev]\"\n```\n\n### Running Tests\n\n```bash\npytest tests/ -v\n```\n\n### Code Formatting\n\n```bash\nblack licenzy/\n```\n\n### Type Checking\n\n```bash\nmypy licenzy/\n```\n\n## \ud83d\udcc4 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## \ud83e\udd1d Contributing\n\nContributions welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.\n\n## \ud83c\udd98 Support\n\n- \ud83d\udcd6 **Documentation**: [licenzy.readthedocs.io](https://licenzy.readthedocs.io)\n- \ud83d\udc1b **Bug Reports**: [GitHub Issues](https://github.com/yourusername/licenzy/issues)\n- \ud83d\udcac **Discussions**: [GitHub Discussions](https://github.com/yourusername/licenzy/discussions)\n\n---\n\nBuilt with \u2764\ufe0f for the indie developer community. Perfect for AI tools, SaaS products, and any Python project that needs simple, secure licensing.\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Licenzy\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "\ud83d\udd11 Simple, Pythonic license management for AI tools and indie projects",
"version": "1.0.0",
"project_urls": {
"Bug Tracker": "https://github.com/yourusername/licenzy/issues",
"Documentation": "https://licenzy.readthedocs.io",
"Homepage": "https://github.com/yourusername/licenzy",
"Repository": "https://github.com/yourusername/licenzy"
},
"split_keywords": [
"ai",
" authentication",
" license",
" licensing",
" tools",
" validation"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2c68b0b05d6623ef548baba68418abc3f018925e27bd5cf38c1d72bd6a92e44b",
"md5": "15dbcbe9aa949b0d7d8279c99b195fa8",
"sha256": "c0cfc6f762fceba6e84627c5d3e7973f6a1400a3cb9a36e5f3762d27be2ca370"
},
"downloads": -1,
"filename": "licenzy-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "15dbcbe9aa949b0d7d8279c99b195fa8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11332,
"upload_time": "2025-08-17T15:32:27",
"upload_time_iso_8601": "2025-08-17T15:32:27.435038Z",
"url": "https://files.pythonhosted.org/packages/2c/68/b0b05d6623ef548baba68418abc3f018925e27bd5cf38c1d72bd6a92e44b/licenzy-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bab19ce901cbdb152715ce1e708c5e1cfe46b82bae1f6ef3009862b2d2715f6d",
"md5": "f1b8d4de53fc6e8dd9602a028fa3a0f6",
"sha256": "504e710649692ae57282371b91d0567ab501520dd2777b5d305ed0d398586bc5"
},
"downloads": -1,
"filename": "licenzy-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "f1b8d4de53fc6e8dd9602a028fa3a0f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 87711,
"upload_time": "2025-08-17T15:32:28",
"upload_time_iso_8601": "2025-08-17T15:32:28.563367Z",
"url": "https://files.pythonhosted.org/packages/ba/b1/9ce901cbdb152715ce1e708c5e1cfe46b82bae1f6ef3009862b2d2715f6d/licenzy-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-17 15:32:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "licenzy",
"github_not_found": true,
"lcname": "licenzy"
}