infarm / logicipi

A logging util for Python applications running on GCP
Apache License 2.0
2 stars 1 forks source link

Use setuptools for packaging. #57

Open mazzi opened 3 years ago

mazzi commented 3 years ago

Is your feature request related to a problem? Please describe. To be able to deploy on newer versions of python (3.8 onwards) we should provide packaging for logicipi

Describe the solution you'd like

Related:

barrachri commented 3 years ago

Do you need to export it to pypi?

blueyed commented 3 years ago

Do you need to export it to pypi?

This might help with (working around) the actual problem, which is that the python38 gcloud-functions-deploy mechanism apparently want to use a setup.py file, resulting in a FileNotFound error then (while it worked with python37, for unknown reasons).

% gcloud functions deploy … --entry-point=… --runtime=python38 --source=src/foo … --quiet
…
Deploying function (may take a while - up to 2 minutes)...
...  ...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: ...
  Building wheel for grpc-google-iam-v1 (setup.py): started
  Building wheel for grpc-google-iam-v1 (setup.py): finished with status 'done'
  Created wheel for grpc-google-iam-v1: filename=grpc_google_iam_v1-0.12.3-py3-none-any.whl size=18499 sha256=3b1e5e194996989cd9bac7f3d1ff1c4f45c00fb14ac41f30bad69d3243092148
  Stored in directory: /layers/google.python.pip/pipcache/wheels/8f/b9/13/fce3d62261f63c01b28281fe6a9d704a7af65d96ff2c88552e
Successfully built ciso8601 grpc-google-iam-v1
Installing collected packages: …, logicipi, …
  Attempting uninstall: setuptools
    Found existing installation: setuptools 56.0.0
    Uninstalling setuptools-56.0.0:
      Successfully uninstalled setuptools-56.0.0
  Attempting uninstall: pyparsing
    Found existing installation: pyparsing 2.4.7
    Uninstalling pyparsing-2.4.7:
      Successfully uninstalled pyparsing-2.4.7
  Attempting uninstall: packaging
    Found existing installation: packaging 20.9
    Uninstalling packaging-20.9:
      Successfully uninstalled packaging-20.9
  Running setup.py develop for logicipi
    ERROR: Command errored out with exit status 1:
     command: /layers/google.python.pip/pip/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/layers/google.python.pip/pip/src/logicipi/setup.py'"'"'; __file__='"'"'/layers/google.python.pip/pip/src/logicipi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
         cwd: /layers/google.python.pip/pip/src/logicipi/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/opt/python3.8/lib/python3.8/tokenize.py", line 392, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/layers/google.python.pip/pip/src/logicipi/setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: …

The requirements.txt file has (likely) logicipi @ git+https://github.com/infarm/logicipi.git@master ; python_version >= "3.7" and python_version < "4.0"

https://github.com/infarm/logicipi/pull/53 might be related, but does not state what it was fixing. (i.e. something along pip/setuptools might be too old with the python38 environment, or it is just buggy in that regard. Also there might be an option to control this behavior of (not) doing a develop-install via setup.py)