-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Python][Client] pure library client package #470
[Python][Client] pure library client package #470
Conversation
@@ -198,10 +200,21 @@ public void processOpts() { | |||
setPackageVersion("1.0.0"); | |||
} | |||
|
|||
if (additionalProperties.containsKey(CodegenConstants.ONLYPACKAGE_GENERATION)) { | |||
setOnlyPackage(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a new feature, and is not overriding an inherited functionality. The pattern used for excludeTests
would seem to be a better match. ie using a local method variable instead of having a class variable with getter/setter.
Thanks for the PR! |
LGTM! |
@kenjones-cisco you're right, a local variable makes more sense. I've pushed that change up 👍 |
the fail in the CI is normal I think, something related to the spring-mvc-j8-localdatetime sample |
Is it not already possible to generate this with the existing selector options ? |
What about using ".openapi-generator-ignore" to skip those files? |
I usually don't want to fully skip them, just generate them somewhere else. For example, if there is already a docs/ folder in my project, and I auto-generate there, openapi-generator would interfere with it. docs/ inside the package folder is good, same for tests, same for the readme.md. I've tested a lot of setups (ignoring files, copying the files after generation), and I feel like the simplest is having a flag for the generator. All in all, I feel like generating a library instead of a Pypi package should be an option :-) |
@rienafairefr as discussed, please name the option as "generateSourceCodeOnly" (default: false). |
OK, I just renamed the option to generateSourceCodeOnly 👍 |
I rebased on latest master to remove the merge conflict due to version number change (master at 3.1.1 instead of 3.1.0 if I understood correctly) |
acada72
to
c4aa977
Compare
@rienafairefr thanks for the PR, which has been merged into the master. |
@wing328 You're welcome 👍 |
FWIW, having the library code in the same repo as your implementation code seems to be a bad pattern (maybe okay for POC). Why not just put the python client in it's own repo then do |
* Python client pure library package * check onlyPackage CLI option * run /bin/python-petstore.sh, update the python samples for CI * onlyPackage local variable instead of classp property * fix CI: __future__ absolute_import must be first in file * update samples * generateSourceCodeOnly * updated samples
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.-> Caveat I wasn't sure if I needed to commit the changes that happened after running /bin/python-petstore.sh, I commited them just in case
master
,3.1.x
,4.0.x
. Default:master
.@taxpon @frol @mbohlool @cbornet @kenjones-cisco
Description of the PR
A few times already, when using Swagger-codegen before also, I was thinking that all the supporting files for Python packages are a lot of the time unecessary. If you're building a package around auto-generated code, you'll be using it as a library and have your own setup.py, etc.
This PR adds a "onlyPackage" cli options ([...]generate [...] -l python -DonlyPackage [...]) (couldn't think of a better name, possibilities "libraryClient", "pureLibrary", ... IDK)
When this option is activated,