Skip to content

Commit

Permalink
Merge pull request #474 from gauge-sh/move-to-abi3-wheels
Browse files Browse the repository at this point in the history
Move to abi3 wheels
  • Loading branch information
emdoyle authored Dec 10, 2024
2 parents 3fcf128 + d20e7fc commit 9b3d20b
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 82 deletions.
33 changes: 4 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# This file is autogenerated by maturin v1.5.1
# To update, run
#
# maturin generate-ci github
#
name: Publish tach

on:
Expand Down Expand Up @@ -34,19 +29,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: |
3.7
3.8
3.9
3.10
3.11
3.12
3.13
python-version: 3.13
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --out dist -i python3.7 python3.8 python3.9 python3.10 python3.11 python3.12 python3.13 pypy3.7 pypy3.8 pypy3.9 pypy3.10
args: --release --out dist --find-interpreter
sccache: "true"
manylinux: auto
- name: Upload wheels
Expand All @@ -68,14 +56,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: |
3.7
3.8
3.9
3.10
3.11
3.12
3.13
python-version: 3.13
architecture: ${{ matrix.platform.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
Expand All @@ -102,13 +83,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: |
3.8
3.9
3.10
3.11
3.12
3.13
python-version: 3.13
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tach"
version = "0.16.7"
version = "0.17.0"
edition = "2021"

[lib]
Expand All @@ -9,7 +9,7 @@ crate-type = ["cdylib", "lib"]
bench = false

[dependencies]
pyo3 = "0.22.5"
pyo3 = { version = "0.22.5", features = ["abi3-py37"] }
regex = "1.11.1"
once_cell = "1.20.2"
walkdir = "2.5.0"
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ If you use the [pre-commit framework](https://github.com/pre-commit/pre-commit),
```yaml
repos:
- repo: https://github.com/gauge-sh/tach-pre-commit
rev: v0.16.7 # change this to the latest tag!
rev: v0.17.0 # change this to the latest tag!
hooks:
- id: tach
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tach"
version = "0.16.7"
version = "0.17.0"
authors = [
{ name = "Caelean Barnes", email = "[email protected]" },
{ name = "Evan Doyle", email = "[email protected]" },
Expand Down
2 changes: 1 addition & 1 deletion python/tach/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations

__version__: str = "0.16.7"
__version__: str = "0.17.0"

__all__ = ["__version__"]
9 changes: 6 additions & 3 deletions python/tach/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
from tach.check_external import check_external
from tach.colors import BCOLORS
from tach.constants import CONFIG_FILE_NAME, TOOL_NAME
from tach.errors import TachClosedBetaError, TachError
from tach.extension import (
ProjectConfig,
from tach.errors import (
TachCircularDependencyError,
TachClosedBetaError,
TachError,
TachVisibilityError,
)
from tach.extension import (
ProjectConfig,
check,
check_computation_cache,
create_computation_cache_key,
Expand Down
12 changes: 12 additions & 0 deletions python/tach/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ class TachSetupError(TachError): ...


class TachClosedBetaError(TachError): ...


class TachCircularDependencyError(TachError):
def __init__(self, dependencies: list[str]):
self.dependencies = dependencies
super().__init__("Circular dependency error")


class TachVisibilityError(TachError):
def __init__(self, visibility_errors: list[tuple[str, str, list[str]]]):
self.visibility_errors = visibility_errors
super().__init__("Visibility error")
6 changes: 0 additions & 6 deletions python/tach/extension.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ def sync_project(
add: bool = False,
) -> str: ...

class TachCircularDependencyError(ValueError):
dependencies: list[str]

class TachVisibilityError(ValueError):
visibility_errors: list[tuple[str, str, list[str]]]

class ErrorInfo:
def is_dependency_error(self) -> bool: ...
def is_interface_error(self) -> bool: ...
Expand Down
45 changes: 7 additions & 38 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ use std::path::PathBuf;
use pyo3::exceptions::{PyOSError, PySyntaxError, PyValueError};
use pyo3::prelude::*;

mod errors {
pyo3::import_exception!(tach.errors, TachCircularDependencyError);
pyo3::import_exception!(tach.errors, TachVisibilityError);
}

impl From<imports::ImportParseError> for PyErr {
fn from(err: imports::ImportParseError) -> Self {
match err {
Expand Down Expand Up @@ -66,12 +71,12 @@ impl From<check_internal::CheckError> for PyErr {
modules::error::ModuleTreeError::CircularDependency(c),
) = err
{
PyErr::new::<TachCircularDependencyError, _>(c)
errors::TachCircularDependencyError::new_err(c)
} else if let check_internal::CheckError::ModuleTree(
modules::error::ModuleTreeError::VisibilityViolation(v),
) = err
{
PyErr::new::<TachVisibilityError, _>(v)
errors::TachVisibilityError::new_err(v)
} else {
PyValueError::new_err(err.to_string())
}
Expand Down Expand Up @@ -380,41 +385,5 @@ fn extension(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_function(wrap_pyfunction_bound!(check, m)?)?;
m.add_function(wrap_pyfunction_bound!(sync_dependency_constraints, m)?)?;
m.add_function(wrap_pyfunction_bound!(sync_project, m)?)?;
m.add(
"TachCircularDependencyError",
py.get_type_bound::<TachCircularDependencyError>(),
)?;
m.add(
"TachVisibilityError",
py.get_type_bound::<TachVisibilityError>(),
)?;
Ok(())
}

#[pyclass(extends=PyValueError)]
struct TachCircularDependencyError {
#[pyo3(get)]
dependencies: Vec<String>,
}

#[pymethods]
impl TachCircularDependencyError {
#[new]
fn new(dependencies: Vec<String>) -> Self {
Self { dependencies }
}
}

#[pyclass(extends=PyValueError)]
struct TachVisibilityError {
#[pyo3(get)]
visibility_errors: Vec<PyObject>,
}

#[pymethods]
impl TachVisibilityError {
#[new]
fn new(visibility_errors: Vec<PyObject>) -> Self {
Self { visibility_errors }
}
}

0 comments on commit 9b3d20b

Please sign in to comment.