Skip to content

Commit

Permalink
add deploy to pypi (#236)
Browse files Browse the repository at this point in the history
* add deploy to pypi

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* use hatch to build/deploy

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add hatch build options

* Update pyproject.toml

* add hatch-vcs

* make version dynamic

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
kevinyamauchi and pre-commit-ci[bot] authored May 2, 2023
1 parent 012c815 commit 104f96e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: Test
on:
push:
branches: [main]
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
branches: [main]

Expand Down Expand Up @@ -60,3 +62,29 @@ jobs:
with:
name: coverage
verbose: true
deploy:
# this will run when you have tagged a commit, starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: [test]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install hatch
run: pip install hatch

- name: Build project for distribution
run: hatch build

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]


[project]
Expand All @@ -15,8 +15,10 @@ maintainers = [
urls.Documentation = "https://spatialdata.readthedocs.io/"
urls.Source = "https://github.com/scverse/spatialdata.git"
urls.Home-page = "https://github.com/scverse/spatialdata.git"
version = "0.0.1.dev1"
requires-python = ">=3.9"
dynamic= [
"version" # allow version to be set by git tags
]
license = {file = "LICENSE"}
readme = "README.md"
dependencies = [
Expand Down Expand Up @@ -112,6 +114,15 @@ exclude = '''
[tool.jupytext]
formats = "ipynb,md"

[tool.hatch.build.targets.wheel]
packages = ['src/spatialdata']

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "_version.py"

[tool.hatch.metadata]
allow-direct-references = true

Expand Down

0 comments on commit 104f96e

Please sign in to comment.