Skip to content

Commit a8b6af8

Browse files
authored
Switch to UV, publish to pypi (#1)
1 parent 5b39914 commit a8b6af8

File tree

9 files changed

+1166
-119
lines changed

9 files changed

+1166
-119
lines changed

.github/workflows/python.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55

66
name: codegen_api_client Python package
77

8-
on: [push, pull_request]
8+
on:
9+
push:
10+
branches:
11+
- develop
12+
pull_request:
13+
branches:
14+
- develop
915

1016
jobs:
1117
build:
@@ -17,15 +23,11 @@ jobs:
1723

1824
steps:
1925
- uses: actions/checkout@v4
20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v4
26+
- name: Set up UV ${{ matrix.python-version }}
27+
uses: astral-sh/setup-uv@v5
2228
with:
29+
enable-cache: true
2330
python-version: ${{ matrix.python-version }}
24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
pip install -r requirements.txt
28-
pip install -r test-requirements.txt
2931
- name: Test with pytest
3032
run: |
31-
pytest --cov=codegen_api_client
33+
uv run pytest --cov=codegen_api_client

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: codegen_api_client Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
build-and-release:
10+
environment: release
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up UV
17+
uses: astral-sh/setup-uv@v5
18+
with:
19+
enable-cache: true
20+
- name: Build
21+
run: |
22+
uv build
23+
- name: Publish
24+
run: |
25+
uv publish

README.md

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,20 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
1313
Python 3.8+
1414

1515
## Installation & Usage
16-
### pip install
16+
17+
### uv sync
1718

1819
If the python package is hosted on a repository, you can install directly using:
1920

2021
```sh
21-
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
22+
uv pip install codegen-api-client
2223
```
23-
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
2424

2525
Then import the package:
2626
```python
2727
import codegen_api_client
2828
```
2929

30-
### Setuptools
31-
32-
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
33-
34-
```sh
35-
python setup.py install --user
36-
```
37-
(or `sudo python setup.py install` to install the package for all users)
38-
39-
Then import the package:
40-
```python
41-
import codegen_api_client
42-
```
4330

4431
### Tests
4532

pyproject.toml

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,43 @@
1-
[tool.poetry]
1+
[project]
22
name = "codegen_api_client"
33
version = "1.0.0"
44
description = "Developer API"
5-
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
6-
license = "NoLicense"
5+
authors = [{ name = "OpenAPI Generator Community", email = "team@openapitools.org" }]
6+
requires-python = "~=3.8"
77
readme = "README.md"
8-
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
9-
keywords = ["OpenAPI", "OpenAPI-Generator", "Developer API"]
10-
include = ["codegen_api_client/py.typed"]
11-
12-
[tool.poetry.dependencies]
13-
python = "^3.8"
8+
license = "Apache-2.0"
9+
keywords = [
10+
"OpenAPI",
11+
"OpenAPI-Generator",
12+
"Developer API",
13+
]
14+
dependencies = [
15+
"urllib3>= 1.25.3, < 3.0.0",
16+
"python-dateutil>= 2.8.2",
17+
"pydantic>= 2",
18+
"typing-extensions>= 4.7.1",
19+
]
1420

15-
urllib3 = ">= 1.25.3, < 3.0.0"
16-
python-dateutil = ">= 2.8.2"
17-
pydantic = ">= 2"
18-
typing-extensions = ">= 4.7.1"
21+
[project.urls]
22+
Repository = "https://github.com/codegen-sh/codegen-api-client"
1923

20-
[tool.poetry.dev-dependencies]
21-
pytest = ">= 7.2.1"
22-
pytest-cov = ">= 2.8.1"
23-
tox = ">= 3.9.0"
24-
flake8 = ">= 4.0.0"
25-
types-python-dateutil = ">= 2.8.19.14"
26-
mypy = ">= 1.5"
24+
[dependency-groups]
25+
dev = [
26+
"pytest>= 7.2.1",
27+
"pytest-cov>= 2.8.1",
28+
"tox>= 3.9.0",
29+
"flake8>= 4.0.0",
30+
"types-python-dateutil>= 2.8.19.14",
31+
"mypy>= 1.5",
32+
]
2733

34+
[tool.uv.build-backend]
35+
module-root=""
36+
data = ["codegen_api_client/py.typed"]
2837

2938
[build-system]
30-
requires = ["setuptools"]
31-
build-backend = "setuptools.build_meta"
39+
requires = ["uv_build>=0.6,<0.7"]
40+
build-backend = "uv_build"
3241

3342
[tool.pylint.'MESSAGES CONTROL']
3443
extension-pkg-whitelist = "pydantic"
@@ -60,17 +69,6 @@ disallow_subclassing_any = true
6069
disallow_untyped_decorators = true
6170
disallow_any_generics = true
6271

63-
### These next few are various gradations of forcing use of type annotations
64-
#disallow_untyped_calls = true
65-
#disallow_incomplete_defs = true
66-
#disallow_untyped_defs = true
67-
#
68-
### This one isn't too hard to get passing, but return on investment is lower
69-
#no_implicit_reexport = true
70-
#
71-
### This one can be tricky to get passing if you use a lot of untyped libraries
72-
#warn_return_any = true
73-
7472
[[tool.mypy.overrides]]
7573
module = [
7674
"codegen_api_client.configuration",

requirements.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 49 deletions
This file was deleted.

test-requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)