Skip to content

Commit

Permalink
Move pyproject.toml to root directory (#1058)
Browse files Browse the repository at this point in the history
* Formatting

Signed-off-by: Mattt Zmuda <mattt@replicate.com>

* Move pyproject.toml to root directory

Signed-off-by: Mattt Zmuda <mattt@replicate.com>

* Remove symlinks to README and LICENSE

Signed-off-by: Mattt Zmuda <mattt@replicate.com>

* Move mypy config to pyproject.toml

Signed-off-by: Mattt Zmuda <mattt@replicate.com>

---------

Signed-off-by: Mattt Zmuda <mattt@replicate.com>
  • Loading branch information
mattt authored Jun 6, 2023
1 parent 1d0c5a0 commit d86fb17
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 52 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
python-version: 3.8
cache: "pip"
- name: Install Python dependencies
run: pip install -e python -r requirements-dev.txt
run: pip install -e . -r requirements-dev.txt
- name: Build
run: make cog
- name: Test
Expand All @@ -55,7 +55,7 @@ jobs:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install Python dependencies
run: pip install -e python -r requirements-dev.txt
run: pip install -e . -r requirements-dev.txt
- name: Test
run: make test-python
env:
Expand All @@ -75,7 +75,7 @@ jobs:
python-version: 3.8
cache: "pip"
- name: Install Python dependencies
run: pip install -r requirements-dev.txt
run: pip install -e . -r requirements-dev.txt
- name: Test
run: make test-integration

Expand Down Expand Up @@ -111,12 +111,12 @@ jobs:
# install build
pip install build
# build package
python -m build python/ --wheel
python -m build --wheel
# set output
echo "version=$(ls python/dist/ | cut -d- -f2)" >> $GITHUB_OUTPUT
- name: Push Python package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: python/dist
packages_dir: dist
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Untitled*.ipynb
__pycache__
.cog
.hypothesis/
build
dist
*.egg-info
pkg/dockerfile/embed/cog.whl
python/build
# Used by a vim plugin (projectionist)
.projections.json
.venv/
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ You'll need to [install Go 1.19](https://golang.org/doc/install). If you're usin

Install the Python dependencies:

pip install -e python -r requirements-dev.txt
pip install -r requirements-dev.txt

Once you have Go installed, run:

Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ GOOS := $(shell $(GO) env GOOS)
GOARCH := $(shell $(GO) env GOARCH)

PYTHON := python
PYTEST := pytest
MYPY := mypy
PYTEST := $(PYTHON) -m pytest
MYPY := $(PYTHON) -m mypy

default: all

Expand All @@ -22,10 +22,10 @@ all: cog

pkg/dockerfile/embed/cog.whl: python/* python/cog/* python/cog/server/* python/cog/command/*
@echo "Building Python library"
rm -rf python/dist
$(PYTHON) -m pip install build && $(PYTHON) -m build python/ --wheel
rm -rf dist
$(PYTHON) -m pip install build && $(PYTHON) -m build --wheel
mkdir -p pkg/dockerfile/embed
cp python/dist/*.whl $@
cp dist/*.whl $@

.PHONY: cog
cog: pkg/dockerfile/embed/cog.whl
Expand All @@ -46,7 +46,7 @@ uninstall:
.PHONY: clean
clean:
$(GO) clean
rm -rf python/build python/dist
rm -rf build dist
rm -f cog
rm -f pkg/dockerfile/embed/cog.whl

Expand All @@ -61,7 +61,7 @@ test-integration: cog

.PHONY: test-python
test-python:
cd python/ && $(PYTEST) -n auto -vv
$(PYTEST) -n auto -vv python/tests

.PHONY: test
test: test-go test-python test-integration
Expand Down
4 changes: 0 additions & 4 deletions mypy.ini

This file was deleted.

37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[build-system]
requires = ["setuptools", "setuptools_scm[toml]"]
build-backend = "setuptools.build_meta"

[project]
name = "cog"
description = "Containers for machine learning"
readme = "README.md"
authors = [{ name = "Replicate", email = "team@replicate.com" }]
license.file = "LICENSE"
urls."Source" = "https://github.com/replicate/cog"

requires-python = ">=3.8"
dependencies = [
# intentionally loose. perhaps these should be vendored to not collide with user code?
"attrs>=20.1,<23",
"fastapi>=0.75.2,<1",
"pydantic>=1.9,<2",
"PyYAML",
"requests>=2,<3",
"structlog>=20,<23",
"typing_extensions>=4.1.0",
"uvicorn[standard]>=0.12,<1",
]

dynamic = ["version"]

[tool.setuptools_scm]
write_to = "python/cog/_version.py"

[tool.mypy]
disallow_untyped_defs = true
# TODO: remove this and bring the codebase inline with the current mypy default
no_implicit_optional = false

[tool.setuptools]
package-dir = { "" = "python" }
1 change: 0 additions & 1 deletion python/LICENSE

This file was deleted.

1 change: 0 additions & 1 deletion python/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions python/pyproject.toml

This file was deleted.

0 comments on commit d86fb17

Please sign in to comment.