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

Names containing underscores in extra_options in setup.cfg are broken #618

Closed
omsai opened this issue Nov 13, 2023 · 6 comments
Closed

Names containing underscores in extra_options in setup.cfg are broken #618

omsai opened this issue Nov 13, 2023 · 6 comments
Assignees
Labels

Comments

@omsai
Copy link
Contributor

omsai commented Nov 13, 2023

Bug description
pyabc provides several optional extras, however those that contain underscores in their name cannot be installed.

The extras as of 0.12.14 are:

from importlib_metadata import metadata
from pprint import pprint

pprint(metadata('pyabc').get_all('Provides-Extra'))
['r',
 'amici',
 'autograd',
 'copasi',
 'doc',
 'examples',
 'julia',
 'migrate',
 'ot',
 'petab',
 'plotly',
 'pyarrow',
 'test',
 'test_petab',
 'webserver_dash',
 'webserver_flask',
 'yaml2sbml']

Expected behavior
The name of the optional extra should be recognized and install correctly.

To reproduce

Output from trying to install each of them:

# pyproject.toml.in
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]

[project]
name = "cal"
version = "0.1"
dependencies = ["pyabc[@EXTRA@] @git+https://github.com/ICB-DCM/pyABC#egg=v0.12.14"]

[tool.hatch.metadata]
allow-direct-references = true
$ extras="r amici autograd copasi doc examples julia migrate ot petab plotly"
$ extras+=" pyarrow test test_petab webserver_dash webserver_flask yaml2sbml"
$ for extra in $extras
>  do sed "s/@EXTRA@/$extra/" < pyproject.toml.in > pyproject.toml
> hatch project metadata
> hatch run test
> done
...
    "dependencies": [
        "pyabc[test-petab]@ git+https://github.com/ICB-DCM/pyABC#egg=v0.12.14"
    ]
}
WARNING: pyabc 0.12.14 does not provide the extra 'test-petab'
...
    "dependencies": [
        "pyabc[webserver-dash]@ git+https://github.com/ICB-DCM/pyABC#egg=v0.12.14"
    ]
}
WARNING: pyabc 0.12.14 does not provide the extra 'webserver-dash'
...
    "dependencies": [
        "pyabc[webserver-flask]@ git+https://github.com/ICB-DCM/pyABC#egg=v0.12.14"
    ]
}
WARNING: pyabc 0.12.14 does not provide the extra 'webserver-flask'
...

Environment

  • pyabc 0.12.14 from GitHub
  • Python 3.11.5
  • macOS
@omsai omsai added the bug label Nov 13, 2023
@omsai omsai changed the title Named containing underscores in extra_options in setup.cfg are broken Names containing underscores in extra_options in setup.cfg are broken Nov 13, 2023
@stephanmg
Copy link
Collaborator

Thanks for reporting, related to setuptools issue reported here: pypa/setuptools#2522

@stephanmg
Copy link
Collaborator

@omsai could you try fix_extra branch, it should resolve your problem.

@stephanmg stephanmg self-assigned this Nov 14, 2023
@omsai
Copy link
Contributor Author

omsai commented Nov 14, 2023

@stephanmg It only fixes test-petab but not web server-dash or web server-flask and I see that the latter two are unchanged in the diff main...fix_extra

--- /tmp/abc/pyproject.toml.in.orig	2023-11-14 11:01:46
+++ /tmp/abc/pyproject.toml.in	2023-11-14 11:05:38
@@ -5,7 +5,7 @@
 [project]
 name = "cal"
 version = "0.1"
-dependencies = ["pyabc[@EXTRA@] @git+https://github.com/ICB-DCM/pyABC#egg=v0.12.14"]
+dependencies = ["pyabc[@EXTRA@] @git+https://github.com/ICB-DCM/pyABC@fix_extra"]
 
 [tool.hatch.metadata]
 allow-direct-references = true
$ extras="test_petab webserver_dash webserver_flask"
$ for extra in $extras
> do sed "s/@EXTRA@/$extra/" < pyproject.toml.in > pyproject.toml
> hatch project metadata
> hatch run test
{
    "name": "cal",
    "version": "0.1",
    "readme": {
        "content-type": "text/markdown",
        "text": ""
    },
    "dependencies": [
        "pyabc[test-petab]@ git+https://github.com/ICB-DCM/pyABC@fix_extra"
    ]
}
{
    "name": "cal",
    "version": "0.1",
    "readme": {
        "content-type": "text/markdown",
        "text": ""
    },
    "dependencies": [
        "pyabc[webserver-dash]@ git+https://github.com/ICB-DCM/pyABC@fix_extra"
    ]
}
WARNING: pyabc 0.12.14 does not provide the extra 'webserver-dash'
{
    "name": "cal",
    "version": "0.1",
    "readme": {
        "content-type": "text/markdown",
        "text": ""
    },
    "dependencies": [
        "pyabc[webserver-flask]@ git+https://github.com/ICB-DCM/pyABC@fix_extra"
    ]
}
WARNING: pyabc 0.12.14 does not provide the extra 'webserver-flask'

@stephanmg
Copy link
Collaborator

stephanmg commented Nov 15, 2023

True @omsai I must have forgotten to change dependencies for this. Could you give the branch fix_dependencies a try?

@omsai
Copy link
Contributor Author

omsai commented Nov 15, 2023

@stephanmg Yes, it works now in that branch; thank you!

@omsai omsai closed this as completed Nov 15, 2023
@stephanmg
Copy link
Collaborator

Alright @omsai - it will remain in develop branch until next bug fix release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants