Skip to content

Commit 88e8cae

Browse files
authored
Update Installation to Support PyPI (#15)
1 parent d97f5ef commit 88e8cae

File tree

8 files changed

+216
-184
lines changed

8 files changed

+216
-184
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
version_bump:
9+
description: 'Type of version bump'
10+
required: true
11+
default: 'patch'
12+
type: choice
13+
options:
14+
- patch
15+
- minor
16+
- major
17+
18+
jobs:
19+
bump-and-release:
20+
runs-on: ubuntu-latest
21+
if: github.event_name == 'workflow_dispatch'
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
# Use a token with write permissions to push the version bump
27+
token: ${{ secrets.PAT }}
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: '3.10'
33+
34+
- name: Install tomlkit
35+
run: pip install tomlkit
36+
37+
- name: Bump version
38+
id: bump_version
39+
run: |
40+
python -c "
41+
import tomlkit
42+
import os
43+
44+
bump_type = '${{ github.event.inputs.version_bump }}'
45+
46+
with open('pyproject.toml', 'r') as f:
47+
pyproject = tomlkit.parse(f.read())
48+
49+
current_version = pyproject['project']['version']
50+
major, minor, patch = map(int, current_version.split('.'))
51+
52+
if bump_type == 'major':
53+
major += 1
54+
minor = 0
55+
patch = 0
56+
elif bump_type == 'minor':
57+
minor += 1
58+
patch = 0
59+
else: # patch
60+
patch += 1
61+
62+
new_version = f'{major}.{minor}.{patch}'
63+
pyproject['project']['version'] = new_version
64+
65+
with open('pyproject.toml', 'w') as f:
66+
f.write(tomlkit.dumps(pyproject))
67+
68+
# Use GITHUB_OUTPUT to pass the new version to other steps
69+
print(f"new_version={new_version}" >> $GITHUB_OUTPUT)
70+
"
71+
72+
- name: Commit version bump
73+
run: |
74+
git config --local user.email "[email protected]"
75+
git config --local user.name "GitHub Action"
76+
git add pyproject.toml
77+
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}"
78+
git push
79+
80+
- name: Create Release
81+
uses: actions/create-release@v1
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
with:
85+
tag_name: v${{ steps.bump_version.outputs.new_version }}
86+
release_name: Release v${{ steps.bump_version.outputs.new_version }}
87+
body: "Automated release for version ${{ steps.bump_version.outputs.new_version }}"
88+
draft: false
89+
prerelease: false
90+
91+
publish:
92+
runs-on: ubuntu-latest
93+
if: github.event_name == 'release' && github.event.action == 'published'
94+
steps:
95+
- uses: actions/checkout@v4
96+
97+
- name: Set up Python
98+
uses: actions/setup-python@v4
99+
with:
100+
python-version: '3.10'
101+
102+
- name: Install dependencies
103+
run: |
104+
python -m pip install --upgrade pip
105+
pip install build
106+
107+
- name: Build package
108+
run: python -m build
109+
110+
- name: Publish package to PyPI
111+
uses: pypa/gh-action-pypi-publish@release/v1
112+
with:
113+
password: ${{ secrets.PYPI_API_TOKEN }}
114+
skip_existing: true

MANIFEST.in

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
include LICENSE
2+
include README.md
3+
include pyproject.toml
4+
recursive-include uniception *.py
5+
recursive-include uniception *.pyx
6+
recursive-include uniception *.pxd
7+
recursive-include uniception *.c
8+
recursive-include uniception *.h
9+
recursive-include uniception *.cu
10+
recursive-include uniception *.cuh
11+
recursive-include uniception *.so
12+
recursive-include uniception *.dll
13+
recursive-include uniception *.dylib
14+
recursive-include uniception *.json
15+
recursive-include uniception *.yaml
16+
recursive-include uniception *.yml
17+
recursive-include uniception *.md
18+
recursive-include scripts *.py

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,26 @@ Please refer to the [Developer Guidelines](#developer-guidelines) for contributi
77

88
## Installation
99

10+
### Install from PyPI
11+
12+
The easiest way to install UniCeption is from PyPI:
13+
14+
```bash
15+
# Install with base dependencies
16+
pip install uniception
17+
18+
# Optional: Install with XFormers support
19+
pip install "uniception[xformers]"
20+
21+
# Optional: Install with development tools
22+
pip install "uniception[dev]"
23+
24+
# Optional: Install all optional dependencies
25+
pip install "uniception[all]"
26+
```
27+
28+
### Install from Source
29+
1030
Clone the repository to your local machine by running the following command:
1131

1232
```bash

pyproject.toml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,65 @@
1+
[build-system]
2+
requires = ["setuptools>=42", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools]
6+
packages = ["uniception", "scripts"]
7+
8+
[project]
9+
name = "uniception"
10+
version = "0.1.1"
11+
description = "Generalizable Perception Stack for 3D, 4D, spatial AI and scene understanding"
12+
readme = "README.md"
13+
authors = [
14+
{name = "AirLab", email = "[email protected]"}
15+
]
16+
license = {text = "BSD 3-Clause"}
17+
requires-python = ">=3.10"
18+
classifiers = [
19+
"Development Status :: 3 - Alpha",
20+
"Intended Audience :: Developers",
21+
"Intended Audience :: Science/Research",
22+
"Programming Language :: Python :: 3",
23+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
24+
"Topic :: Software Development :: Libraries :: Python Modules",
25+
]
26+
keywords = ["computer-vision", "3d-vision", "spatial-ai", "perception", "deep-learning", "pytorch"]
27+
dependencies = [
28+
"numpy",
29+
"torch",
30+
"torchvision",
31+
"torchaudio",
32+
"jaxtyping",
33+
"matplotlib",
34+
"Pillow",
35+
"scikit-learn",
36+
"einops",
37+
"rerun-sdk",
38+
"minio",
39+
]
40+
41+
[project.urls]
42+
"Homepage" = "https://github.com/castacks/UniCeption"
43+
"Bug Tracker" = "https://github.com/castacks/UniCeption/issues"
44+
"Documentation" = "https://github.com/castacks/UniCeption/blob/main/README.md"
45+
46+
[project.optional-dependencies]
47+
xformers = ["xformers"]
48+
dev = [
49+
"black",
50+
"isort",
51+
"pre-commit",
52+
"pytest",
53+
]
54+
all = ["xformers", "black", "isort", "pre-commit", "pytest"]
55+
56+
[project.scripts]
57+
uniception-download-checkpoints = "scripts.download_checkpoints:main"
58+
uniception-validate = "scripts.validate_installation:main"
59+
uniception-prepare-offline = "scripts.prepare_offline_install:main"
60+
uniception-check-deps = "scripts.check_dependencies:main"
61+
uniception-install-croco = "scripts.install_croco_rope:main"
62+
163
[tool.black]
264
line-length = 120
365
include = '\.pyi?$'

scripts/__init__.py

Whitespace-only changes.

scripts/prepare_offline_install.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ def create_requirements_files(temp_dir: Path, extras: list = None):
9898
"torch",
9999
"torchvision",
100100
"torchaudio",
101-
"timm",
102101
"black",
103102
"jaxtyping",
104103
"matplotlib",
@@ -143,7 +142,6 @@ def create_offline_installation_files(output_dir: Path):
143142
"torch",
144143
"torchvision",
145144
"torchaudio",
146-
"timm",
147145
"black",
148146
"jaxtyping",
149147
"matplotlib",

scripts/validate_installation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def check_dependencies():
3838
"torchvision": "TorchVision",
3939
"torchaudio": "TorchAudio",
4040
"xformers": "XFormers",
41-
"timm": "Timm (PyTorch Image Models)",
4241
"einops": "Einops",
4342
"matplotlib": "Matplotlib",
4443
"numpy": "NumPy",

0 commit comments

Comments
 (0)