Skip to content

Commit

Permalink
make package name in sdist .tar.gz filename conform to specs (using…
Browse files Browse the repository at this point in the history
… underscores)

The official specs for sdist file names require that the package name is in snake case, see these places:
* https://peps.python.org/pep-0625/#specification
* https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode
* https://peps.python.org/pep-0491/#escaping-and-unicode

[`poetry` switched to conforming to these specs with version `1.2.2`](https://github.com/python-poetry/poetry/releases/tag/1.2.2), see:
* poetry-core pull request with the actual code changes: python-poetry/poetry-core#484
* poetry pull request pulling them in: python-poetry/poetry#6621

Thus, all (bio-)conda recipes whose sources are built with `poetry` and uploaded to pypi are likely to face the same issue.

As `snakemake-wrapper-utils` only contains hyphens (`-`) as non-word characters, the suggested `replace("-","_")` should be safe and enough.

But a thorough solution should be implemented in `grayskull` (that does conda recipe templating for pypi packages), and in the tooling of `conda-forge` and `bioconda`. One solution to make such recipes more future-proof would be to make tooling respect the [official guidance to query the pypi JSON API to get download urls](https://warehouse.pypa.io/api-reference/integration-guide.html#official-guidance). Examples of how to do this are here:
* [stackoverflow answer with example code of querying the pypi JSON API for a download URL](https://stackoverflow.com/a/48327216)
* [link to the pypi code for generating the currently used standardized redirect links at `pypi.io`, that also uses the JSON API](pypi/warehouse#13240 (comment))
  • Loading branch information
dlaehnemann committed Mar 20, 2023
1 parent e8f4f6f commit d0ddba8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion recipes/snakemake-wrapper-utils/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package:
version: "{{ version }}"

source:
url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz"
url: "https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name.replace("-", "_" }}-{{ version }}.tar.gz"
sha256: 9de956c8c191e382772be24cccd15be1e72d2a81048aaf5778ae662ce06552d3

build:
Expand Down

0 comments on commit d0ddba8

Please sign in to comment.