Giter Site home page Giter Site logo

py-nanoid's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py-nanoid's Issues

Feasibility for usage in AWS Lambda

First: Thx for providing this python implementation!

In one of my projects we are migrating applications from e.g. kubernetes java pods to services comprised of AWS lambdas. Right now we are using a stateful id generator (based on twitter snowflake, https://developer.twitter.com/en/docs/twitter-ids).

Nanoid (with it's javascript and python implementation) seems like a perfect match for this new use case. My only concern/question is, if by using nanoid in AWS lambda we are running into problems with nanoid not having enough entropy to create secure ids.

The readme says:

Nano ID uses the crypto module in Node.js

For the node.js AWS lambda environment we should be fine (Andrey confirmed that: ai/nanoid#289 (comment)).

I'm a little bit unsure about the python implementation. Do you have experiences / insights to share?

Thx for your help!

There is a dot

I don't know why nanoid make a string included dot(.)
for example 593uu.uC387.y

Possible package update

Hello, as a prerequisite, I want to tell you that this post falls in a category 'I wonder, what if...'.
So, I just want to leave you thinking about making this package even smaller and in one file.

Reasons are:

  1. Make package more maintainable
  2. The short declaration does not make functions significantly slower

Drawbacks:

  1. secrets package is not available in Python 2 πŸ‘Ž

In the end, this what makes Python really stand out: short but clear expressions, which are easy to read and write.

from functools import reduce
from operator import concat

import random
import secrets

alphabet_std = '_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
default_size = 21


def non_secure_generate(alphabet=alphabet_std, size=default_size):    
    return reduce(concat, (random.choice(alphabet) for _ in range(size)))


def generate(alphabet=alphabet_std, size=default_size):
    return reduce(concat, (secrets.choice(alphabet) for _ in range(size)))

IndexError: string index out of range

print(generate(alphabet="12345a", size=3))
Traceback (most recent call last):
File "E:/nanoid.py", line 33, in
print(generate(alphabet="12345a", size=3))
File "E:/nanoid.py", line 26, in generate
if alphabet[byte]:
IndexError: string index out of range

Process finished with exit code 1

Is this project still alive?

This is the only implementation of nanoid in python that I can find, but the last commit was over two years ago.
I was wondering if this project is totally abandoned or is still being maintained. Thanks.

Projects merge

Hello! I also recreated new version of Nano ID on Python and would like to know, whether it is possible to merge our projects now as I see you are being active on updating the project too.

Why do I want this?
py-nanoid is hosted on PyPi with the name of nanoid. In order not to create confusion among users, it is better to have more powerful single package without duplicates on pip, such as nanoid2 (which is allegedly has been taken myself) and other nonsense.

Would love to hear from you good news!

API 2.0

Let’s update the library to be compatible with the latest Nano ID 2.0:

  • Replace ~ to - in default alphabet
  • Add non-secure fast generator

Nano ID 2.0 (new thread)

I am sorry for delaying the release, but I have decided to go for porting all tests from original nanoid. Therefore, project structure is something to be concerned of. In order not to waste your time, I will put everything out linted and tested later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.