Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,25 @@ jobs:
- os: "ubuntu-latest"
python-version: "pypy-3.9"

env:
UV_PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
Comment on lines +46 to +49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL


- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install test dependencies
run: |
pip install -e .[dev]
- name: Install the project
run: uv sync --all-extras --dev

- name: Test
run: |
./script/test -v
uv run ./script/test -v
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someday, we may even not need a custom script and we can launch pytest directly :D

2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.0
12 changes: 10 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
args:
- --unsafe
- id: check-added-large-files
args:
- --maxkb=1024
- repo: https://github.com/astral-sh/uv-pre-commit
# uv version.
rev: 0.5.24
hooks:
# Keep uv.lock up to date.
- id: uv-lock

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.5
rev: v0.9.3
hooks:
# Run the linter.
- id: ruff
Expand Down
72 changes: 41 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling==1.17.1"]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -48,36 +48,6 @@ dependencies = [
"pytz",
]

[project.optional-dependencies]
dev = [
"boto3-stubs[s3,swf]",
"cffi==v1.17.0rc1; python_full_version=='3.13.0b4'", # via cryptography via moto, secretstorage
"flaky",
"hatch==1.7.0",
"invoke",
"moto>=4.2.8,<5.0.0",
"packaging",
"pre-commit",
"pytest",
"pytest-xdist>=3.2.0",
"ruff",
"setuptools<72", # See https://github.com/pypa/setuptools/issues/4519
"sphinx",
"sphinx_rtd_theme",
"sure",
"typing-extensions",
"vcrpy",
"twine",
]

doc = [
"mkdocs",
"mkdocs-material",
"pygments",
"pymdown-extensions",
"markdown-include",
]

[project.urls]
documentation = "https://botify-labs.github.io/simpleflow"
repository = "https://github.com/botify-labs/simpleflow"
Expand Down Expand Up @@ -117,3 +87,43 @@ path = "simpleflow/__init__.py"
[tool.hatch.build]
include = ["/simpleflow"]
exclude = ["*~"]

[dependency-groups]
dev = [
"boto3-stubs[s3,swf]",
"cffi==v1.17.0rc1; python_full_version=='3.13.0b4'", # via cryptography via moto, secretstorage
"flaky",
"hatch",
"invoke",
"moto>=4.2.8,<5.0.0",
"packaging",
"pre-commit",
"pytest",
"pytest-xdist>=3.2.0",
"ruff",
"setuptools<72", # See https://github.com/pypa/setuptools/issues/4519
"sphinx",
"sphinx_rtd_theme",
"sure",
"typing-extensions",
"vcrpy",
"twine",
]

doc = [
"mkdocs",
"mkdocs-material",
"pygments",
"pymdown-extensions",
"markdown-include",
]

[[tool.uv.index]]
name = "pypi"
url = "https://pypi.org/simple/"
publish-url = "https://pypi.org/legacy/"

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
24 changes: 9 additions & 15 deletions script/release
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def current_branch() -> str:
branch = execute(["git", "branch", "--show-current"]).strip()
if branch:
return branch
fail("Couldn't find current branch, please don't" " be in 'detached' state when running this.")
fail("Couldn't find current branch, please don't be in 'detached' state when running this.")


def on_main_branch() -> bool:
Expand Down Expand Up @@ -238,17 +238,13 @@ def main():
"--test-pypi",
"-T",
action="store_const",
const="test",
dest="repository",
const="testpypi",
dest="index",
help="upload to TestPyPI",
)
group.add_argument(
"--repository",
help="repository (package index) name or URL to upload the package to",
)
group.add_argument(
"--repository-url",
help="repository (package index) URL to upload the package to",
"--index",
help="index name (from [[tool.uv.index]] in pyproject.toml) to upload the package to",
)
parser.add_argument("--new-version", help="new version number")
args = parser.parse_args()
Expand Down Expand Up @@ -289,14 +285,12 @@ def main():

# push package to pypi
step(f"Generate and push package to {args.repository or args.repository_url or 'pypi'}")
execute(["hatch", "build", "--clean"], log=True)
execute(["uv", "build"], log=True)
wheel = f"dist/simpleflow-{new_version}-py3-none-any.whl"
tar_gz = f"dist/simpleflow-{new_version}.tar.gz"
cmd = ["hatch", "publish"]
if args.repository:
cmd += ["--repo", args.repository]
elif args.repository_url:
cmd += ["--repo", args.repository_url]
cmd = ["uv", "publish"]
if args.index:
cmd += ["--index", args.index]
cmd += [wheel, tar_gz]
execute(cmd, log=True, dry_run=dry_run)

Expand Down
4 changes: 1 addition & 3 deletions script/test
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/bin/bash

# not needed, but harmless, in CI/container
find . -name '*.pyc' -print0 | xargs -0 rm
export PYTHONDONTWRITEBYTECODE=1

# The AWS_DEFAULT_REGION parameter determines the region used for SWF
Expand Down Expand Up @@ -35,4 +33,4 @@ export BOTO_CONFIG=/dev/null

PYTHON=${PYTHON:-python}
# run tests
$PYTHON -m pytest --no-success-flaky-report -q $PYTEST_OPTIONS "$@"
pytest --no-success-flaky-report -q $PYTEST_OPTIONS "$@"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(for next PR: https://pypi.org/project/pytest-env/ and the PYTEST_OPTIONS should rather be in pyproject.toml, as addopts)

Loading
Loading