Skip to content

Commit

Permalink
Make it easier to use purely pip and venv instead of requiring Ha…
Browse files Browse the repository at this point in the history
…tch (#228)

* Make it easier to use purely `pip` and `venv` instead of requiring Hatch.

* Rename and README updates.
  • Loading branch information
DanielRosenwasser authored Apr 10, 2024
1 parent ada3f00 commit b9f307b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
15 changes: 12 additions & 3 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,27 @@ After defining your types, TypeChat takes care of the rest by:

Types are all you need!

## Installation
## Getting Started

TypeChat for Python is not yet on PyPI, but you can try our [examples](./examples/) by cloning this repository.
Install TypeChat:

You will need [Python >=3.11](https://www.python.org/downloads/) and [hatch](https://hatch.pypa.io/1.6/install/).
```sh
pip install typechat
```

You can also develop TypeChat from source, which needs [Python >=3.11](https://www.python.org/downloads/), [hatch](https://hatch.pypa.io/1.6/install/), and [Node.js >=20](https://nodejs.org/en/download):

```sh
git clone https://github.com/microsoft/TypeChat
cd TypeChat/python
hatch shell
npm ci
```

To see TypeChat in action, we recommend exploring the [TypeChat example projects](https://github.com/microsoft/TypeChat/tree/main/python/examples). You can try them on your local machine or in a GitHub Codespace.

To learn more about TypeChat, visit the [documentation](https://microsoft.github.io/TypeChat) which includes more information on TypeChat and how to get started.

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
17 changes: 17 additions & 0 deletions python/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ hatch shell
python examples/sentiment/demo.py
```

Alternatively, you can just use `venv` and `pip`:

```sh
git clone https://github.com/microsoft/TypeChat
cd TypeChat/python
python -m venv ../.venv

# Activate the virtual environment
# Windows
../.venv/Scripts/Activate.ps1
# Unix/POSIX
source ../.venv/bin/activate

pip install .[examples]

python examples/sentiment/demo.py
```

### Option 2: GitHub Codespaces

Expand Down
25 changes: 19 additions & 6 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ dependencies = [
"typing_extensions>=4.10.0",
]

[project.optional-dependencies]
# Development-time dependencies.
dev = [
"coverage[toml]>=6.5",
"pytest>=8.0.2",
"syrupy>=4.6.1",
]

# Dependencies for examples.
examples = [
"python-dotenv>=1.0.0",
"spotipy",
]

[project.urls]
Documentation = "https://github.com/microsoft/TypeChat#readme"
Issues = "https://github.com/microsoft/TypeChat/issues"
Expand All @@ -44,12 +58,11 @@ path = "src/typechat/__about__.py"
type = "virtual"
path = "../.venv"

dependencies = [
"coverage[toml]>=6.5",
"python-dotenv>=1.0.0",
"pytest>=8.0.2",
"syrupy>=4.6.1",
"spotipy", # for examples
# Include dependencies from optional-dependencies for
# development of the core package along with examples.
features = [
"dev",
"examples"
]

[tool.hatch.envs.default.scripts]
Expand Down
2 changes: 1 addition & 1 deletion typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ npm install
npm run build
```

To see TypeChat in action, we recommend exploring the [TypeChat example projects](./examples). You can try them on your local machine or in a GitHub Codespace.
To see TypeChat in action, we recommend exploring the [TypeChat example projects](https://github.com/microsoft/TypeChat/tree/main/typescript/examples). You can try them on your local machine or in a GitHub Codespace.

To learn more about TypeChat, visit the [documentation](https://microsoft.github.io/TypeChat) which includes more information on TypeChat and how to get started.

Expand Down

0 comments on commit b9f307b

Please sign in to comment.