Asana / python-asana

Official Python client library for the Asana API v1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Importing asana package in databricks is throwing error "IndentationError"

dishaponganti opened this issue · comments

Just an 'import asana' line is throwing following error in databricks notebook
"IndentationError: expected an indented block after class definition on line 23 (attachments_api.py, line 24)"

Conda-forge won't be able to update to 4.0.5 because of this issue:
conda-forge/python-asana-feedstock#14

I just got the same error. I installed it via pip.

EDIT: It appears to be a regression introduced in 4.0.5 because 4.0.4 works fine.

Same error here - had no idea this would cause an error in python, but seems like the python docstring needs to be indented here.

I fixed all the indentation errors on this pull request. There was a class added on a few files that had improper indentation. Fix is here

Hi @dishaponganti good catch. Thank you for reporting this. I have gone ahead and fixed the indentation issue from this commit: 06a766d and a new version of the library with this fix has been published to v4.0.6.

@ShaynePaulus (PR) and @andrewjschuang (PR) thank you both for contributing and sending in a PR. I would have approved and merge your code had it been an edit of the api.mustache template file.

For context, our new python client library is generated using swagger-codegen. We've added our own custom template files which modifies the swagger default templates to customize our code generation.

If you would like to contribute in the future here's how you would go about generating the library locally for testing any modifications you've made to our custom templates:

  1. Clone this repo
  2. Download version 3.0.46 of Swagger Codegen:
wget -q -O swagger-codegen-cli.jar https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.46/swagger-codegen-cli-3.0.46.jar
  1. Build our custom codegen modules (NOTE: you'll need to have java installed on your machine and maven)
cd codegen/swagger
mvn package
cd ../../
  1. Run the code generation command:
java -cp "codegen/swagger/target/AsanaClientCodegen-swagger-codegen-1.0.0.jar:swagger-codegen-cli.jar" \
io.swagger.codegen.v3.cli.SwaggerCodegen \
generate \
--input-spec https://raw.githubusercontent.com/Asana/openapi/master/defs/asana_sdk_oas.yaml \
--template-dir "codegen/templates" \
--lang "com.asana.codegen.PythonClientCodegenGenerator" \
-DpackageName=asana \
--additional-properties "projectVersion=1.0.0,projectName=asana,packageName=asana"
  1. Test locally (TIP: create a python virtual environment to prevent any overlap with other installs)
pip install -e <LOCATION_OF_THIS_REPO_ON_YOUR_COMPUTER>

These steps are basically what we use in our publish.yaml GitHub Action to build and publish our python client library so you can always look there as well.

If you have any questions about this, feel free to reply to me and let me know. Thanks again everyone for contributing and reporting issues. This will help us greatly improve the quality of our python client library.