Create a new NFT token and mint it to a wallet address

The following question has been asked on Telegram:

Does anybody have an example SmartPy script to create a new token and Mint it to a wallet address?

Here is an example of an NFT contract that uses the FA2 library.

import smartpy as sp

from templates import fa2_lib as fa2
main = fa2.main

@sp.module
def m():
    class MyNft(
        main.Admin,
        main.Nft,
        main.MintNft,
    ):
        def __init__(self, administrator, metadata, ledger, token_metadata):
            main.MintNft.__init__(self)
            main.Nft.__init__(self, metadata, ledger, token_metadata)
            main.Admin.__init__(self, administrator)


@sp.add_test(name="NFT", is_default=True)
def test():
    administrator = sp.test_account("Administrator")
    alice = sp.test_account("Alice")
    tok0_md = fa2.make_metadata(name="Token Zero", decimals=1, symbol="Tok0")
    metadata = sp.utils.metadata_of_url("ipfs://example")
    
    sc = sp.test_scenario([fa2.t, fa2.main, m])
    c1 = m.MyNft(
        administrator=administrator.address,
        metadata=metadata,
        ledger={},
        token_metadata=[],
    )
    sc += c1

    c1.mint([sp.record(to_=alice.address, metadata=tok0_md)]).run(sender=administrator)

Here is an example with more features:

Summary
import smartpy as sp

from templates import fa2_lib as fa2
main = fa2.main

@sp.module
def m():
    # Order of inheritance: [Admin], [<policy>], <base class>, [<mixins>]
    class MyNft(
        main.Admin,
        main.Nft,
        main.ChangeMetadata,
        main.WithdrawMutez,
        main.MintNft,
        main.BurnNft,
        main.OnchainviewBalanceOf,
    ):
        def __init__(self, administrator, metadata, ledger, token_metadata):
            main.OnchainviewBalanceOf.__init__(self)
            main.BurnNft.__init__(self)
            main.MintNft.__init__(self)
            main.WithdrawMutez.__init__(self)
            main.ChangeMetadata.__init__(self)
            main.Nft.__init__(self, metadata, ledger, token_metadata)
            main.Admin.__init__(self, administrator)



@sp.add_test(name="NFT", is_default=True)
def test():
    administrator = sp.test_account("Administrator")
    alice = sp.test_account("Alice")
    tok0_md = fa2.make_metadata(name="Token Zero", decimals=1, symbol="Tok0")
    metadata = sp.utils.metadata_of_url("ipfs://example")
    
    sc = sp.test_scenario([fa2.t, fa2.main, m])
    c1 = m.MyNft(
        administrator=administrator.address,
        metadata=metadata,
        ledger={},
        token_metadata=[],
    )
    sc += c1

    c1.mint([sp.record(to_=alice.address, metadata=tok0_md)]).run(sender=administrator)

For more information you can have a look at the FA2 library guide and in particular the token metadata page.

You can find much more examples by reading the tests for NFTs and the testing library.