Python bindings for heck, the Rust case conversion library

Overview

pyheck

PyHeck is a case conversion library (for converting strings to snake_case, camelCase etc). It is a thin wrapper around the Rust library heck.

Read the documentation.

Installation

pip install pyheck

Note: requires Python >= 3.7.

Example

>>> from pyheck import snake
>>> snake("We carry a new world here, in our hearts.")
'we_carry_a_new_world_here_in_our_hearts'

Development

Setup

  1. Install poetry
  2. Install dev dependencies:
poetry install
  1. Activate the poetry shell:
poetry shell

Testing

  1. Run maturin develop to compile the Rust code.
  2. Run make fmt, make lint, and make test.
You might also like...
A simple library to allow for easy use of python from rust.

Rustpy A simple library to allow for easy use of python from rust. Status Currently this library has not received much love (pull requests welcome for

Robust and Fast tokenizations alignment library for Rust and Python
Robust and Fast tokenizations alignment library for Rust and Python

Robust and Fast tokenizations alignment library for Rust and Python Demo: demo Rust document: docs.rs Blog post: How to calculate the alignment betwee

Arrowdantic is a small Python library backed by a mature Rust implementation of Apache Arrow

Welcome to arrowdantic Arrowdantic is a small Python library backed by a mature Rust implementation of Apache Arrow that can interoperate with Parquet

Build a python wheel from a dynamic library

build_wheel Small utility to create a Python wheel given a pre-built dynamic library (.so, .dylib, .dll). If you are just trying to produce a wheel fr

Rust bindings for Supabase JavaScript library via WebAssembly.

supabase-js-rs Rust bindings for Supabase JavaScript library via WebAssembly. Usage Add supabase-js-rs to Cargo.toml supabase-js-rs = { version = "0.1

Node.js bindings to the ripgrep library, for fast file searching in JavaScript without child processes!

ripgrepjs ripgrepjs: Node.js bindings to the ripgrep library, for direct integration with JS programs without spawning an extra subprocess! This proje

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

Rust Python modules for interacting with Metaplex's NFT standard.

Simple Metaplex Metadata Decoder Install the correct Python wheel for your Python version with pip: pip install metaplex_decoder-0.1.0-cp39-cp39-manyl

RustPython - A Python Interpreter written in Rust
RustPython - A Python Interpreter written in Rust

RustPython A Python-3 (CPython = 3.9.0) Interpreter written in Rust 🐍 😱 🤘 . Usage Check out our online demo running on WebAssembly. RustPython req

Comments
  • why is unicode segmentation used?

    why is unicode segmentation used?

    Just curious. Basically, in the context of this line:

    https://github.com/kevinheavey/pyheck/blob/28fa3d995c73e4931421a361748a588ec1774ebf/Cargo.toml#L17

    I'm not too sure about what the unicode feature is myself, reading up on it in the heck docs now.

    Currently i have some test code in rust at least:

    assert_eq!("a.b.c".to_snake_case(), "a_b_c");
    assert_eq!("a'b'c".to_snake_case(), "a_b_c");
    assert_eq!("2this##@$@#$.23432isaTest.Thanks.To.BOB.Myf\"r'e\"'e''nd.".to_snake_case(),
                     "2this_23432isa_test_thanks_to_bob_myf_r_e_e_nd")
    

    this appears to work without the unicode feature, i.e. with heck = "0.4.0", but when I add the unicode feature then the assert stmts seem to fail. I might be wrong, but for valid snake case it might be worth removing the . and the , in the results. Basically, in my use case I want to turn a bunch of words into valid identifier names in python -- so for ex. a_b_c = 2 would work out in my use case, but with special chars it would fail. Is it possible to just have a _ in the returned string?

    Side note: also 2this is not a valid identifier in python, but I understand that's not a goal of this library for obvious reasons of course.

    opened by rnag 2
Releases(0.1.5)
The polyglot bindings generator for your library (C#, C, Python, …) 🐙

Interoptopus ?? The polyglot bindings generator for your library. Interoptopus allows you to deliver high-quality system libraries to your users, and

Ralf Biedert 155 Jan 3, 2023
This tool converts Lua code to TS automatically, including the conversion of common standards to their TS equivalents.

lua-to-ts This tool converts Lua code to TS automatically, including the conversion of common standards to their TS equivalents. Code that fails to be

Dion 11 Nov 21, 2022
Create a Python project automatically with rust (like create-react-app but for python)

create-python-project Create a Python project automatically with rust (like create-react-app but for python) Installation cargo install create-python-

Dhravya Shah 2 Mar 12, 2022
Create, open, manage your Python projects with ease, a project aimed to make python development experience a little better

Create, open, manage your Python projects with ease, a project aimed to make python development experience a little better

Dhravya Shah 7 Nov 18, 2022
Rust <-> Python bindings

rust-cpython Rust bindings for the python interpreter. Documentation Cargo package: cpython Copyright (c) 2015-2020 Daniel Grunwald. Rust-cpython is l

Daniel Grunwald 1.7k Dec 29, 2022
Rust bindings for the Python interpreter

PyO3 Rust bindings for Python. This includes running and interacting with Python code from a Rust binary, as well as writing native Python modules. Us

PyO3 7.2k Jan 4, 2023
Implementation of Monte Carlo PI approximation algorithm in Rust Python bindings

rusty_pi Implementation of Monte Carlo PI approximation algorithm in Rust Python bindings. Time of 100M iterations approximation on Core i7 10th gen:

Aleksey Popov 1 Jul 6, 2022
Pyo3 - Rust bindings for the Python interpreter

PyO3 Rust bindings for Python, including tools for creating native Python extension modules. Running and interacting with Python code from a Rust bina

PyO3 7.2k Jan 2, 2023
lavalink-rs bindings for Python

lavasnek_rs Dev Docs: Main Site | Fallback: GitHub Pages GitHub repo GitLab repo Using the library The library is available on PyPi, and you can insta

Victoria Casasampere Fernandez 39 Dec 27, 2022
Python bindings for akinator-rs using pyo3

Akinator-py python bindings for akinator-rs using pyo3 Installation Prebuilt wheels are uploaded onto pypi, if you platform is supported, you can inst

Tom-the-Bomb 4 Nov 17, 2022