diff --git a/Makefile b/Makefile index 3f4b165..f669c66 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ install: ## install to site-packages .PHONY: test tests test: ## run the python unit tests - python -m pytest -v csp_adapter_symphony/tests --junitxml=junit.xml --cov=csp_adapter_symphony --cov-report=xml:.coverage.xml --cov-branch --cov-fail-under=1 --cov-report term-missing + python -m pytest -v csp_adapter_symphony/tests --junitxml=junit.xml --cov=csp_adapter_symphony --cov-report=xml:.coverage.xml --cov-branch --cov-fail-under=75 --cov-report term-missing test: tests @@ -32,15 +32,25 @@ test: tests ########### .PHONY: lint fix format -lint: ## lint python with isort and ruff - python -m isort csp_adapter_symphony setup.py --check +lint-py: ## lint python with ruff python -m ruff check csp_adapter_symphony setup.py python -m ruff format --check csp_adapter_symphony setup.py -fix: ## autoformat python code with isort and ruff - python -m isort csp_adapter_symphony setup.py +lint-docs: ## lint docs with mdformat and codespell + python -m mdformat --check docs/wiki/ README.md + python -m codespell_lib docs/wiki/ README.md + +fix-py: ## autoformat python code with ruff + python -m ruff check --fix csp_adapter_symphony setup.py python -m ruff format csp_adapter_symphony setup.py +fix-docs: ## autoformat docs with mdformat and codespell + python -m mdformat docs/wiki/ README.md + python -m codespell_lib --write docs/wiki/ README.md + +lint: lint-py lint-docs ## run all linters +lints: lint +fix: fix-py fix-docs ## run all autoformatters format: fix ################# diff --git a/docs/wiki/Build-from-Source.md b/docs/wiki/Build-from-Source.md index 9e17814..1005b62 100644 --- a/docs/wiki/Build-from-Source.md +++ b/docs/wiki/Build-from-Source.md @@ -6,7 +6,6 @@ - [Make commands](#make-commands) - [Prerequisites](#prerequisites) - [Clone](#clone) -- [Install NodeJS](#install-nodejs) - [Install Python dependencies](#install-python-dependencies) - [Build](#build) - [Lint and Autoformat](#lint-and-autoformat) @@ -40,14 +39,6 @@ git clone https://github.com/Point72/csp-adapter-symphony.git cd csp-adapter-symphony ``` -## Install NodeJS - -Follow the instructions for [installing NodeJS](https://nodejs.org/en/download/package-manager/all) for your system. Once installed, you can [install `pnpm`](https://pnpm.io/installation) with: - -```bash -npm instal --global pnpm -``` - ## Install Python dependencies Python build and develop dependencies are specified in the `pyproject.toml`, but you can manually install them: @@ -70,41 +61,35 @@ make build `csp-adapter-symphony` has linting and auto formatting. -| Language | Linter | Autoformatter | Description | -| :--------- | :--------- | :------------ | :---------- | -| Python | `ruff` | `ruff` | Style | -| Python | `isort` | `isort` | Imports | -| JavaScript | `prettier` | `prettier` | Style | -| Markdown | `prettier` | `prettier` | Style | +| Language | Linter | Autoformatter | Description | +| :------- | :--------- | :------------ | :---------- | +| Python | `ruff` | `ruff` | Style | +| Markdown | `prettier` | `prettier` | Style | **Python Linting** ```bash -make lintpy +make lint-py ``` **Python Autoformatting** ```bash -make fixpy +make fix-py ``` -**JavaScript Linting** +**Documentation Linting** ```bash -make lintjs +make lint-docs ``` -**JavaScript Autoformatting** +**Documentation Autoformatting** ```bash -make fixjs +make fix-docs ``` -**Documentation Linting** - -We use `prettier` for our Markdown linting, so follow the above docs. - ## Testing `csp-adapter-symphony` has both Python and JavaScript tests. The bulk of the functionality is tested in Python, which can be run via `pytest`. First, install the Python development dependencies with @@ -116,11 +101,5 @@ make develop **Python** ```bash -make testpy -``` - -**JavaScript** - -```bash -make testjs +make test ``` diff --git a/pyproject.toml b/pyproject.toml index 8e3206c..b362680 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,9 +41,10 @@ dependencies = [ develop = [ "bump2version>=1.0.0", "check-manifest", + "codespell>=2.2.6,<2.3", "hatchling", - "isort", - "ruff>=0.3,<0.5", + "mdformat>=0.7.17,<0.8", + "ruff>=0.5,<0.6", "twine>=5,<5.2", # test "pytest", @@ -90,15 +91,6 @@ exclude = [ "/docs", ] -[tool.isort] -combine_as_imports = true -include_trailing_comma = true -line_length = 150 -profile = "black" -default_section = "THIRDPARTY" -sections = "FUTURE,THIRDPARTY,FIRSTPARTY,LOCALFOLDER" -known_first_party = "csp_adapter_symphony" - [tool.pytest.ini_options] asyncio_mode = "strict" testpaths = "csp_adapter_symphony/tests" @@ -108,3 +100,14 @@ line-length = 150 [tool.ruff.lint.per-file-ignores] "__init__.py" = ["F401", "F403"] + +[tool.ruff.lint.isort] +combine-as-imports = true +default-section = "third-party" +known-first-party = ["csp_adapter_symphony"] +section-order = [ + "future", + "third-party", + "first-party", + "local-folder", +] \ No newline at end of file