diff --git a/.copier-answers.yaml b/.copier-answers.yaml new file mode 100644 index 0000000..eef78ed --- /dev/null +++ b/.copier-answers.yaml @@ -0,0 +1,12 @@ +# Changes here will be overwritten by Copier +_commit: 2d0c192 +_src_path: https://github.com/python-project-templates/base.git +add_docs: false +add_extension: python +add_wiki: true +email: OpenSource@point72.com +github: Point72 +project_description: Reactive chat bot framework +project_name: csp bot +python_version_primary: '3.9' +team: Point72, L.P. diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 561dd53..8feb362 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at CSPOpenSource@point72.com. All +reported by contacting the project team at OpenSource@point72.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 3aecf4d..42cac77 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,16 +1,16 @@ -# version: 2 -# updates: -# - package-ecosystem: "github-actions" -# directory: "/" -# schedule: -# interval: "weekly" -# labels: -# - "part: github_actions" +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + labels: + - "part: github_actions" -# - package-ecosystem: "pip" -# directory: "/" -# schedule: -# interval: "monthly" -# labels: -# - "lang: python" -# - "part: dependencies" + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "monthly" + labels: + - "lang: python" + - "part: dependencies" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2c20369..9c63d78 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,17 +30,14 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.11"] + python-version: ["3.9"] steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + - uses: actions-ext/python/setup@main with: - python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: 'pyproject.toml' + version: ${{ matrix.python-version }} - name: Install dependencies run: make develop diff --git a/.github/workflows/copier.yaml b/.github/workflows/copier.yaml new file mode 100644 index 0000000..871b414 --- /dev/null +++ b/.github/workflows/copier.yaml @@ -0,0 +1,17 @@ +name: Copier Updates + +on: + workflow_dispatch: + schedule: + - cron: "0 5 * * 0" + +jobs: + update: + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions-ext/copier-update@main + with: + token: ${{ secrets.WORKFLOW_TOKEN }} diff --git a/.github/workflows/wiki.yaml b/.github/workflows/wiki.yaml index ea21903..8de232b 100644 --- a/.github/workflows/wiki.yaml +++ b/.github/workflows/wiki.yaml @@ -1,4 +1,4 @@ -name: Publish Docs +name: Publish Wiki on: push: @@ -20,13 +20,8 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Make home file - run: cp README.md docs/wiki/Home.md - - - name: Upload Documentation to Wiki - uses: Andrew-Chen-Wang/github-wiki-action@v4 + - uses: actions/checkout@v4 + - run: cp README.md docs/wiki/Home.md + - uses: Andrew-Chen-Wang/github-wiki-action@v5 with: path: docs/wiki diff --git a/.gitignore b/.gitignore index a0a5490..3c681aa 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,12 @@ __pycache__/ *$py.class # C extensions +*.a *.so +*.obj *.dll +*.exp +*.lib # Distribution / packaging .Python @@ -29,8 +33,6 @@ share/python-wheels/ MANIFEST # PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec @@ -81,11 +83,7 @@ ipython_config.py .python-version # pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock +Pipfile.lock # PEP 582; used by e.g. github.com/David-OConnor/pyflow __pypackages__/ @@ -125,15 +123,31 @@ dmypy.json .pyre/ # Documentation -docs/_build/ /site +index.md +docs/_build/ +docs/src/_build/ docs/api docs/index.md -_template/labextension +docs/html +docs/jupyter_execute +index.md + +# JS +js/coverage +js/dist +js/lib +js/node_modules +js/*.tgz +csp_bot/extension # Jupyter .ipynb_checkpoints .autoversion +!csp_bot/extension/csp_bot.json +!csp_bot/extension/install.json +csp_bot/nbextension +csp_bot/labextension # Mac .DS_Store diff --git a/LICENSE b/LICENSE index e2c5946..be5bc86 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 the csp-bot authors + Copyright 2024 Point72, L.P. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/Makefile b/Makefile index 157a34d..b959211 100644 --- a/Makefile +++ b/Makefile @@ -4,36 +4,40 @@ .PHONY: develop build install develop: ## install dependencies and build library - python -m pip install -e .[develop] + uv pip install -e .[develop] + +requirements: ## install prerequisite python build requirements + python -m pip install --upgrade pip toml + python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))'` + python -m pip install `python -c 'import toml; c = toml.load("pyproject.toml"); print(" ".join(c["project"]["optional-dependencies"]["develop"]))'` build: ## build the python library python -m build -n install: ## install library - python -m pip install . + uv pip install . ######### # LINTS # ######### -.PHONY: lint lints fix format lint-py lint-docs fix-py fix-docs +.PHONY: lint-py lint-docs fix-py fix-docs lint lints fix format -lint-py: ## run python linter with ruff +lint-py: ## lint python with ruff python -m ruff check csp_bot python -m ruff format --check csp_bot lint-docs: ## lint docs with mdformat and codespell - python -m mdformat --check docs/wiki/ README.md - python -m codespell_lib docs/wiki/ README.md + python -m mdformat --check README.md docs/wiki/ + python -m codespell_lib README.md docs/wiki/ -fix-py: ## fix python formatting with ruff +fix-py: ## autoformat python code with ruff python -m ruff check --fix csp_bot python -m ruff format csp_bot fix-docs: ## autoformat docs with mdformat and codespell - python -m mdformat docs/wiki/ README.md - python -m codespell_lib --write docs/wiki/ README.md + python -m mdformat README.md docs/wiki/ + python -m codespell_lib --write README.md docs/wiki/ -# alias lint: lint-py lint-docs ## run all linters lints: lint fix: fix-py fix-docs ## run all autoformatters diff --git a/README.md b/README.md index acf3527..fd075c1 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,9 @@
[![Build Status](https://github.com/point72/csp-bot/actions/workflows/build.yaml/badge.svg?branch=main&event=push)](https://github.com/point72/csp-bot/actions/workflows/build.yaml) -[![codecov](https://codecov.io/gh/point72/csp-bot/branch/main/graph/badge.svg)](https://codecov.io/gh/point72/csp-bot) +[![codecov](https://codecov.io/gh/Point72/csp-bot/branch/main/graph/badge.svg)](https://codecov.io/gh/Point72/csp-bot) [![GitHub issues](https://img.shields.io/github/issues/point72/csp-bot.svg)](https://github.com/point72/csp-bot/issues) -[![PyPI](https://img.shields.io/pypi/l/csp-bot.svg)](https://pypi.python.org/pypi/csp-bot) +[![License](https://img.shields.io/github/license/Point72/csp-bot)](https://github.com/Point72/csp-bot) [![PyPI](https://img.shields.io/pypi/v/csp-bot.svg)](https://pypi.python.org/pypi/csp-bot) ## Features diff --git a/csp_bot/tests/test_all.py b/csp_bot/tests/test_all.py deleted file mode 100644 index d6a225a..0000000 --- a/csp_bot/tests/test_all.py +++ /dev/null @@ -1 +0,0 @@ -def test_all(): ... diff --git a/docs/wiki/contribute/Build-from-Source.md b/docs/wiki/contribute/Build-from-Source.md index 9699023..8119fcd 100644 --- a/docs/wiki/contribute/Build-from-Source.md +++ b/docs/wiki/contribute/Build-from-Source.md @@ -1,8 +1,5 @@ -`csp-bot` is written in Python and Javascript. While prebuilt wheels are provided for end users, it is also straightforward to build `csp-bot` from either the Python [source distribution](https://packaging.python.org/en/latest/specifications/source-distribution-format/) or the GitHub repository. +`csp-bot` is written in Python. While prebuilt wheels are provided for end users, it is also straightforward to build `csp-bot` from either the Python [source distribution](https://packaging.python.org/en/latest/specifications/source-distribution-format/) or the GitHub repository. -## Table of Contents - -- [Table of Contents](#table-of-contents) - [Make commands](#make-commands) - [Prerequisites](#prerequisites) - [Clone](#clone) @@ -28,6 +25,8 @@ test run the tests ## Prerequisites +`csp-bot` has a few system-level dependencies which you can install from your machine package manager. Other package managers like `conda`, `nix`, etc, should also work fine. + ## Clone Clone the repo with: @@ -59,32 +58,39 @@ make build `csp-bot` has linting and auto formatting. -| Language | Linter | Autoformatter | Description | -| :------- | :--------- | :------------ | :---------- | -| Python | `ruff` | `ruff` | Style | -| Python | `ruff` | `ruff` | Imports | -| Markdown | `prettier` | `prettier` | Style | +| Language | Linter | Autoformatter | Description | +| :------- | :---------- | :------------ | :---------- | +| Python | `ruff` | `ruff` | Style | +| Markdown | `mdformat` | `mdformat` | Style | +| Markdown | `codespell` | | Spelling | **Python Linting** ```bash -make lint +make lint-py ``` **Python Autoformatting** ```bash -make fix +make fix-py ``` **Documentation Linting** -We use `prettier` for our Markdown linting, so follow the above docs. +```bash +make lint-docs +``` + +**Documentation Autoformatting** + +```bash +make fix-docs +``` ## Testing -`csp-bot` has Python tests, which can be run via `pytest`. -First, install the Python development dependencies with +`csp-bot` has extensive Python tests. The tests can be run via `pytest`. First, install the Python development dependencies with ```bash make develop diff --git a/pyproject.toml b/pyproject.toml index 137dec4..fdde173 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,8 +4,8 @@ build-backend="hatchling.build" [project] name = "csp-bot" -authors = [{name = "the csp-bot authors", email = "CSPOpenSource@point72.com"}] -description = "CSP Bot" +authors = [{name = "Point72, L.P.", email = "OpenSource@point72.com"}] +description = "Reactive chat bot framework" readme = "README.md" license = { text = "Apache-2.0" } version = "1.1.0" @@ -49,17 +49,18 @@ develop = [ "build", "bump-my-version", "check-manifest", - "codespell>=2.2.6,<2.5", + "codespell>=2.4,<2.5", "csp-adapter-discord>=0.1,<0.2", "csp-adapter-slack>=0.3,<0.4", "csp-adapter-symphony>=0.3,<0.4", "hatchling", - "mdformat>=0.7.17,<0.8", - "mdformat-tables>=1,<1.1", + "mdformat>=0.7.22,<0.8", + "mdformat-tables>=1", "pytest", "pytest-cov", - "ruff>=0.5,<0.10", - "twine>=5,<7", + "ruff", + "twine", + "uv", "wheel", ] @@ -67,8 +68,8 @@ develop = [ csp-bot-start = "csp_bot.cli:main" [project.urls] -Repository = "https://github.com/point72/csp-bot" -Homepage = "https://github.com/point72/csp-bot" +Repository = "https://github.com/Point72/csp-bot" +Homepage = "https://github.com/Point72/csp-bot" [tool.bumpversion] current_version = "1.1.0" @@ -88,6 +89,7 @@ replace = 'version = "{new_version}"' [tool.check-manifest] ignore = [ + ".copier-answers.yaml", "Makefile", "docs/**/*", "example/**/*", @@ -125,7 +127,6 @@ exclude = ["/docs", "/example"] [tool.pytest.ini_options] addopts = ["-vvv", "--junitxml=junit.xml"] -asyncio_mode = "strict" testpaths = "csp_bot/tests" [tool.ruff] @@ -141,5 +142,5 @@ known-first-party = ["csp_bot"] section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"] [tool.ruff.lint.per-file-ignores] -"csp_bot/backends" = ["F401", "F403"] "__init__.py" = ["F401", "F403"] +"csp_bot/backends" = ["F401", "F403"]