diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f77bea8..a8c9c04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,8 @@ jobs: check: name: Check runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout the Repository uses: actions/checkout@v4 @@ -21,9 +23,23 @@ jobs: with: args: check + spelling: + name: Spellcheck + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout the Repository + uses: actions/checkout@v7 + + - name: Spellcheck repo + uses: crate-ci/typos@v1 + fmt: name: Formatting runs-on: ubuntu-latest + permissions: + contents: read steps: - name: Checkout the Repository uses: actions/checkout@v4 @@ -33,9 +49,37 @@ jobs: with: args: "format --diff --check" + build: + name: Build + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout the Repository + uses: actions/checkout@v7 + + - name: Install uv + uses: astral-sh/setup-uv@v7 + + - name: Build all packages + run: uv build --all-packages + + - name: List the built dist files + run: ls -lh dist/ + + - name: Upload the package sdist and wheels + uses: actions/upload-artifact@v7 + with: + name: dist + path: dist + retention-days: 1 + test: name: Test runs-on: ubuntu-latest + permissions: + contents: read + needs: build steps: - name: Checkout the Repository uses: actions/checkout@v4 @@ -43,18 +87,30 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v5 - - name: Setup Python - run: uv python install + - name: Download the dist artifact + uses: actions/download-artifact@v8 + with: + name: dist + path: dist + + - name: Install the test dependencies + run: | + uv sync --refresh --no-install-workspace \ + --all-groups - - name: Install the package - run: uv sync --refresh --all-extras --all-groups && uv pip install . + - name: Install the workspace packages + run: | + uv pip install dist/*.whl - name: Run tests - run: uv run pytest + run: uv run pytest -v mypy: name: Typecheck runs-on: ubuntu-latest + permissions: + contents: read + needs: build steps: - name: Checkout the Repository uses: actions/checkout@v4 @@ -62,11 +118,51 @@ jobs: - name: Install uv uses: astral-sh/setup-uv@v5 - - name: Setup Python - run: uv python install + - name: Download the dist artifact + uses: actions/download-artifact@v8 + with: + name: dist + path: dist + + - name: Install the typing dependencies + run: | + uv sync --refresh --no-install-workspace \ + --all-groups - - name: Install the package - run: uv sync --all-extras --all-groups && uv pip install . + - name: Install the workspace packages + run: | + uv pip install dist/*.whl - name: Typecheck the package run: uv run mypy -p climatebenchpress.data_loader + + publish: + name: Publish to PyPi + runs-on: ubuntu-latest + environment: pypi + permissions: + contents: read + id-token: write + if: ${{ github.event_name == 'release' }} + needs: + # require all jobs to succeed + - check + - spelling + - fmt + - build # includes the dist artifact + - test + - mypy + steps: + - name: Download the dist artifact + uses: actions/download-artifact@v8 + with: + name: dist + path: dist + + - name: List the built dist files + run: ls -lh dist/ + + - name: Publish the packages + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true diff --git a/.gitignore b/.gitignore index 6908fc3..007cba2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ **/__pycache__ **/*.egg-info +**/.DS_Store diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..9bcea29 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,3 @@ +[default.extend-identifiers] +fo = "fo" +ower = "ower" diff --git a/pyproject.toml b/pyproject.toml index 9a3f7cb..cbab216 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,11 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + [project] -name = "climatebenchpress.data_loader" -version = "0.1.0" -description = "Add your description here" +name = "climatebenchpress-data-loader" +version = "1.0.0" +description = "Download the datasets for the ClimateBenchPress compression benchmark" readme = "README.md" requires-python = ">=3.12" dependencies = [ @@ -44,8 +48,8 @@ dev = [ "universal-pathlib~=0.2.0", ] -[tool.setuptools.packages.find] -where = ["src"] +[tool.hatch.build.targets.wheel] +packages = ["src/climatebenchpress"] [tool.setuptools.package-data] "climatebenchpress.compressor" = ["py.typed"]