{"id":18376325,"url":"https://github.com/fmind/cookiecutter-mlops-package","last_synced_at":"2025-05-16T07:03:57.707Z","repository":{"id":250601113,"uuid":"834870607","full_name":"fmind/cookiecutter-mlops-package","owner":"fmind","description":"Start building and deploying Python packages and Docker images for MLOps tasks.","archived":false,"fork":false,"pushed_at":"2025-03-06T20:06:08.000Z","size":91,"stargazers_count":403,"open_issues_count":1,"forks_count":53,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T11:08:33.456Z","etag":null,"topics":["best-practices","cookiecutter","mlops","python","template"],"latest_commit_sha":null,"homepage":"","language":"Just","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fmind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://donate.stripe.com/4gw8xT9oVbCc98s7ss"]}},"created_at":"2024-07-28T16:02:10.000Z","updated_at":"2025-04-04T07:44:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"8f27f996-1d43-4a88-afdb-3805615eef04","html_url":"https://github.com/fmind/cookiecutter-mlops-package","commit_stats":null,"previous_names":["fmind/cookiecutter-mlops-package"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmind%2Fcookiecutter-mlops-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmind%2Fcookiecutter-mlops-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmind%2Fcookiecutter-mlops-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fmind%2Fcookiecutter-mlops-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fmind","download_url":"https://codeload.github.com/fmind/cookiecutter-mlops-package/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485053,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["best-practices","cookiecutter","mlops","python","template"],"created_at":"2024-11-06T00:22:53.819Z","updated_at":"2025-05-16T07:03:57.690Z","avatar_url":"https://github.com/fmind.png","language":"Just","funding_links":["https://donate.stripe.com/4gw8xT9oVbCc98s7ss"],"categories":[],"sub_categories":[],"readme":"# Cookiecutter - MLOps Package\n\n[![Release](https://img.shields.io/github/v/release/fmind/cookiecutter-mlops-package)](https://github.com/fmind/cookiecutter-mlops-package/releases)\n[![License](https://img.shields.io/github/license/fmind/cookiecutter-mlops-package)](https://github.com/fmind/cookiecutter-mlops-package/blob/main/LICENSE.txt)\n\n**Jumpstart your MLOps projects with this comprehensive [Cookiecutter template](https://cookiecutter.readthedocs.io/)**.\n\nThe template provides a robust foundation for building, testing, packaging, and deploying Python packages and Docker Images tailored for MLOps tasks.\n\n**Related resources**:\n- **[MLOps Coding Course (Learning)](https://mlops-coding-course.fmind.dev/)**: Learn how to create, develop, and maintain a state-of-the-art MLOps code base.\n- **[MLOps Python Package (Example)](https://github.com/fmind/mlops-python-package)**: Kickstart your MLOps initiative with a flexible, robust, and productive Python package.\n- **[LLMOps Coding Package (Example)](https://github.com/callmesora/llmops-python-package/)**: Example with best practices and tools to support your LLMOps projects.\n\n## Philosophy\n\nThis [Cookiecutter](https://cookiecutter.readthedocs.io/) is designed to be a common ground for diverse MLOps environments. Whether you're working with [Kubernetes](https://www.kubeflow.org/), [Vertex AI](https://cloud.google.com/vertex-ai), [Databricks](https://www.databricks.com/), [Azure ML](https://azure.microsoft.com/en-us/products/machine-learning), or [AWS SageMaker](https://aws.amazon.com/sagemaker/), the core principles of using Python packages and Docker images remain consistent.\n\nThis template equips you with the essentials for creating, testing, and packaging your AI/ML code, providing a solid base for [integration into your chosen MLOps platform](https://fmind.medium.com/stop-building-rigid-ai-ml-pipelines-embrace-reusable-components-for-flexible-mlops-6e165d837110). To fully leverage its capabilities within a specific environment, you might need to combine it with external tools like [Airflow](https://airflow.apache.org/) for orchestration or platform-specific SDKs for deployment.\n\nYou have the freedom to structure your `src/` and `tests/` directories according to your preferences. Alternatively, you can draw inspiration from the structure used in the [MLOps Python Package](https://github.com/fmind/mlops-python-package) project for a ready-made implementation.\n\n## Key Features\n\n* **Streamlined Project Structure:** A well-defined directory layout for source code, tests, documentation, tasks, and Docker configurations.\n* **Uv Integration:** Effortless dependency management and packaging with [uv](https://docs.astral.sh/uv/).\n* **Automated Testing and Checks:** Pre-configured workflows using [Pytest](https://docs.pytest.org/), [Ruff](https://docs.astral.sh/ruff/), [Mypy](https://mypy.readthedocs.io/), [Bandit](https://bandit.readthedocs.io/), and [Coverage](https://coverage.readthedocs.io/) to ensure code quality, style, security, and type safety.\n* **Pre-commit Hooks:** Automatic code formatting and linting with [Ruff](https://docs.astral.sh/ruff/) and other pre-commit hooks to maintain consistency.\n* **Dockerized Deployment:** Dockerfile and docker-compose.yml for building and running the package within a containerized environment ([Docker](https://www.docker.com/)).\n* **Invoke Task Automation:** [PyInvoke](https://www.pyinvoke.org/) tasks to simplify development workflows such as cleaning, installing, formatting, checking, building, documenting, and running MLflow projects.\n* **Comprehensive Documentation:** [pdoc](https://pdoc.dev/) generates API documentation, and Markdown files provide clear usage instructions.\n* **GitHub Workflow Integration:** Continuous integration and deployment workflows are set up using [GitHub Actions](https://github.com/features/actions), automating testing, checks, and publishing.\n\n\n## Quick Start\n\n1. **Generate your project:**\n\n```bash\npip install cookiecutter\ncookiecutter gh:fmind/cookiecutter-mlops-package\n```\n\nYou'll be prompted for the following variables:\n\n- `user`: Your GitHub username.\n- `name`: The name of your project.\n- `repository`: The name of your GitHub repository.\n- `package`: The name of your Python package.\n- `license`: The license for your project.\n- `version`: The initial version of your project.\n- `description`: A brief description of your project.\n- `python_version`: The Python version to use (e.g., 3.13).\n- `mlflow_version`: The MLflow version to use (e.g., 2.20.3).\n\n2. **Initialize a git repository:**\n\n```bash\ncd {{ cookiecutter.repository }}\ngit init\n```\n\n3. **Enable GitHub Pages Workflow:**\n\n- Navigate to your repository settings on GitHub: \"Settings\" -\u003e \"Actions\" -\u003e \"General.\"\n- Under \"Workflow permissions,\" ensure \"Read and write permissions\" is selected.\n    - This allows the workflow to automatically publish your documentation.\n\n4. **Explore the generated project:**\n\n- `src/{{cookiecutter.package}}`: Your Python package source code.\n- `tests/`: Unit tests for your package.\n- `tasks/`: PyInvoke tasks for automation.\n- `Dockerfile`: Configuration for building your Docker image.\n- `docker-compose.yml`: Orchestration file for running MLflow and your project.\n\n5. **Start developing!**\n\nUse the provided Invoke tasks to manage your development workflow:\n\n- `uv run just check`: Run code quality, type, security, and test checks.\n- `uv run just clean`: Clean up generated files.\n- `uv run just commit`: Commit changes to your repository.\n- `uv run just doc`: Generate API documentation.\n- `uv run just docker`: Build and run your Docker image.\n- `uv run just format`: Format your code with Ruff.\n- `uv run just install`: Install dependencies, pre-commit hooks, and GitHub rulesets.\n- `uv run just mlflow`: Start an Mlflow server.\n- `uv run just package`: Build your Python package.\n- `uv run just project`: Run the project in the CLI.\n\n## Example Usage\n\n### Running the Project Script\n\nAfter installing dependencies and setting up MLflow:\n\n```bash\nuv run just project\n```\n\nThis will execute the job with the configuration file in your `confs` folder.\n\n### Building and Running Your Docker Image\n\n```bash\ninvoke docker\n```\n\nThis builds a Docker image based on your [`Dockerfile`](https://github.com/fmind/cookiecutter-mlops-package/blob/main/%7B%7Bcookiecutter.repository%7D%7D/Dockerfile) and runs it. The `CMD` in the Dockerfile executes your package with the `--help` flag.\n\n## Contributions\n\nWe welcome [contributions](https://github.com/fmind/cookiecutter-mlops-package/blob/main/CODE_OF_CONDUCT.md) to enhance this [Cookiecutter template](https://cookiecutter.readthedocs.io/) for generating MLOps projects.\n\nFeel free to open [issues](https://github.com/fmind/cookiecutter-mlops-package/issues) or [pull requests](https://github.com/fmind/cookiecutter-mlops-package/pulls) for any improvements, bug fixes, or feature requests.\n\n## License\n\nThis project is licensed under the [MIT License](https://opensource.org/license/mit). See the [`LICENSE.txt`](https://github.com/fmind/cookiecutter-mlops-package/blob/main/LICENSE.txt) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffmind%2Fcookiecutter-mlops-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffmind%2Fcookiecutter-mlops-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffmind%2Fcookiecutter-mlops-package/lists"}