Skip to main content

A validator for package names, namespace, username and app name on wasmer

Project description

polyvalid

polyvalid is a Rust library for validating package names, usernames, namespace names, and app names. The library provides a single source of truth for validating the names with the following rules:

  1. Start with an alphabet character
  2. Have one or more alphanumeric characters, _ or -
  3. End with an alphanumeric character

Additionally, the library checks if the name contains -- since it can break URL rules.

The library can be used from Python and JS through the provided bindings.

Using the library

The library can be used from rust, python or javascript. The following describes how to use it from all three languages.

Rust

cargo add polyvalid
use polyvalid;

let name: String = "polyvalid";

assert!(polyvalid::is_app_name_valid(name));

Python

pip add polyvalid
import polyvalid

name = "polyvalid"
polyvalid.is_app_name_valid(name) # returns True

Javascript

npm i polyvalid
import "polyvalid";
name = "polyvalid";
polyvalid.is_valid_name(name); // returns true

Next steps

  • Add CI to autopublish to wapm, pypi, npm
  • Add tests for python and JS versions of the library
  • Add wrapper around the python library (to improve usability)

Contributing

Contributions are welcome! If you'd like to contribute to polyvalid, please follow these steps:

  1. Fork the repo and create a new branch for your changes.
  2. Make your changes, write tests, and ensure that the tests pass.
  3. Submit a pull request to the polyvalid repo.
  4. Wait for feedback or approval from the maintainers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polyvalid-0.1.7.tar.gz (684.7 kB view details)

Uploaded Source

Built Distribution

polyvalid-0.1.7-py3-none-any.whl (691.8 kB view details)

Uploaded Python 3

File details

Details for the file polyvalid-0.1.7.tar.gz.

File metadata

  • Download URL: polyvalid-0.1.7.tar.gz
  • Upload date:
  • Size: 684.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for polyvalid-0.1.7.tar.gz
Algorithm Hash digest
SHA256 612d56e9f12ac416a8bf32b58ad32ad3d45af4a0cd7cfe06c0b1279fff7e6856
MD5 7a27e7544c4a0813f70c938e3a617bf4
BLAKE2b-256 f599fbb6a07680de8b287521fb494f5709a91b6eb5d30a1464bb2180b42684fc

See more details on using hashes here.

File details

Details for the file polyvalid-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: polyvalid-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 691.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for polyvalid-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 67694dad207a82152da1b1cb339773e45940066f277e9a96c8f9c7e8e8a4ff91
MD5 b01e813ac6557d8db4c81d2df0890571
BLAKE2b-256 8e1a98b9b82b86c10977c919266dfd11faa56625d502af5544a79457258d58a7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page