Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Migrate to uv #160

Merged
merged 9 commits into from
Oct 23, 2024
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
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v3
with:
python-version: ${{ matrix.python-version }}
version: "0.4.x"
- run: |
pip install uv
uv pip install --system ".[all,dev]"
pytest --ignore gosling/examples --ignore tools/altair --doctest-modules gosling
uv run pytest --ignore gosling/examples --ignore tools/altair --doctest-modules gosling
env:
UV_PYTHON: ${{ matrix.python-version }}
9 changes: 4 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
version: "0.4.x"
- run: |
python -m pip install --upgrade hatch
hatch run docs
uv run docs/build.py

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './dist'
path: './docs/dist'

- name: Deploy to GitHub Pages
id: deployment
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ if you are looking for inspiration.

## Development

```bash
pip install -e '.[dev]'
This project uses [uv](https://github.com/astral-sh/uv) for development.

Run tests with:

```sh
uv run pytest --ignore gosling/examples --ignore tools/altair --doctest-modules gosling
```

The schema bindings (`gosling/schema/`) and docs (`doc/user_guide/API.rst`) are
Expand All @@ -92,7 +96,7 @@ files directly.

```bash
# generate gosling/schema/*
python tools/generate_schema_wrapper.py <tag_name>
uv run tools/generate_schema_wrapper.py <tag_name>
```

## Release
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions docs/build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "furo",
# "gosling",
# "numpydoc>=1.5",
# "sphinx>=6.0",
# ]
#
# [tool.uv.sources]
# gosling = { path = "../" }
# ///
import pathlib

from sphinx.application import Sphinx

SELF_DIR = pathlib.Path(__file__).parent


def main():
app = Sphinx(
srcdir=SELF_DIR,
confdir=SELF_DIR,
outdir=SELF_DIR / "dist",
doctreedir=SELF_DIR / "dist" / ".doctrees",
buildername="html",
)

app.build()


if __name__ == "__main__":
main()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
47 changes: 11 additions & 36 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,26 @@ build-backend = "hatchling.build"
[project]
name = "gosling"
description = "Python bindings to generate Gosling visualizations"
authors = [
{ name = "Trevor Manz", email = "trevor.j.manz@gmail.com" }
]
authors = [{ name = "Trevor Manz", email = "trevor.j.manz@gmail.com" }]
requires-python = ">=3.9"
license = { text = "MIT" }
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
]
dynamic = ["version"]
urls = { homepage = "https://github.com/gosling-lang/gos" }
dependencies = [
"jsonschema>=3.0",
"jinja2",
"pandas"
]
dependencies = ["jsonschema>=3.0", "jinja2", "pandas"]

[project.optional-dependencies]
all = [
"servir>=0.2.1",
"gosling-widget>=0.0.2",
all = ["servir>=0.2.1", "gosling-widget>=0.0.2", "clodius>=0.20.1"]

[tool.uv]
dev-dependencies = [
"clodius>=0.20.1",
]
dev = [
"gosling-widget>=0.0.2",
"pytest>=6.0",
"requests>=2.0",
"sphinx>=6.0",
"numpydoc>=1.5",
"furo",
"servir>=0.2.1",
"setuptools>=75.2.0",
"sphinx>=6,<7",
]

[tool.hatch.build]
Expand All @@ -51,12 +35,3 @@ source = "vcs"

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

[tool.hatch.envs.default]
features = ["dev", "all"]

[tool.hatch.envs.default.scripts]
test = "pytest --ignore gosling/examples --ignore tools/altair --doctest-modules gosling"
clean = "rm -rf doc/_build doc/user_guide/generated/ doc/gallery"
docs = "sphinx-build -b html doc dist"
generate-schema-wrapper = "python tools/generate_schema_wrapper.py"
2 changes: 1 addition & 1 deletion tools/generate_api_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import gosling as gos
import gosling.api as api

API_FILENAME = join(ROOT_DIR, "doc", "user_guide", "API.rst")
API_FILENAME = join(ROOT_DIR, "docs", "user_guide", "API.rst")

API_TEMPLATE = """\
.. _API:
Expand Down
Loading