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

fetchPypi -> fetchFromPyPI #146564

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/development/interpreters/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ with pkgs;
isPy27 isPy35 isPy36 isPy37 isPy38 isPy39 isPy310 isPy3k isPyPy pythonAtLeast pythonOlder
python bootstrapped-pip buildPythonPackage buildPythonApplication
fetchPypi
fetchFromPyPI
hasPythonModule requiredPythonModules makePythonPath disabledIf
toPythonModule toPythonApplication
buildSetupcfg
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# `fetchPypi` function for fetching artifacts from PyPI.
# `fetchFromPyPI` function for fetching artifacts from PyPI.
{ fetchurl
, makeOverridable
}:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def get_prefix(string):

FETCHERS = {
'fetchFromGitHub' : _get_latest_version_github,
'fetchFromPyPI' : _get_latest_version_pypi,
'fetchPypi' : _get_latest_version_pypi,
'fetchurl' : _get_latest_version_pypi,
}
Expand Down Expand Up @@ -263,11 +264,11 @@ def _determine_extension(text, fetcher):
"""Determine what extension is used in the expression.

If we use:
- fetchPypi, we check if format is specified.
- fetchFromPyPI or fetchPypi, we check if format is specified.
- fetchurl, we determine the extension from the url.
- fetchFromGitHub we simply use `.tar.gz`.
"""
if fetcher == 'fetchPypi':
if fetcher == 'fetchFromPyPI' or fetcher == 'fetchPypi' :
try:
src_format = _get_unique_value('format', text)
except ValueError as e:
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/3to2/default.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{ lib
, buildPythonPackage
, fetchPypi
, fetchFromPyPI
, pytest
}:

buildPythonPackage rec {
pname = "py3to2";
version = "1.1.1";

src = fetchPypi {
src = fetchFromPyPI {
inherit version;
pname = "3to2";
extension = "zip";
Expand Down
3 changes: 2 additions & 1 deletion pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ let
# See build-setupcfg/default.nix for documentation.
buildSetupcfg = import ../build-support/build-setupcfg self;

fetchPypi = callPackage ../development/interpreters/python/fetchpypi.nix { };
fetchPypi = fetchFromPyPI;
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can deprecate this and remove in the (long) future?

Copy link
Contributor

Choose a reason for hiding this comment

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

there's not a good way to deprecate within nixpkgs. If you emit warnings then that breaks a lot of CI's (including ofborg)

Copy link
Member

@SuperSandro2000 SuperSandro2000 Nov 19, 2021

Choose a reason for hiding this comment

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

If you emit warnings then that breaks a lot of CI's (including ofborg)

Which is kinda stupid.

I see myself already doing this quite often so why not.

Suggested change
fetchPypi = fetchFromPyPI;
fetchPypi = fetchFromPyPI;
fetchFromPyPi = throw "Did you mean fetchFromPyPI?"

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this useful? The compiler will catch it anyway...

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say so, it's pretty common to do a typo like this, but it reads as correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this useful? The compiler will catch it anyway...

I am all about this alias. Same as fetchFromGithub.

Copy link
Member Author

Choose a reason for hiding this comment

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

It looks like a case for a whole mistaken-aliases.nix file.

fetchFromPyPI = callPackage ../development/interpreters/python/fetchfrompypi.nix { };

# Check whether a derivation provides a Python module.
hasPythonModule = drv: drv?pythonModule && drv.pythonModule == python;
Expand Down