Skip to content

Commit

Permalink
Merge pull request #142 from ashvardanian/main-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian authored Apr 19, 2024
2 parents b133006 + a709083 commit a7512ed
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 13 deletions.
100 changes: 100 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Report a bug
description: Something doesn't work as expected?
title: "Bug: "
labels: ["bug"]
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
If you have a small question, it may be faster to ask the maintainers on [Discord](https://discord.gg/4mxGrenbNt).
- type: textarea
id: what
attributes:
label: Describe the bug
placeholder: A short description of what the bug is.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
placeholder: Detail the steps taken to reproduce the behavior.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
placeholder: A clear and concise description of what you expected to happen.
validations:
required: true
- type: input
id: version
attributes:
label: StringZilla version
placeholder: vX.Y.Z
validations:
required: true
- type: input
id: os
attributes:
label: Operating System
placeholder: Ubuntu 22.04
validations:
required: true
- type: dropdown
id: hardware
attributes:
label: Hardware architecture
options:
- x86
- Arm
validations:
required: true
- type: dropdown
id: frontend
attributes:
label: Which interface are you using?
options:
- C implementation
- C++ bindings
- Python bindings
- Rust bindings
- Other bindings
validations:
required: true
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: [email protected]
validations:
required: false
- type: checkboxes
id: mentions
attributes:
label: Are you open to being tagged as a contributor?
description: Sometimes, a bug report is just as valuable as a patch 🤗
options:
- label: I am open to being mentioned in the project `.git` history as a contributor
required: false
- type: checkboxes
id: duplicate
attributes:
label: Is there an existing issue for this?
description: Please search [our issues](https://github.com/ashvardanian/stringzilla/issues) to see if this bug already exists.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/ashvardanian/stringzilla/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 💬 Ask on Discord
url: https://discord.gg/A6wxt6dS9j
about: Real-time communication with maintainers, contributors, and broader community
62 changes: 62 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Request a feature
description: Something we haven't implemented yet?
title: "Feature: "
labels: ["enhancement"]
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
We have already scheduled a few features for our [next milestone](https://github.com/ashvardanian/stringzilla/milestones).
- type: textarea
id: what
attributes:
label: Describe what you are looking for
placeholder: A short description of what the feature would look like, ideally with code examples.
validations:
required: true
- type: checkboxes
id: check
attributes:
label: Can you contribute to the implementation?
options:
- label: I can contribute
- type: dropdown
id: interface
attributes:
label: Is your feature request specific to a certain interface?
options:
- It applies to everything
- C implementation
- C++ bindings
- Python bindings
- Other bindings
- Other
validations:
required: true
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: [email protected]
validations:
required: false
- type: checkboxes
id: duplicate
attributes:
label: Is there an existing issue for this?
description: Please search [our issues](https://github.com/ashvardanian/stringzilla/issues) to see if this bug already exists.
options:
- label: I have searched the existing issues
required: true
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/ashvardanian/stringzilla/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
39 changes: 34 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,14 @@ Consider contributing, if you need a feature that's not yet implemented.
## Quick Start: Python 🐍

1. Install via pip: `pip install stringzilla`
2. Import the classes you need: `from stringzilla import Str, Strs, File`
Python bindings are available on PyPI, and can be installed with `pip`.
You can immediately check the installed version and the used hardware capabilities with following commands:

```bash
pip install stringzilla
python -c "import stringzilla; print(stringzilla.__version__)"
python -c "import stringzilla; print(stringzilla.__capabilities__)"
```

### Basic Usage

Expand Down Expand Up @@ -1129,7 +1135,22 @@ __`STRINGZILLA_BUILD_SHARED`, `STRINGZILLA_BUILD_TEST`, `STRINGZILLA_BUILD_BENCH
## Quick Start: Rust 🦀

StringZilla is available as a Rust crate, with documentation available on [docs.rs/stringzilla](https://docs.rs/stringzilla).
Some of the interfaces will look familiar to the users of the `memchr` crate.
To use the latest crate release in your project, add the following to your `Cargo.toml`:

```toml
[dependencies]
stringzilla = ">=3"
```

Or if you want to use the latest pre-release version from the repository:

```toml
[dependencies]
stringzilla = { git = "https://github.com/ashvardanian/stringzilla", branch = "main-dev" }
```

Once installed, all of the functionality is available through the `stringzilla` namespace.
Many interfaces will look familiar to the users of the `memchr` crate.

```rust
use stringzilla::sz;
Expand Down Expand Up @@ -1186,8 +1207,16 @@ sz::edit_distance_utf8("façade", "facade") // 1

## Quick Start: Swift 🍏

StringZilla is available as a Swift package.
It currently covers only the most basic functionality, but is planned to be extended to cover the full C++ API.
StringZilla can be added as a dependency in the Swift Package Manager.
In your `Package.swift` file, add the following:

```swift
dependencies: [
.package(url: "https://github.com/ashvardanian/stringzilla")
]
```

The package currently covers only the most basic functionality, but is planned to be extended to cover the full C++ API.

```swift
var s = "Hello, world! Welcome to StringZilla. 👋"
Expand Down
6 changes: 3 additions & 3 deletions c/lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ SZ_DYNAMIC sz_capability_t sz_capabilities(void) {
unsigned supports_avx512vl = (info7.named.ebx & 0x80000000) != 0;
// Check for GFNI (Function ID 1, ECX register)
// https://github.com/llvm/llvm-project/blob/50598f0ff44f3a4e75706f8c53f3380fe7faa896/clang/lib/Headers/cpuid.h#L171C30-L171C40
unsigned supports_avx512vbmi = (info1.named.ecx & 0x00000002) != 0;
unsigned supports_avx512vbmi2 = (info1.named.ecx & 0x00000040) != 0;
unsigned supports_avx512vbmi = (info7.named.ecx & 0x00000002) != 0;
unsigned supports_avx512vbmi2 = (info7.named.ecx & 0x00000040) != 0;
// Check for GFNI (Function ID 1, ECX register)
// https://github.com/llvm/llvm-project/blob/50598f0ff44f3a4e75706f8c53f3380fe7faa896/clang/lib/Headers/cpuid.h#L177C30-L177C40
unsigned supports_gfni = (info1.named.ecx & 0x00000100) != 0;
unsigned supports_gfni = (info7.named.ecx & 0x00000100) != 0;

return (sz_capability_t)( //
(sz_cap_x86_avx2_k * supports_avx2) | //
Expand Down
10 changes: 5 additions & 5 deletions include/stringzilla/stringzilla.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ struct concatenation {

#pragma endregion

#pragma region String Views/Spans
#pragma region String Views and Spans

/**
* @brief A string slice (view/span) class implementing a superset of C++23 functionality
Expand All @@ -1109,7 +1109,7 @@ class basic_string_slice {

public:
// STL compatibility
using traits_type = std::char_traits<char_type_>;
using traits_type = std::char_traits<mutable_char_type>;
using value_type = mutable_char_type;
using pointer = char_type *;
using const_pointer = immutable_char_type *;
Expand Down Expand Up @@ -1686,7 +1686,7 @@ class basic_string_slice {
}

#pragma endregion
#pragma region C-Style Arguments
#pragma region C Style Arguments

/**
* @brief Find the first occurrence of a character from a set.
Expand Down Expand Up @@ -2538,7 +2538,7 @@ class basic_string {
}

#pragma endregion
#pragma region C-Style Arguments
#pragma region C Style Arguments

/**
* @brief Find the first occurrence of a character from a set.
Expand Down Expand Up @@ -2607,7 +2607,7 @@ class basic_string {
#pragma endregion

#pragma region Modifiers
#pragma region Non-STL API
#pragma region Non STL API

/**
* @brief Resizes the string to a specified number of characters, padding with the specified character if needed.
Expand Down

0 comments on commit a7512ed

Please sign in to comment.