Skip to main content

sugar

@author SolarisNeko

What is it

Use Python in Decorator / Annotation Like Java Lombok / C# Annotation / TypeScript Decorator

作者是写 Java / TypeScript 习惯了注解

Use Like Other Language:

  1. Java Lombok @Data
  2. TypeScript @Async
  3. C# [Required(ErrorMessage = "{0} is required")]

顺手写

How to use 如何使用

install 安装依赖

pip install sugar

@string | str

@string
class MockData:
    def __init__(self, age):
        self.age = age


data = MockData(18)

# Output = "MockData(age=18)"
print(data)

@csv | CSV

@csv
class MockData:
    def __init__(self, name, age):
        self.name = name
        self.age = age
        self.emptyTips = ''




class Test(TestCase):
    def test_csv(self):
        data = MockData(name='neko', age=18)

        # csv 输出文本
        print(data.csv_str())
        # csv 的格式
        print(data.csv_format())

# 示例中,有个字段为空
# neko,18,
# name,age,emptyTips

my project init

git init

 git remote add github https://github.com/SolarisNeko/neko233-python-sugar.git
 git remote add origin https://gitee.com/SolarisNeko/neko233-python-sugar.git

Metadata

Release files for neko233-sugar 0.0.3

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

Built distribution (wheel)

Table of built distributions (wheels) for neko233-sugar 0.0.3
File Interpreter ABI Platform Actions
neko233_sugar-0.0.3-py3-none-any.whl Python 3 none any Details for neko233_sugar-0.0.3-py3-none-any.whl

Release files / neko233_sugar-0.0.3-py3-none-any.whl

Download URL neko233_sugar-0.0.3-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7de07b41ca036befcfd7354c00e08e710d728f59d8482c72771b060ebe85b9f7
BLAKE2b-256 checksum
How to use checksums
e4e96305a4ea6d772841ac887e46278c384053e2afae9ef4fbe8ca1dcea7702c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for neko233-sugar 0.0.3

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.

Release history Release notifications | RSS feed

This release

0.0.3 This release

1 release file No provenance

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