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
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ on:

jobs:
version:
# The crate is of the version of the tag, which the package is of: else neither is released
# The package and the crate are both of the tag's version: which is to be one a crate may have, else
# neither is released
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: grep -qx "version = \"${GITHUB_REF_NAME#v}\"" src/dataclass_native/rust/Cargo.toml
- run: '[[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]'

publish:
needs: version
Expand All @@ -20,11 +20,11 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@v4
with:
# setuptools-scm derives the version from the tags
fetch-depth: 0
- uses: astral-sh/setup-uv@v6
- run: uv build
# The crate within the package is of the tag's version. As that changes a file, the version is given
# to setuptools-scm, which would otherwise derive one of a changed tree
- run: sed -i "s/^version = .*/version = \"${GITHUB_REF_NAME#v}\"/" src/dataclass_native/rust/Cargo.toml
- run: SETUPTOOLS_SCM_PRETEND_VERSION="${GITHUB_REF_NAME#v}" uv build
- uses: pypa/gh-action-pypi-publish@release/v1

crate:
Expand All @@ -33,6 +33,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo publish --manifest-path src/dataclass_native/rust/Cargo.toml
- run: sed -i "s/^version = .*/version = \"${GITHUB_REF_NAME#v}\"/" src/dataclass_native/rust/Cargo.toml
- run: cargo publish --allow-dirty --manifest-path src/dataclass_native/rust/Cargo.toml
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
6 changes: 3 additions & 3 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ modules may be anywhere in a crate.

- The generated code uses the crate `dataclass_native`, which depends on nothing but for its features: pyo3
for `python`, serde for `json` and arrow-rs for `arrow`. It is released to crates.io with the Python package,
at its version, as what is generated and the crate are of each other: the release is refused if the crate's
version is not the tag's. It is also in the Python package, where `dataclass-native rust-dir` prints, to
depend on by path.
at its version, as what is generated and the crate are of each other: which is the tag's, written to its
`Cargo.toml` when it is released. It is also in the Python package, where `dataclass-native rust-dir`
prints, to depend on by path.
- Names are Python's: a struct's, its fields', an enum's and its members', so `Currency::USD`. One which is a
keyword of Rust has `_` after it.
- A struct has the defaults of its class, as its `Default`: a field which has none has that of its type, as in C++.
Expand Down
4 changes: 2 additions & 2 deletions src/dataclass_native/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# `dataclass-native rust-dir` prints: it depends on nothing itself, but for its features arrow, json and python.
[package]
name = "dataclass_native"
# That of the Python package it is released with, which is the tag's: the release is refused if they differ
version = "1.3.0"
# That of the Python package it is released with, which is the tag's: written here when it is released
version = "0.0.0"
edition = "2021"
description = "Types used by the Rust generated by dataclass-native"
license = "MIT"
Expand Down
Loading