{"id":30754304,"url":"https://github.com/reddit/baseplate-celery","last_synced_at":"2025-09-04T09:09:20.865Z","repository":{"id":57414042,"uuid":"406500347","full_name":"reddit/baseplate-celery","owner":"reddit","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-02T20:03:40.000Z","size":22,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-11T04:01:59.549Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reddit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-14T19:42:32.000Z","updated_at":"2025-05-09T04:40:38.000Z","dependencies_parsed_at":"2022-09-26T17:11:15.053Z","dependency_job_id":null,"html_url":"https://github.com/reddit/baseplate-celery","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/reddit/baseplate-celery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddit%2Fbaseplate-celery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddit%2Fbaseplate-celery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddit%2Fbaseplate-celery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddit%2Fbaseplate-celery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reddit","download_url":"https://codeload.github.com/reddit/baseplate-celery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddit%2Fbaseplate-celery/sbom","scorecard":{"id":767544,"data":{"date":"2025-08-11","repo":{"name":"github.com/reddit/baseplate-celery","commit":"1381a6c5f13e179f97dd0846a2867d145c1a3baf"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:16:0: could not parse as YAML: yaml: line 16: did not find expected '-' indicator [syntax-check]","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:16:0: could not parse as YAML: yaml: line 16: did not find expected '-' indicator [syntax-check]","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:16:0: could not parse as YAML: yaml: line 16: did not find expected '-' indicator [syntax-check]","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":6,"reason":"Found 2/3 approved changesets -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:16:0: could not parse as YAML: yaml: line 16: did not find expected '-' indicator [syntax-check]","details":null,"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":9,"reason":"security policy file detected","details":["Info: security policy file detected: github.com/reddit/.github/SECURITY.md:1","Info: Found linked content: github.com/reddit/.github/SECURITY.md:1","Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy","Info: Found text in security policy: github.com/reddit/.github/SECURITY.md:1"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":-1,"reason":"internal error: internal error: invalid GitHub workflow:\n:16:0: could not parse as YAML: yaml: line 16: did not find expected '-' indicator [syntax-check]","details":null,"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"13 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2021-858 / GHSA-q4xr-rc97-m4xx","Warn: Project is vulnerable to: PYSEC-2024-230 / GHSA-248v-346w-9cwc","Warn: Project is vulnerable to: PYSEC-2022-42986 / GHSA-43fp-rhv2-5gv8","Warn: Project is vulnerable to: PYSEC-2023-135 / GHSA-xqr8-7jwr-rhp7","Warn: Project is vulnerable to: PYSEC-2023-177 / GHSA-x7m3-jprg-wc5g","Warn: Project is vulnerable to: PYSEC-2024-60 / GHSA-jjg7-2v4v-x38h","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2023-74 / GHSA-j8r2-6x86-q33q","Warn: Project is vulnerable to: GHSA-34jh-p97f-mpxf","Warn: Project is vulnerable to: PYSEC-2023-212 / GHSA-g4mx-q9vg-27p4","Warn: Project is vulnerable to: GHSA-pq67-6m6q-mj2v","Warn: Project is vulnerable to: PYSEC-2023-192 / GHSA-v845-jxx5-vc9f"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T01:16:04.141Z","repository_id":57414042,"created_at":"2025-08-23T01:16:04.141Z","updated_at":"2025-08-23T01:16:04.141Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273581277,"owners_count":25131393,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-09-04T09:08:04.693Z","updated_at":"2025-09-04T09:09:20.849Z","avatar_url":"https://github.com/reddit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# baseplate-celery\n\nBaseplate Celery allows us to integrate Celery in Baseplate.py services. [Celery](https://docs.celeryproject.org/en/stable/getting-started/introduction.html) is an open source asynchronous task queue. Integrating your Baseplate.py service with Celery can enable you to offload some tasks to run in the background, while leveraging some of Baseplate.py's configurations and telemetry.\n\nBaseplate Celery will allow you to:\n1. Instantiate an instance of Celery.\n2. Identify background task functions within your application with a simple decorator.\n3. Push background tasks to a message queue (or broker), currently supported broker is Redis. \n4. Instantiate Celery workers to pick up tasks from the queue and execute in the background.\n\n\n## Usage\n\nInstall the library:\n\n```console\n$ pip install baseplate-celery\n```\n\n### 1. Instantiate BaseplateCelery\nConfigure `BaseplateCelery` from the main application's configuration file. \n\n```ini\n[app:main]\n\n...\n\n# required: name of application\ncelery.service_name = helloworld\n\n# required: the Redis instance to connect to as the message broker\ncelery.broker_url = redis://localhost:6379/1\n\n...\n\n```\n\nIt is recommended to create a dedicated module for `BaseplateCelery` in your application. For example, your project structure could look like:\n```\nhelloworld/jobs/__init__.py\n               /celery.py\n               /tasks.py\n```\n\nCreate the `BaseplateCelery` instance. To use `BaseplateCelery` within your application, import this instance.\n#### `helloworld/jobs/celery.py`\n```python\nfrom baseplate-celery import BaseplateCelery\n\ncelery_app = BaseplateCelery(\"helloworld\")\n```\n\n### 2. Identify background tasks\nCreate a file called `tasks.py` in this module which contains all the functions you would like to register as Celery tasks. One option is to define all tasks directly in this file. Another option if the tasks are defined in various parts of your application is to import all of them into the `tasks.py` file.\n\n#### `helloworld/jobs/tasks.py`\n```python\nfrom .celery import celery_app\n\n@celery_app.task\ndef add(ctx, x, y):\n    return x + y\n```\n\nAll task functions pass the Baseplate `RequestContext` as a parameter to avoid issues of concurrency.\n\n### 3. Configure BaseplateCelery workers\nIn your application's configuration `.ini` file, add a section for configuring the `celery-worker`.\n\n```ini\n[app:celery-worker]\n\n# required: factory specifies the entry point for setting up Baseplate on the Celery worker\nfactory = helloworld:make_celery_worker\n\n# required: the module which contains the `tasks.py` file\ntasks = helloworld.jobs\n\n# optional: additional command line arguments for starting the Celery worker\ncommand = --loglevel INFO --pool gevent --time-limit 180 --concurrency 1\n```\n\nTo start the celery worker, use the [`baseplate-serve`](https://baseplate.readthedocs.io/en/stable/cli/serve.html) command:\n```\nbaseplate-serve example.ini --app-name celery-worker\n```\n\nYour application might already have a `make_baseplate` function doing all the Baseplate setup. The celery worker's entrypoint function should do the exact same Baseplate setup and then start the workers. For example:\n\n```py\n\ndef make_baseplate(app_config):\n    baseplate = Baseplate(app_config)\n    baseplate.configure_observers()\n    celery_app.set_baseplate(baseplate)\n    ...\n\ndef make_celery_worker(app_config):\n    make_baseplate(app_config)\n    celery_app.run_workers(app_config)\n```\n\n\n### 4. Push background tasks to broker\nNow that your application is set configured with a BaseplateCelery instance and the Celery workers are running, you can push a task to the broker by calling:\n```\nadd.delay(4, 4)\n```\n\n## Documentation: \n\nSee [the documentation] for more information.\n\n[the documentation]: \n\n## Development\n\nA Dockerfile is provided to get a development environment running. To use it,\nbuild the base Docker image:\n\n```console\n$ docker build -t baseplate_celery .\n```\n\nAnd then fire up the environment and use the provided Makefile targets to do\ncommon tasks:\n\n```console\n$ docker run -it -v $PWD:/src -w /src baseplate_celery\n$ make fmt\n```\n\nThe following make targets are provided:\n\n* `fmt`: Apply automatic formatting to the source code.\n* `lint`: Run linters on the code.\n* `test`: Run the test suite.\n* `docs`: Build the docs. Output can be found in `build/html/`.\n\nNote: some tests are skipped by default locally because they are quite slow.\nEnable these by setting CI=true in the environment: `CI=true make test`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freddit%2Fbaseplate-celery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freddit%2Fbaseplate-celery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freddit%2Fbaseplate-celery/lists"}