Skip to content

Commit 0f52901

Browse files
committed
Include basic Poetry details in generated README
Closes #13 Also made a regen-golden-master.py in order to make updating easier.
1 parent a3842bc commit 0f52901

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

openapi_python_client/templates/README.md

+15
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,18 @@ Things to know:
3535
1. If the API returns a response code that was not declared in the OpenAPI document, a
3636
`{{ package_name }}.api.errors.ApiResponseError` wil be raised
3737
with the `response` attribute set to the `httpx.Response` that was received.
38+
39+
40+
## Building / publishing this Client
41+
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
42+
1. Update the metadata in pyproject.toml (e.g. authors, version)
43+
1. If you're using a private repository, configure it with Poetry
44+
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
45+
1. `poetry config http-basic.<your-repository-name> <username> <password>`
46+
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
47+
48+
If you want to install this client into another project without publishing it (e.g. for development) then:
49+
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
50+
1. If that project is not using Poetry:
51+
1. Build a wheel with `poetry build -f wheel`
52+
1. Install that wheel from the other project `pip install <path-to-wheel>`

tests/test_end_to_end/golden-master/README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,19 @@ Things to know:
3434
1. Any endpoint which did not have a tag will be in `my_test_api_client.api.default`
3535
1. If the API returns a response code that was not declared in the OpenAPI document, a
3636
`my_test_api_client.api.errors.ApiResponseError` wil be raised
37-
with the `response` attribute set to the `httpx.Response` that was received.
37+
with the `response` attribute set to the `httpx.Response` that was received.
38+
39+
40+
## Building / publishing this Client
41+
This project uses [Poetry](https://python-poetry.org/) to manage dependencies and packaging. Here are the basics:
42+
1. Update the metadata in pyproject.toml (e.g. authors, version)
43+
1. If you're using a private repository, configure it with Poetry
44+
1. `poetry config repositories.<your-repository-name> <url-to-your-repository>`
45+
1. `poetry config http-basic.<your-repository-name> <username> <password>`
46+
1. Publish the client with `poetry publish --build -r <your-repository-name>` or, if for public PyPI, just `poetry publish --build`
47+
48+
If you want to install this client into another project without publishing it (e.g. for development) then:
49+
1. If that project **is using Poetry**, you can simply do `poetry add <path-to-this-client>` from that project
50+
1. If that project is not using Poetry:
51+
1. Build a wheel with `poetry build -f wheel`
52+
1. Install that wheel from the other project `pip install <path-to-wheel>`
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
""" Regenerate golden-master """
2+
import shutil
3+
from pathlib import Path
4+
5+
from typer.testing import CliRunner
6+
7+
from openapi_python_client.cli import app
8+
9+
10+
if __name__ == '__main__':
11+
runner = CliRunner()
12+
openapi_path = Path(__file__).parent / "fastapi" / "openapi.json"
13+
gm_path = Path(__file__).parent / "golden-master"
14+
shutil.rmtree(gm_path)
15+
output_path = Path.cwd() / "my-test-api-client"
16+
17+
runner.invoke(app, ["generate", f"--path={openapi_path}"])
18+
19+
output_path.rename(gm_path)

tests/test_end_to_end/test_end_to_end.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import os
21
import shutil
32
from filecmp import cmpfiles, dircmp
43
from pathlib import Path

0 commit comments

Comments
 (0)