pysat / pysatNASA

pysat support for NASA Instruments
BSD 3-Clause "New" or "Revised" License
21 stars 6 forks source link

MAINT: pyproject.toml, docs #129

Closed jklenzing closed 1 year ago

jklenzing commented 2 years ago

Description

Addresses https://github.com/pysat/pysat/issues/1051

Support for setup.py in pip has been deprecated. This brings the package up to standard.

Changes in development flow

Type of change

How Has This Been Tested?

Inspection of pypi test page at: https://test.pypi.org/simple/pysatNASA

Checklist:

jklenzing commented 2 years ago

Note from RC tests with pysatModels: something is clearly not set up correctly in the toml. Error info below. Possibly just needs setuptools minimum version

Run pip install --no-deps -i https://test.pypi.org/simple/ pysatNASA
Looking in indexes: https://test.pypi.org/simple/
Collecting pysatNASA
  Downloading https://test-files.pythonhosted.org/packages/9b/33/674f09bbd844fa9759840c752bfeacaf99c520f57019d1655ee52dde2956/pysatNASA-0.0.4.1.tar.gz (54 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 54.9/54.9 kB 6.7 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      Looking in indexes: https://test.pypi.org/simple/
      ERROR: Could not find a version that satisfies the requirement setuptools (from versions: none)
      ERROR: No matching distribution found for setuptools
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
Error: Process completed with exit code 1.
jklenzing commented 1 year ago

As a test case, I left a few metadata entries in setup.cfg and made an upload to test pypi.

https://test.pypi.org/project/pysatNASA/0.0.5.dev0/

in pyproject:

[project]
name = "pysatNASA"
version = "0.0.5dev0"
description = "pysat support for NASA Instruments"
readme = "README.md"
requires-python = ">=3.8"
license = {file = "LICENSE"}
authors = [
    {name = "Jeff Klenzing, et al", email = "pysat.developers@gmail.com"},
]

in setup.cfg:

[metadata]
name = pysatNASA
author = pysat Team

The compiled distribution takes the author name from setup and the email contact from pyproject. We should probably choose one or the other to maintain metadata.

jklenzing commented 1 year ago

Now downstream of #168 since fixes are required to run on github actions

jklenzing commented 1 year ago

Can you also add the test for the operational system?

Configuring the operational test is breaking, not sure why.

aburrell commented 1 year ago

Configuring the operational test is breaking, not sure why.

Let me know if you want me to take a look.

jklenzing commented 1 year ago

Let me know if you want me to take a look.

Here's the log:

https://github.com/pysat/pysatNASA/actions/runs/4988176634/jobs/8930652380

aburrell commented 1 year ago

Here's your problem: https://github.com/googleapis/python-api-core/issues/27

Use of pkg_resources is deprecated, and should be replaced with importlib.metadata.version('pysatNASA'). For Python 3.6 we'll need to require importlib_metadata to do the same thing. Specifically:

FWIW, both pkg_resources and directly invoking setup.py install are semi-deprecated and are mostly unsupported.

The replacement for pkg_resources.distribution(...).version is importlib.metadata.version(...) (backported to pre-3.7 Python as importlib_metadata), though I doubt that will solve anyone's problem if the installation metadata is simply not present.

More context about the setup.py install deprecation here, but the short answer is that you should always prefer pip install to setup.py install, even in a package manager. A few people (particularly those involved in Arch linux packaging) have been working on minimal PEP 517 build frontend to build wheels and a minimal wheel installer, so possibly early adoption of those technologies will work better for you [original user].

Originally posted by @pganssle in https://github.com/googleapis/python-api-core/issues/27#issuecomment-676563754

jklenzing commented 1 year ago

@aburrell, that works to a point. Still getting

E   importlib_metadata.PackageNotFoundError: No package metadata was found for pysatNASA

It looks like the metadata is not being configured correctly for this version. I've tried updated the backend to the legacy version. Any other thoughts?

jklenzing commented 1 year ago

@aburrell, that works to a point. Still getting

E   importlib_metadata.PackageNotFoundError: No package metadata was found for pysatNASA

It looks like the metadata is not being configured correctly for this version. I've tried updated the backend to the legacy version. Any other thoughts?

If I add metadata to the setup.cfg, it works. Probably worth a discussion about which metadata we want to store where at the next meeting.

PureTryOut commented 1 year ago

Please don't mention me in projects I'm not related too.

aburrell commented 1 year ago

If I add metadata to the setup.cfg, it works.

Well at least there's a path forward. We may need to keep using setup.cfg for a while.