diff --git a/.github/workflows/hatch.yml b/.github/workflows/hatch.yml index 52ce4b9..1e50bae 100644 --- a/.github/workflows/hatch.yml +++ b/.github/workflows/hatch.yml @@ -3,6 +3,9 @@ on: push: paths: - 'hatch-demo/**' +defaults: + run: + working-directory: ./hatch-demo jobs: test: @@ -15,6 +18,8 @@ jobs: python-version: '3.12' - name: Install Hatch uses: pypa/hatch@install + - name: Build package + run: hatch build - name: Lint run: hatch run dev:check - name: Run tests diff --git a/hatch-demo/README.md b/hatch-demo/README.md index 105f4c8..4d513a6 100644 --- a/hatch-demo/README.md +++ b/hatch-demo/README.md @@ -99,7 +99,17 @@ run = "python src/hatch_demo/demo.py" $ hatch run default:run ``` +13. Add [hatch-based GH workflow](../.github/workflows/hatch.yml) to check linting and run tests + ## Notes -* Not sure how to install the project so that it can called like `python -m hatch_demo` -* Not sure how to call the entrypoint scripts \ No newline at end of file +* ~~Not sure how to install the project so that it can called like `python -m hatch_demo`~~ + - You can run it from the `hatch` env like: `hatch run dev:python -m hatch_demo` + - You can install it from source and call it: + ```bash + $ uv venv + $ uv pip install . + $ source .venv/bin/activate + $ python -m hatch_demo + ``` +* Not sure how to call the entrypoint scripts diff --git a/hatch-demo/pyproject.toml b/hatch-demo/pyproject.toml index 1c8d7aa..17479a1 100644 --- a/hatch-demo/pyproject.toml +++ b/hatch-demo/pyproject.toml @@ -20,7 +20,10 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] -dependencies = [] +dependencies = [ + "polars", + "requests" +] [project.urls] Source = "https://github.com/davidkun/hatch-vs-poetry-vs-rye" diff --git a/hatch-demo/src/hatch_demo/__main__.py b/hatch-demo/src/hatch_demo/__main__.py index c70a4b8..bbc952e 100644 --- a/hatch-demo/src/hatch_demo/__main__.py +++ b/hatch-demo/src/hatch_demo/__main__.py @@ -1,4 +1,4 @@ -from demo import main +from .demo import main if __name__ == "__main__": main()