Merge pull request #1915 from jreese/rst2pyi
Use rst2pyi to generate type stubs and package
This commit is contained in:
commit
c5a4e19d6f
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
# Packages
|
# Packages
|
||||||
############
|
############
|
||||||
|
dist/
|
||||||
|
*.egg-info
|
||||||
|
|
||||||
# Logs and Databases
|
# Logs and Databases
|
||||||
######################
|
######################
|
||||||
|
@ -25,6 +27,7 @@
|
||||||
######################
|
######################
|
||||||
build/
|
build/
|
||||||
bin/
|
bin/
|
||||||
|
circuitpython-stubs/
|
||||||
|
|
||||||
# Test failure outputs
|
# Test failure outputs
|
||||||
######################
|
######################
|
||||||
|
|
14
Makefile
14
Makefile
|
@ -17,6 +17,13 @@ CONFDIR = .
|
||||||
FORCE = -E
|
FORCE = -E
|
||||||
VERBOSE = -v
|
VERBOSE = -v
|
||||||
|
|
||||||
|
# path to generated type stubs
|
||||||
|
STUBDIR = circuitpython-stubs
|
||||||
|
# Run "make VALIDATE= stubs" to avoid validating generated stub files
|
||||||
|
VALIDATE = -v
|
||||||
|
# path to pypi source distributions
|
||||||
|
DISTDIR = dist
|
||||||
|
|
||||||
# Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the
|
# Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the
|
||||||
# full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the
|
# full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the
|
||||||
# executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
# executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||||
|
@ -31,7 +38,7 @@ I18NSPHINXOPTS = $(BASEOPTS)
|
||||||
|
|
||||||
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/nrf py shared-bindings shared-module supervisor
|
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/nrf py shared-bindings shared-module supervisor
|
||||||
|
|
||||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo "Please use \`make <target>' where <target> is one of"
|
@echo "Please use \`make <target>' where <target> is one of"
|
||||||
|
@ -60,6 +67,7 @@ help:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILDDIR)/*
|
rm -rf $(BUILDDIR)/*
|
||||||
|
rm -rf $(STUBDIR) $(DISTDIR) *.egg-info
|
||||||
|
|
||||||
html:
|
html:
|
||||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||||
|
@ -203,3 +211,7 @@ translate: locale/circuitpython.pot
|
||||||
|
|
||||||
check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
|
check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
|
||||||
$(PYTHON) tools/check_translations.py $^
|
$(PYTHON) tools/check_translations.py $^
|
||||||
|
|
||||||
|
stubs:
|
||||||
|
rst2pyi $(VALIDATE) shared-bindings/ $(STUBDIR)
|
||||||
|
python setup.py sdist
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
rst2pyi>=0.3.0
|
|
@ -0,0 +1,22 @@
|
||||||
|
from datetime import datetime
|
||||||
|
from setuptools import setup
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
stub_root = Path("circuitpython-stubs")
|
||||||
|
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
|
||||||
|
|
||||||
|
now = datetime.utcnow()
|
||||||
|
version = now.strftime("%Y.%m.%d")
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name="circuitpython-stubs",
|
||||||
|
description="PEP 561 type stubs for CircuitPython",
|
||||||
|
url="https://github.com/adafruit/circuitpython",
|
||||||
|
maintainer="CircuitPythonistas",
|
||||||
|
author_email="circuitpython@adafruit.com",
|
||||||
|
version=version,
|
||||||
|
license="MIT",
|
||||||
|
package_data={"circuitpython-stubs": stubs},
|
||||||
|
packages=["circuitpython-stubs"],
|
||||||
|
setup_requires=["setuptools>=38.6.0"],
|
||||||
|
)
|
Loading…
Reference in New Issue