Skip to content

Commit 9064b26

Browse files
committed
A new start
0 parents  commit 9064b26

32 files changed

+4226
-0
lines changed

Diff for: .github/workflows/ci.yaml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
jobs:
11+
Linting:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.10"]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- uses: actions/cache@v2
25+
with:
26+
path: ~/.cache/pip
27+
key: ${{ runner.os }}-pip
28+
29+
- name: Install Dependencies
30+
run: |
31+
pip install -r requirements-dev.txt
32+
33+
- name: Lint with ruff
34+
run: |
35+
make lint
36+
37+
Build:
38+
runs-on: ubuntu-latest
39+
# There is an issue with infinitely running tests when something fails due to failure to close the WebSocket, so we set a timeout.
40+
timeout-minutes: 5
41+
strategy:
42+
matrix:
43+
# If we test it against too many versions, we are making unnecessary
44+
# requests to the production server.
45+
python-version: ["3.8", "3.10"]
46+
47+
steps:
48+
- uses: actions/checkout@v4
49+
- name: Set up Python ${{ matrix.python-version }}
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: ${{ matrix.python-version }}
53+
54+
# See https://adamj.eu/tech/2023/11/02/github-actions-faster-python-virtual-environments/
55+
- name: Cache virtualenv
56+
uses: actions/cache@v3
57+
with:
58+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
59+
path: .venv
60+
61+
- name: Activate virtualenv
62+
run: |
63+
python -m venv .venv
64+
source .venv/bin/activate
65+
make install-dev
66+
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
67+
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
68+
69+
- name: Test with pytest
70+
env: # Or as an environment variable
71+
CARTESIA_API_KEY: ${{ secrets.TESTING_CARTESIA_API_KEY }}
72+
CARTESIA_TEST_DEPRECATED: "true"
73+
run: |
74+
make test

Diff for: .github/workflows/publish.yaml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
# if the version.py changes, we should re-publish
8+
# this also allows us to run the workflow manually without skipping.
9+
- 'cartesia/version.py'
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
publish:
16+
# Only run publishing when the commit message contains [bumpversion]
17+
# Auto-generated branches will be [bB]umpversion/<version>, so we also check for that.
18+
runs-on: ubuntu-latest
19+
environment:
20+
name: pypi
21+
url: https://pypi.org/p/cartesia
22+
# TODO: Make permissions more restrictive
23+
permissions: write-all
24+
env:
25+
commitmsg: ${{ github.event.head_commit.message }}
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
- name: Set up Python
30+
uses: actions/setup-python@v4
31+
with:
32+
python-version: "3.10"
33+
34+
- uses: actions/cache@v2
35+
with:
36+
path: ~/.cache/pip
37+
key: ${{ runner.os }}-pip
38+
39+
- name: Print commit message
40+
run: echo "Commit MSG = ${commitmsg}"
41+
42+
- name: Install Dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
pip install -e ".[all]"
46+
pip install importlib_metadata==7.2.1
47+
48+
- name: Build PyPI
49+
run: |
50+
python setup.py upload --skip-upload
51+
twine check dist/*
52+
53+
- name: Publish distribution 📦 to PyPI
54+
uses: pypa/gh-action-pypi-publish@release/v1
55+
with:
56+
password: ${{ secrets.PYPI_API_TOKEN }}
57+
verbose: true
58+
59+
- name: Get version
60+
run: |
61+
export CARTESIA_PYTHON_VERSION=$(grep -o '".*"' cartesia/version.py | sed 's/"//g')
62+
echo "CARTESIA_PYTHON_VERSION=${CARTESIA_PYTHON_VERSION}" >> $GITHUB_ENV
63+
64+
- name: Verify version
65+
run: echo ${{ env.CARTESIA_PYTHON_VERSION }}
66+
67+
- name: Bump version and push tag
68+
id: tag_version
69+
uses: mathieudutour/[email protected]
70+
with:
71+
github_token: ${{ secrets.GITHUB_TOKEN }}
72+
custom_tag: ${{ env.CARTESIA_PYTHON_VERSION }}

Diff for: .gitignore

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
data.tar.gz
2+
*.pth
3+
*.tsf
4+
*.ckpt
5+
.ipynb_checkpoints
6+
*/.ipynb_checkpoints/*
7+
*.lprof
8+
9+
.DS_Store
10+
.idea/
11+
.vscode/
12+
outputs/
13+
outputs
14+
# logs can either be a directory or symlinked to a directory
15+
# ignore both
16+
logs/
17+
logs
18+
19+
data
20+
21+
# Created by https://www.gitignore.io/api/python
22+
# Edit at https://www.gitignore.io/?templates=python
23+
24+
### Python ###
25+
# Byte-compiled / optimized / DLL files
26+
__pycache__/
27+
*.py[cod]
28+
*$py.class
29+
30+
# C extensions
31+
*.so
32+
33+
# Distribution / packaging
34+
.Python
35+
build/
36+
develop-eggs/
37+
dist/
38+
downloads/
39+
eggs/
40+
.eggs/
41+
lib/
42+
lib64/
43+
parts/
44+
sdist/
45+
var/
46+
wheels/
47+
pip-wheel-metadata/
48+
share/python-wheels/
49+
*.egg-info/
50+
.installed.cfg
51+
*.egg
52+
MANIFEST
53+
54+
# pyenv
55+
.python-version
56+
57+
# scratch
58+
scratch/
59+
60+
# End of https://www.gitignore.io/api/python

Diff for: LICENSE.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Cartesia AI, Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Diff for: Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
install:
2+
pip install -e .
3+
4+
install-dev:
5+
pip install -e '.[dev]'
6+
pip install pytest pytest-cov
7+
8+
autoformat:
9+
isort --atomic .
10+
ruff format .
11+
12+
lint:
13+
isort -c .
14+
ruff check .
15+
ruff format --check .
16+
17+
test:
18+
pytest -ra tests/ -sv --cov=cartesia/ --log-cli-level=INFO

0 commit comments

Comments
 (0)