Skip to content
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

MAINT: pyproject.toml, docs #129

Merged
merged 45 commits into from
May 30, 2023
Merged

MAINT: pyproject.toml, docs #129

merged 45 commits into from
May 30, 2023

Conversation

jklenzing
Copy link
Member

@jklenzing jklenzing commented Oct 26, 2022

Description

Addresses pysat/pysat#1051

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

  • Moves metadata and settings to pyproject.toml
  • flake8 settings in setup.cfg
  • Uses optional install syntax to deploy test and doc suites to github actions
  • updates GA for new versions
  • Fixes issue where NEP29 case reinstalls latest numpy anyway
  • Update installation instructions
  • Fixes broken links in docs

Changes in development flow

  • version now specified in pyproject.toml. Code extracts __version__ from this
  • requirements files no longer needed. can use optional install to access test and doc requirements
  • local installation through pip install . or pip install -e . for development case
  • build versions for pypi via python -m build
  • pytest coverage options stored in pyproject.toml, will run by default

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

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

Checklist:

  • Make sure you are merging into the develop (not main) branch
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • Add a note to CHANGELOG.md, summarizing the changes
  • Update zenodo.json file for new code contributors

@jklenzing jklenzing changed the title Sty/pyproject MAINT: pyproject.toml, docs Oct 26, 2022
docs/installation.rst Outdated Show resolved Hide resolved
pyproject.toml Outdated

[project]
name = "pysatNASA"
version = "0.0.4.1"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used for test pypi. fix before merge

.github/workflows/main.yml Outdated Show resolved Hide resolved
@jklenzing jklenzing marked this pull request as ready for review October 26, 2022 15:51
@jklenzing jklenzing marked this pull request as draft October 27, 2022 15:21
@jklenzing
Copy link
Member Author

jklenzing commented Oct 31, 2022

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.

.github/workflows/main.yml Outdated Show resolved Hide resolved
.github/workflows/main.yml Outdated Show resolved Hide resolved
@jklenzing
Copy link
Member Author

Can you also add the test for the operational system?

Configuring the operational test is breaking, not sure why.

@aburrell
Copy link
Member

Configuring the operational test is breaking, not sure why.

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

@jklenzing
Copy link
Member Author

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
Copy link
Member

aburrell commented May 17, 2023

Here's your problem: googleapis/python-api-core#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 googleapis/python-api-core#27 (comment)

@jklenzing
Copy link
Member Author

@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
Copy link
Member Author

@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
Copy link

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

@aburrell
Copy link
Member

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.

Copy link
Member

@aburrell aburrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

There are a few ways you can do this:

A. Install on the system (root privileges required)::


sudo python setup.py install
sudo pip install .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might need to run python -m build first.

@jklenzing jklenzing changed the base branch from tst/rc_fix to develop May 25, 2023 11:55
@jklenzing jklenzing merged commit 71b8074 into develop May 30, 2023
@jklenzing jklenzing deleted the sty/pyproject branch May 30, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants