Skip to content

Commit

Permalink
Package CrypTen on PyPI
Browse files Browse the repository at this point in the history
Summary:
CrypTen is now a proper [PyPI package](https://pypi.org/project/crypten/0.1/), making installation one step: `pip install crypten`.

* update readme with new installation instructions
* add logo raw link so it renders on PyPI
* update license and project url in `setup.py`
* specific version of `torch` and `torchvision` now specified in `requirements.txt` and automatically installed via pip

We can now also track installation statistics via PyPI.

Reviewed By: vreis

Differential Revision: D19746436

fbshipit-source-id: 7c64fc473265ef80751e01c95f003fffe0427f16
  • Loading branch information
marksibrahim authored and facebook-github-bot committed Feb 5, 2020
1 parent 4ad37cb commit cacec01
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><img width="70%" src="docs/\_static/img/CrypTen_Identity_Horizontal_Lockup_01_FullColor.png" alt="CrypTen logo" /></p>
<p align="center"><img width="70%" src="https://raw.githubusercontent.com/facebookresearch/CrypTen/master/docs/_static/img/CrypTen_Identity_Horizontal_Lockup_01_FullColor.png" alt="CrypTen logo" /></p>

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebookresearch/CrypTen/blob/master/LICENSE) [![CircleCI](https://circleci.com/gh/facebookresearch/CrypTen.svg?style=shield)](https://circleci.com/gh/facebookresearch/CrypTen/tree/master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/facebookresearch/CrypTen/blob/master/CONTRIBUTING.md)

Expand Down Expand Up @@ -41,19 +41,13 @@ It is currently not production ready and its main use is as a research framework

## Installing CrypTen

CrypTen currently runs on Linux and Mac. It also needs a PyTorch nightly build.
Windows is not supported. We also do not currently support computation on GPUs.
CrypTen currently runs on Linux and Mac with Python >= 3.7.
Windows **is not** supported. We also do not currently support computation on GPUs.

Install Anaconda 2019.07 or later and then do the following:

_For Linux or Mac_
```bash
conda create -n crypten-env python=3.7
conda activate crypten-env
conda install pytorch torchvision -c pytorch
git clone https://github.com/facebookresearch/CrypTen.git
cd CrypTen
pip install -e .
pip install crypten
```

If you want to run the examples in the `examples` directory, you should also do the following
Expand Down
2 changes: 2 additions & 0 deletions crypten/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

__version__ = "0.1.0"

import crypten.communicator as comm
import crypten.mpc # noqa: F401
import crypten.nn # noqa: F401
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
torch==1.4.0
torchvision==0.5.0
onnx
tensorboard
future
22 changes: 16 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,49 @@
# LICENSE file in the root directory of this source tree.

import os.path
import re
import sys

import setuptools


sys.path.insert(0, os.path.join(os.path.dirname(__file__), "crypten"))

# Read description, license and requirements.
# Read description and requirements.
with open("README.md", encoding="utf8") as f:
readme = f.read()
with open("LICENSE") as f:
license = f.read()
with open("requirements.txt") as f:
reqs = f.read()

# get version string from module
init_path = os.path.join(os.path.dirname(__file__), "crypten/__init__.py")
with open(init_path, "r") as f:
version = re.search(r"__version__ = ['\"]([^'\"]*)['\"]", f.read(), re.M).group(1)

# Set key package information.
DISTNAME = "crypten"
DESCRIPTION = "CrypTen: Private and secure machine learning in PyTorch."
DESCRIPTION = "CrypTen: secure machine learning in PyTorch."
LONG_DESCRIPTION = readme
AUTHOR = "Facebook AI Research"
LICENSE = license
LICENSE = "MIT licensed, as found in the LICENSE file"
REQUIREMENTS = (reqs.strip().split("\n"),)
VERSION = version

# Run installer.
if __name__ == "__main__":
if sys.version_info < (3, 7):
sys.exit("Sorry, Python >=3.7 is required for CrypTen.")

setuptools.setup(
name=DISTNAME,
install_requires=REQUIREMENTS,
packages=setuptools.find_packages(),
dependency_links=[],
version="0.1",
version=VERSION,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type="text/markdown",
url="https://github.com/facebookresearch/CrypTen",
author=AUTHOR,
license=LICENSE,
setup_requires=["pytest-runner"],
Expand Down
7 changes: 1 addition & 6 deletions website/pages/en/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,7 @@ class Index extends React.Component {
{
content: 'Please see the '+
'[CrypTen Docs](https://github.com/facebookresearch/crypten#installing-crypten).'+
'\n```bash\n\nconda create -n crypten python=3.7\t\n' +
'conda activate crypten\n' +
'conda install pytorch torchvision -c pytorch\n' +
'# clone\n' +
'git clone https://github.com/facebookresearch/CrypTen.git\n' +
'cd CrypTen; pip install -e .\n\n\n```',
'\n```bash\n\n pip install crypten\n```',
title: 'Installation Script',
},
{
Expand Down

0 comments on commit cacec01

Please sign in to comment.