Skip to content

Switch to UV, publish to pypi #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@

name: codegen_api_client Python package

on: [push, pull_request]
on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
build:
Expand All @@ -17,15 +23,11 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- name: Set up UV ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
- name: Test with pytest
run: |
pytest --cov=codegen_api_client
uv run pytest --cov=codegen_api_client
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: codegen_api_client Build and Release

on:
push:
branches:
- develop

jobs:
build-and-release:
environment: release

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up UV
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Build
run: |
uv build
- name: Publish
run: |
uv publish
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,20 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
Python 3.8+

## Installation & Usage
### pip install

### uv sync

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

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

Then import the package:
```python
import codegen_api_client
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import codegen_api_client
```

### Tests

Expand Down
64 changes: 31 additions & 33 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,43 @@
[tool.poetry]
[project]
name = "codegen_api_client"
version = "1.0.0"
description = "Developer API"
authors = ["OpenAPI Generator Community <team@openapitools.org>"]
license = "NoLicense"
authors = [{ name = "OpenAPI Generator Community", email = "team@openapitools.org" }]
requires-python = "~=3.8"
readme = "README.md"
repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID"
keywords = ["OpenAPI", "OpenAPI-Generator", "Developer API"]
include = ["codegen_api_client/py.typed"]

[tool.poetry.dependencies]
python = "^3.8"
license = "Apache-2.0"
keywords = [
"OpenAPI",
"OpenAPI-Generator",
"Developer API",
]
dependencies = [
"urllib3>= 1.25.3, < 3.0.0",
"python-dateutil>= 2.8.2",
"pydantic>= 2",
"typing-extensions>= 4.7.1",
]

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

[tool.poetry.dev-dependencies]
pytest = ">= 7.2.1"
pytest-cov = ">= 2.8.1"
tox = ">= 3.9.0"
flake8 = ">= 4.0.0"
types-python-dateutil = ">= 2.8.19.14"
mypy = ">= 1.5"
[dependency-groups]
dev = [
"pytest>= 7.2.1",
"pytest-cov>= 2.8.1",
"tox>= 3.9.0",
"flake8>= 4.0.0",
"types-python-dateutil>= 2.8.19.14",
"mypy>= 1.5",
]

[tool.uv.build-backend]
module-root=""
data = ["codegen_api_client/py.typed"]

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
requires = ["uv_build>=0.6,<0.7"]
build-backend = "uv_build"

[tool.pylint.'MESSAGES CONTROL']
extension-pkg-whitelist = "pydantic"
Expand Down Expand Up @@ -60,17 +69,6 @@ disallow_subclassing_any = true
disallow_untyped_decorators = true
disallow_any_generics = true

### These next few are various gradations of forcing use of type annotations
#disallow_untyped_calls = true
#disallow_incomplete_defs = true
#disallow_untyped_defs = true
#
### This one isn't too hard to get passing, but return on investment is lower
#no_implicit_reexport = true
#
### This one can be tricky to get passing if you use a lot of untyped libraries
#warn_return_any = true

[[tool.mypy.overrides]]
module = [
"codegen_api_client.configuration",
Expand Down
4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

49 changes: 0 additions & 49 deletions setup.py

This file was deleted.

6 changes: 0 additions & 6 deletions test-requirements.txt

This file was deleted.

Loading