diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 19df8eb1..9fa46b52 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -36,5 +36,5 @@ jobs: with: python-version: ${{ matrix.python-version }} - uses: yezz123/setup-uv@v4 - - run: uv pip install --editable '.[graphql,test]' --system - - run: pytest + - run: uv pip install --editable '.[graphql,develop,test]' --system + - run: poe check diff --git a/DEVELOP.md b/DEVELOP.md new file mode 100644 index 00000000..e8e381dd --- /dev/null +++ b/DEVELOP.md @@ -0,0 +1,22 @@ +# Development Sandbox + +Set up a development sandbox. + +Acquire sources and install project in editable mode. +```shell +git clone https://github.com/kennethreitz/responder +cd responder +python3 -m venv .venv +source .venv/bin/activate +pip install --editable '.[graphql,develop,release,test]' +``` + +Invoke linter and software tests. +```shell +poe check +``` + +Format code. +```shell +poe format +``` diff --git a/README.md b/README.md index cc4274a7..fe9756c8 100644 --- a/README.md +++ b/README.md @@ -85,3 +85,7 @@ Requests. - GraphQL support, via Graphene. The goal here is to have any GraphQL query exposable at any route, magically. - Provide an official way to run webpack. + +## Development + +See [Development Sandbox](DEVELOP.md). diff --git a/pyproject.toml b/pyproject.toml index ebdc8925..d36e57c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -68,3 +68,50 @@ testpaths = [ markers = [ ] xfail_strict = true + +[tool.poe.tasks] + +check = [ + "lint", + "test", +] + +docs-autobuild = [ + { cmd = "sphinx-autobuild --open-browser --watch docs/source docs/build" }, +] +docs-html = [ + { cmd = "sphinx-build -W --keep-going docs/source docs/build" }, +] +docs-linkcheck = [ + { cmd = "sphinx-build -W --keep-going -b linkcheck docs/source docs/build" }, +] + +format = [ + { cmd = "ruff format ." }, + # Configure Ruff not to auto-fix (remove!): + # unused imports (F401), unused variables (F841), `print` statements (T201), and commented-out code (ERA001). + { cmd = "ruff check --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001 ." }, + { cmd = "pyproject-fmt --keep-full-version pyproject.toml" }, +] + +lint = [ + { cmd = "ruff format --check ." }, + { cmd = "ruff check ." }, + { cmd = "validate-pyproject pyproject.toml" }, + # { cmd = "mypy" }, +] + +release = [ + { cmd = "python -m build" }, + { cmd = "twine upload --skip-existing dist/*" }, +] + +[tool.poe.tasks.test] +cmd = "pytest" +help = "Invoke software tests" + +[tool.poe.tasks.test.args.expression] +options = [ "-k" ] + +[tool.poe.tasks.test.args.marker] +options = [ "-m" ] diff --git a/setup.py b/setup.py index 2198a709..19a78bf5 100644 --- a/setup.py +++ b/setup.py @@ -31,8 +31,8 @@ "requests", "requests-toolbelt", "rfc3986", - "typesystem<0.3", "starlette[full]", + "typesystem<0.3", "uvicorn[standard]", "whitenoise", ] @@ -71,39 +71,6 @@ def run(self): os.system("dpkg-buildpackage -rfakeroot -uc -us") -class UploadCommand(Command): - """Support setup.py publish.""" - - description = "Build and publish the package." - user_options = [] - - @staticmethod - def status(s): - """Prints things in bold.""" - print("\033[1m{0}\033[0m".format(s)) - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - try: - self.status("Removing previous builds…") - rmtree(os.path.join(here, "dist")) - except FileNotFoundError: - pass - self.status("Building Source distribution…") - os.system("{0} setup.py sdist bdist_wheel".format(sys.executable)) - self.status("Uploading the package to PyPI via Twine…") - os.system("twine upload dist/*") - self.status("Pushing git tags…") - os.system("git tag v{0}".format(about["__version__"])) - os.system("git push --tags") - sys.exit() - - setup( name="responder", version=about["__version__"], @@ -141,5 +108,5 @@ def run(self): "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP", ], - cmdclass={"upload": UploadCommand, "deb": DebCommand}, + cmdclass={"deb": DebCommand}, )