djai


Namedjai JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryUtilities for working with Django-based AI integrations.
upload_time2025-11-08 23:39:10
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2025 Will Sackfield 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
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # djai

Tools for DJ ideation powered by AI/ML. The package ships with a command-line interface that helps you analyse your Spotify likes so you can feed curated metadata into downstream machine-learning workflows.

## Command Line Interface

Ensure you have a Spotify access token with the `user-library-read` scope. You can either pass it as a flag or export it as an environment variable:

```bash
export SPOTIFY_API_TOKEN="your-spotify-token"
djai --max-items 100 > liked_tracks.json
```

Key flags:

- `--token`: Provide the Spotify token directly (defaults to `SPOTIFY_API_TOKEN`).
- `--limit`: Batch size per API call (max 50; defaults to 50).
- `--max-items`: Optional cap on total tracks to fetch.
- `--compact`: Output a single-line JSON payload instead of pretty-printed JSON.

The CLI calls Spotify's `/v1/me/tracks` endpoint and prints JSON metadata, including artists, album details, duration, popularity, and preview URLs.

### `.env` Support

Store secrets in a `.env` file to keep them out of your shell history:

```
SPOTIFY_CLIENT_ID="your-client-id"
SPOTIFY_CLIENT_SECRET="your-client-secret"
SPOTIFY_API_TOKEN="your-spotify-token"
```

The CLI automatically loads `.env` from the current working directory (or parent directories) using [`python-dotenv`](https://github.com/theskumar/python-dotenv). If an explicit API token is missing but client credentials are configured, `djai` launches a one-time Authorization Code flow using a temporary localhost listener to obtain fresh `access_token` and `refresh_token` values before fetching tracks. The resulting tokens are cached in `.djai_session` (ignored by git) so subsequent runs in the same directory reuse them. Note that analysing a user's liked tracks still requires a token granted with the `user-library-read` scope.

## Development

```bash
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e ".[dev]"
ruff check .
pytest
```

## Continuous Integration

GitHub Actions runs linting (`ruff`) and tests (`pytest`) on pushes and pull requests targeting `main` via `.github/workflows/ci.yml`.

## Publishing to PyPI

The manual **Publish** workflow in `.github/workflows/deploy.yml` builds and uploads the package. Before triggering it, bump the version in `pyproject.toml` and ensure a PyPI token is stored as `PYPI_API_TOKEN`.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "djai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Your Name <you@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/41/aa/2a85dee7c1a8dd0d558e8284172a73ac078d7eedc871883b4614ff8116f0/djai-0.2.0.tar.gz",
    "platform": null,
    "description": "# djai\n\nTools for DJ ideation powered by AI/ML. The package ships with a command-line interface that helps you analyse your Spotify likes so you can feed curated metadata into downstream machine-learning workflows.\n\n## Command Line Interface\n\nEnsure you have a Spotify access token with the `user-library-read` scope. You can either pass it as a flag or export it as an environment variable:\n\n```bash\nexport SPOTIFY_API_TOKEN=\"your-spotify-token\"\ndjai --max-items 100 > liked_tracks.json\n```\n\nKey flags:\n\n- `--token`: Provide the Spotify token directly (defaults to `SPOTIFY_API_TOKEN`).\n- `--limit`: Batch size per API call (max 50; defaults to 50).\n- `--max-items`: Optional cap on total tracks to fetch.\n- `--compact`: Output a single-line JSON payload instead of pretty-printed JSON.\n\nThe CLI calls Spotify's `/v1/me/tracks` endpoint and prints JSON metadata, including artists, album details, duration, popularity, and preview URLs.\n\n### `.env` Support\n\nStore secrets in a `.env` file to keep them out of your shell history:\n\n```\nSPOTIFY_CLIENT_ID=\"your-client-id\"\nSPOTIFY_CLIENT_SECRET=\"your-client-secret\"\nSPOTIFY_API_TOKEN=\"your-spotify-token\"\n```\n\nThe CLI automatically loads `.env` from the current working directory (or parent directories) using [`python-dotenv`](https://github.com/theskumar/python-dotenv). If an explicit API token is missing but client credentials are configured, `djai` launches a one-time Authorization Code flow using a temporary localhost listener to obtain fresh `access_token` and `refresh_token` values before fetching tracks. The resulting tokens are cached in `.djai_session` (ignored by git) so subsequent runs in the same directory reuse them. Note that analysing a user's liked tracks still requires a token granted with the `user-library-read` scope.\n\n## Development\n\n```bash\npython -m venv .venv\nsource .venv/bin/activate\npip install --upgrade pip\npip install -e \".[dev]\"\nruff check .\npytest\n```\n\n## Continuous Integration\n\nGitHub Actions runs linting (`ruff`) and tests (`pytest`) on pushes and pull requests targeting `main` via `.github/workflows/ci.yml`.\n\n## Publishing to PyPI\n\nThe manual **Publish** workflow in `.github/workflows/deploy.yml` builds and uploads the package. Before triggering it, bump the version in `pyproject.toml` and ensure a PyPI token is stored as `PYPI_API_TOKEN`.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 Will Sackfield\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": "Utilities for working with Django-based AI integrations.",
    "version": "0.2.0",
    "project_urls": {
        "Homepage": "https://github.com/your-org/djai",
        "Issues": "https://github.com/your-org/djai/issues",
        "Repository": "https://github.com/your-org/djai"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ee23187a927d2836fd824ed2aeb89cdb48ad972b86ecc330f07c1268476bea6d",
                "md5": "8d96b65bdd80c6378f42c167cf218394",
                "sha256": "12b8ed4fdccd39b63c16d4d9de0b4f9631b508ec4ce747beb5bfca2ecb3e67c9"
            },
            "downloads": -1,
            "filename": "djai-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8d96b65bdd80c6378f42c167cf218394",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9587,
            "upload_time": "2025-11-08T23:39:09",
            "upload_time_iso_8601": "2025-11-08T23:39:09.068264Z",
            "url": "https://files.pythonhosted.org/packages/ee/23/187a927d2836fd824ed2aeb89cdb48ad972b86ecc330f07c1268476bea6d/djai-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "41aa2a85dee7c1a8dd0d558e8284172a73ac078d7eedc871883b4614ff8116f0",
                "md5": "e51414db379c3e0561836f46650931f6",
                "sha256": "958fc561c35a97ded6e50d7ed6aa8ba23a12fe98787e70f6f704fb5a0160aa94"
            },
            "downloads": -1,
            "filename": "djai-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e51414db379c3e0561836f46650931f6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 9382,
            "upload_time": "2025-11-08T23:39:10",
            "upload_time_iso_8601": "2025-11-08T23:39:10.212293Z",
            "url": "https://files.pythonhosted.org/packages/41/aa/2a85dee7c1a8dd0d558e8284172a73ac078d7eedc871883b4614ff8116f0/djai-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-08 23:39:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "your-org",
    "github_project": "djai",
    "github_not_found": true,
    "lcname": "djai"
}
        
Elapsed time: 2.32740s