Skip to content

Name conflict with other slugify package #81

Closed

Description

@EmileSonneveld

When working on the following code:

from slugify import slugify
fname = slugify("cc / loc") + ".png"

My IDE (PyCharm 2018.2.5) will suggest to automatically download a package, but the wrong one. And this results in an error: NameError: name 'unicode' is not defined

The namespace of this package should be changed, or the half implemented package should be removed from PIP.

A tool like this should work out of the box.

Activity

  1. changed the title [-]NameError: name 'unicode' is not defined[/-] [+]Name conflict with other slugify package[/+] on Jul 27, 2019
  2. un33k commented on Jul 27, 2019

    @un33k
    Owner

    I don't think the name-space python-slugify can have multiple versions on pypi. With that said, some people, sadly, clone the repo and publish it as python-slugify2, python-slugify3 etc. If your IDE falls for the number in the name as the true version and installs the latest version, then it is possible that a fake/clone version is installed by PyCharm.

    You can be more specific and install it as python-slugify[unidecode] as per https://github.com/un33k/python-slugify#notice

  3. roniemartinez commented on Jul 27, 2019

    @roniemartinez

    then it is possible that a fake/clone version is installed by PyCharm

    He installed the slugify package, not python-slugify. It's been there 9 years ago, certainly not a clone.

    https://github.com/zacharyvoase/slugify/blob/master/src/slugify.py#L24

  4. un33k commented on Jul 27, 2019

    @un33k
    Owner

    @EmileSonneveld Only you know what you installed. Any package should install its own dependencies or fall on a default one, and provide options. Never used pyCharm so I don't know what it does. See what you installed and raise a ticket with that package instead.

  5. roniemartinez commented on Jul 27, 2019

    @roniemartinez

    @un33k I use PyCharm. If you import a module and it does not exist yet PyCharm will ask you to install what you imported, in the case of:

    import slugify

    It will install the slugify package and notpython-slugify

  6. un33k commented on Jul 28, 2019

    @un33k
    Owner

    @roniemartinez then this issue needs to be posted on the slugify's page instead.

  7. EmileSonneveld commented on Jul 28, 2019

    @EmileSonneveld
    Author

    I raised the issue in the conflicting library too. However, I am convinced that if this package is called python-slugify, the namespace in the code should reflect that. However, it is difficult to fix that while retaining backwards compatibility of course.

  8. un33k commented on Jul 28, 2019

    @un33k
    Owner

    @EmileSonneveld name of a package is different than the set of api it publishes. python-slugify is a reserved name for pypi. Remember that importing sys in python is import sys and not import python-sys. So name of a package has nothing to do with what is inside of it.

  9. Repository owner locked as resolved and limited conversation to collaborators on Jul 28, 2019
  10. un33k commented on Sep 8, 2026

    @un33k
    Owner

    This is Dojo, posting a maintainer-authorized follow-up linking this issue to #191.

    Install-name versus import-name troubleshooting is documented. No package namespace rename is introduced.

    The default algorithm remains legacy; improved output rules are opt-in. This note does not announce a published release, and no individual PR is being merged by this follow-up. Thank you for the contribution and discussion.

    🚀 Generated with Dojo ⛩️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions