From 452f3dc8033d1d2163aed7bc61bcd8d54ad81aec Mon Sep 17 00:00:00 2001 From: Keming Date: Mon, 13 Jun 2022 17:08:31 +0800 Subject: [PATCH] feat: add pypi sdist (#298) Signed-off-by: Keming --- .github/workflows/release.yml | 2 +- MANIFEST.in | 7 +++++++ Makefile | 10 +++++++--- setup.py | 13 +++++++------ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4fe4d96f..a5884657d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,7 +71,7 @@ jobs: ls bin/ python -m pip install --upgrade pip python -m pip install twine wheel auditwheel setuptools_scm - python setup.py bdist_wheel + python setup.py bdist_wheel sdist auditwheel repair dist/*.whl ls wheelhouse/ pushd wheelhouse diff --git a/MANIFEST.in b/MANIFEST.in index c1a7121c1..ab316f0cb 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,9 @@ include LICENSE include README.md +include Makefile +include .goreleaser.yaml .goreleaser/*.Dockerfile +include pkg/* cmd/* +include go.mod go.sum +prune examples +prune docs +prune .github diff --git a/Makefile b/Makefile index 2bee7e13e..0a1df4722 100644 --- a/Makefile +++ b/Makefile @@ -44,8 +44,8 @@ REGISTRY ?= ghcr.io/tensorchord # Container registry for base images. BASE_REGISTRY ?= docker.io -# Enable CGO by default. -CGO_ENABLED ?= 1 +# Disable CGO by default. +CGO_ENABLED ?= 0 # # These variables should not need tweaking. @@ -95,7 +95,7 @@ export GOFLAGS ?= -count=1 # # All targets. -.PHONY: lint test build container push addlicense debug debug-local build-local generate clean test-local addlicense-install mockgen-install +.PHONY: lint test build container push addlicense debug debug-local build-local generate clean test-local addlicense-install mockgen-install pypi-build build: build-local @@ -121,6 +121,9 @@ build-local: $(CMD_DIR)/$${target}; \ done +pypi-build: clean + @python setup.py sdist bdist_wheel + generate: mockgen-install @mockgen -source pkg/buildkitd/buildkitd.go -destination pkg/buildkitd/mock/mock.go -package mock @mockgen -source pkg/lang/frontend/starlark/interpreter.go -destination pkg/lang/frontend/starlark/mock/mock.go -package mock @@ -148,6 +151,7 @@ test: generate clean: @-rm -vrf ${OUTPUT_DIR} @-rm -vrf ${DEBUG_DIR} + @-rm -vrf build dist .eggs *.egg-info fmt: ## Run go fmt against code. go fmt ./... diff --git a/setup.py b/setup.py index 2fba52d60..ef3956987 100644 --- a/setup.py +++ b/setup.py @@ -23,12 +23,13 @@ readme = f.read() -def build_envd_if_not_found(): - if not os.path.exists("bin/envd"): - logging.info("envd not found. Build from scratch") +def build_envd_if_not_found(): + if not os.path.exists("bin/envd"): + logging.info("envd not found. Build from scratch") errno = subprocess.call(["make", "build"]) assert errno == 0, "Failed to build envd" + class EnvdExtension(Extension): """Extension for `envd`""" @@ -57,10 +58,10 @@ def get_version(): setup( name="envd", version=get_version(), - use_scm_version = True, - setup_requires=['setuptools_scm'], + use_scm_version=True, + setup_requires=["setuptools_scm"], description="A development environment management tool for data scientists.", - long_description=readme, + long_description=readme, long_description_content_type="text/markdown", url="https://github.com/tensorchord/envd", license="Apache License 2.0",