Skip to main content

Sample project for PEP-561 distribution testing

Project description

esp32-test-stubs

Sample project for test PEP-561

Notice: It is only "proof-of-concept" of PEP-561 package so not for production use, package can be deleted in the future.

Installation

pip3 install esp32-test-stubs

Script

import machine
machine.freq()

import esp32
esp32.NVS()
esp32.wake_on_ext0("Test")

from esp.sub_pkg import sub_pkg_fun
sub_pkg_fun()

from esp32.sub_pkg import sub_pkg_function
sub_pkg_function()

import uuid

# Points to stdlib
uuid.uuid4()

# Points to stub (mean partial stub, so extent stdlib)
# see uuid-stubs and py.typed
uuid.uuid6()

import upip
upip.cleanup()

Stubs possible locations

  • project root *.pyi files
  • <package>-stubs with __init__.pyi see PEP-561
  • <package>-stubs/<sub_package>.pyi see stub-only-packages
  • custom folder like src, marked as package = [{ include = "*.pyi" , from = "src"}], under hood all *.pyi will be moved into package root during package build.
    CONS: Not recommended as custom folder does not recognize as stub source before stub package will pack properly. Also in *.tar.gz stubs not moved properly, so it led to potential errors during stub recognition

Note all of these variants should be explicitly marked in pyproject.toml in Poetry see package section

Poetry commands

  • Prepare

    poetry config repositories.testpypi https://test.pypi.org/legacy/
    poetry config pypi-token.testpypi <TOKEN>
    
    poetry config repositories.pypi https://upload.pypi.org/legacy/
    poetry config pypi-token.pypi <TOKEN>
    
  • Publish

    poetry publish --build -r testpypi
    poetry publish --build -r pypi
    

Links

Footnotes

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

esp32-test-stubs-0.1.2.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

esp32_test_stubs-0.1.2-py3-none-any.whl (4.5 kB view hashes)

Uploaded Python 3

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