Skip to main content

autoname

an enum AutoName from python docs with multiple stringcase options.

Get Started

$ pip install autoname
from autoname import AutoName
from enum import auto


# an enum class
class GameType(AutoName):
    INDIE = auto()


print(GameType.INDIE.value)  # "INDIE"

# could be alternative in pydantic instead of literal
from pydantic import BaseModel


class Game(BaseModel):
    type: GameType

Also have others stringcases coverter

  1. AutoNameLower - convert name value to lowercase
  2. AutoNameUpper - convert name value to uppercase

e.g.

from autoname import AutoNameLower
from enum import auto

class GameType(AutoNameLower):
    INDIE = auto()

print(GameType.INDIE.value) # "indie"

You could also bring your own case convertion algorithm.

from autoname import AutoName, transform
from enum import auto


@transform(function=str.lower)
class GameType(AutoName):
    INDIE = auto()


print(GameType.INDIE.value)  # "indie"

If the autoname is not a sound variable name. there are alias too.

  • StrEnum = AutoName
  • LowerStrEnum = AutoNameLower
  • UpperStrEnum = AutoNameUpper

e.g.

from autoname import StrEnum, transform
from enum import auto


class GameType(StrEnum):
    INDIE = auto()


print(GameType.INDIE.value)  # "INDIE"

Alternative

Metadata

Release files for autoname 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autoname 2.1.0
File Size Uploaded Provenance
autoname-2.1.0.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for autoname 2.1.0
File Interpreter ABI Platform
autoname-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / autoname-2.1.0.tar.gz

Download URL autoname-2.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
70230d481a6ffede9538b10c046d4cf0111809c07d750f66f4a9655c728c4c4a
BLAKE2b-256 checksum
How to use checksums
802f5263cc73cb71cdfc943a50b2111c4b0fdc941bb090b6183b4234ad447071
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.9.12 Windows/10

Release files / autoname-2.1.0-py3-none-any.whl

Download URL autoname-2.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab889c62c94062c32e926ab582464fb913714262723be8d758ffba05a1994d23
BLAKE2b-256 checksum
How to use checksums
d1ce27bb0986553cf3e241f6543f580e359707937706d4d46b9e7b784ae45e57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.1 CPython/3.9.12 Windows/10

Security for autoname 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page