Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using pyproject.toml over setup.py to manage the package information #440

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,5 @@ jobs:
- run: conda install -n test python=${{ matrix.python-version }} pytorch=${{ matrix.pytorch-version }} torchvision=${{ matrix.torchvision-version }} cpuonly -c pytorch
- uses: actions/checkout@v2
- run: echo "$CONDA/envs/test/bin" >> $GITHUB_PATH
- run: pip install pytest
- run: pip install .
- run: pip install .[dev]
- run: pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ __pycache__/
thumbs.db
.DS_Store
.idea

build
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- pyproject.toml

### Changed

- Start using "pyproject.toml" over "setup.py" to manage the package information.

### Removed

- requirements.txt
- setup.py
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@ CLIP (Contrastive Language-Image Pre-Training) is a neural network trained on a

## Usage

First, [install PyTorch 1.7.1](https://pytorch.org/get-started/locally/) (or later) and torchvision, as well as small additional dependencies, and then install this repo as a Python package. On a CUDA GPU machine, the following will do the trick:
First, install this repo as a Python package

```bash
$ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=11.0
$ pip install ftfy regex tqdm
$ pip install git+https://github.com/openai/CLIP.git
```

Replace `cudatoolkit=11.0` above with the appropriate CUDA version on your machine or `cpuonly` when installing on a machine without a GPU.

```python
import torch
import clip
Expand Down
2 changes: 2 additions & 0 deletions clip/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .clip import *

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

[project]
name = "clip"
dynamic = ["version", "readme"]
authors = [{name = "OpenAI"}]
requires-python = ">=3.8"
dependencies = [
"ftfy",
"regex",
"tqdm",
"torch>=1.7.1",
"torchvision",
]

[project.optional-dependencies]
dev = ["pytest"]

[tool.setuptools.dynamic]
version = {attr = "clip.__version__"}
readme = {file = ["README.md"]}

[tool.setuptools.packages.find]
exclude = ["tests"]
5 changes: 0 additions & 5 deletions requirements.txt

This file was deleted.

21 changes: 0 additions & 21 deletions setup.py

This file was deleted.