pynamer

A pseudo pip-search utility to ascertain if a package name is available in the PyPI repository and 'register' it

https://github.com/stephen-ra-king/pynamer

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.8%) to scientific vocabulary

Keywords

available-on-pypi name-generation name-generator names naming naming-conventions packaging packaging-tool pip-search pypi python python3

Keywords from Contributors

python-version-management led energy-system-model mesh standards spacy-extension molecular-dynamics-simulation hydrology regionalization pipeline-testing
Last synced: 4 months ago · JSON representation ·

Repository

A pseudo pip-search utility to ascertain if a package name is available in the PyPI repository and 'register' it

Basic Info
  • Host: GitHub
  • Owner: Stephen-RA-King
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 3.17 MB
Statistics
  • Stars: 6
  • Watchers: 1
  • Forks: 1
  • Open Issues: 8
  • Releases: 33
Topics
available-on-pypi name-generation name-generator names naming naming-conventions packaging packaging-tool pip-search pypi python python3
Created over 2 years ago · Last pushed 4 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security Support Authors

README.md

As a replacement for pip search, pynamer will quickly ascertain if a project name is 'available' in PyPI and optionally 'register' it.

PyPI Downloads Status Python Version tests Codecov CodeQl Docker pre-commit.ci status readthedocs CodeFactor Codeclimate Imports: isort Code style: black Checked with mypy security: bandit Commitizen friendly Conventional Commits DeepSource license pydough <!-- OpenSSFScorecard -->

Contents

📺 Demo

💡 Project Rationale

Some of you may have reached the point where you want to publish a package in the PyPI python repository. The first step of which is to choose a unique name. Here lies the problem.

A recent look at the PyPI repository revealed there were over 674,743 projects, so many names have already been taken.

pip leaps to the rescue with its search utility... or does it?

python pip search zaphod

bash ERROR: XMLRPC request failed [code: -32500] RuntimeError: PyPI no longer supports 'pip search' (or XML-RPC search). Please use https://pypi.org/search (via a browser) instead. See https://warehouse.pypa.io/api-reference/xml-rpc.html#deprecated-methods for more information.

A quick search will show the internet replete with articles explaining the situation:

OK so I go to the PyPI website and do a search for 'zaphod' as suggested by pip and 7 results are displayed none of which have the package name 'zaphod'

Fantastic! I now think unbelievably that I have a unique name for a project that I can use. So, I go ahead and code my new project, along with all the test files, documentation and meta data. I diligently debug and commit and push to git and github so I have a history.

Finally the project is good enough to release and publish as an installable package on PyPI.

Here goes....

bash ~ $ python -m twine upload --config-file .pypirc dist/* Uploading distributions to https://upload.pypi.org/legacy/ Uploading zaphod-0.0.0-py3-none-any.whl 100% ---------------------------------------- 3.8/3.8 kB • 00:00 • ? WARNING Error during upload. Retry with the --verbose option for more details. ERROR HTTPError: 403 Forbidden from https://upload.pypi.org/legacy/ The user 'stephenking' isn't allowed to upload to project 'zaphod'. See https://pypi.org/help/#project-name for more information.

AARGH!

What just happened?

Yes unbelievably the project already exists and yes unbelievably PyPI's own search did not find the project.

Enter Pynamer. Pynamer does not rely on a single method of finding a PyPI package:

👓 TLDR

Pynamer uses the following methods to ascertain whether a package already exists on PyPI:

  • A simple request to the project url on PyPI.
  • Uses the PyPI "simple" repository - a text-based listing of all the packages available on PyPI.
  • Uses PyPI's own search 'API' and scrapes the results.

Pynamer provides a way to optionally 'register' a name on PyPI by building a minimalistic package and uploading

🚀 Quick Start


📋 Prerequisites


  • [x] Python >= 3.9.

The following are optional but required for 'registering' a project name on PyPI

Your .pypirc file should contain the following and be on your PATH:

```file [distutils] index-servers = pypi

[pypi] repository = https://upload.pypi.org/legacy/ username = token password = yourAPItoken_here ```

💾 Installation

Pynamer can be installed into any python environment using pip:

bash ~ $ pip install pynamer

However, optimal installation can be achieved using pipx:

bash ~ $ pipx install pynamer

📝 Basic Usage

A package name that is not available

bash ~ $ pynamer pynball

A package name that is available

bash ~ $ pynamer allitnil

Holy smoke batman! You've managed to identify a unique name.

Yes, even though the odds were against you (given there are over 674,743 registered projects), you did it!

Even though the name has nothing in common with your project, or may not even be a real word... you did it!

Congratulations!

📝 Usage


Display the help menu with the -h argument

bash ~ $ pynamer -h

```bash usage: pynamer [-h] [-r] [-v] [-g] [-m] [-s] [-w] [-f FILENAME] [-o FILENAME] [--version] [projects ...]

Determine if project name is available on pypi with the option to 'register' it for future use if available

positional arguments: projects Optional - one or more project names

optional arguments: -h, --help show this help message and exit -r, --register register the name on PyPi if the name is available -v, --verbose display information about similar projects -g, --generate generate a new PyPI index file -m, --meta input new meta data when registering (Author and email address) -s, --stats display GitHub stats if available -w, --webbrowser open the project on PyPI in a webbrowser -f FILENAME file containing a list of project names to analyze -o FILENAME file to save the test results --version display version number ```

Specifying multiple names

You can specify as many names as you like from the command line e.g.

bash ~ $ pynamer ganymede europa callisto

Using an input file

You can use the -f argument to specify a file containing the a names of projects to analyze. You specify a space separated sequence of as many names as you like on as many lines as you like. e.g.

'projects' file

file ganymede europa IO callisto

Then specify the -f argument

bash ~ $ pynamer -f projects

You can use the input file with names from the command line. The names will be aggregated. e.g.

bash ~ $ pynamer ersa pandia leda metis -f projects

Saving the results to a file

You can specify a file to write the result to by using the -o argument. e.g.

bash ~ $ pynamer ersa pandia leda -o results

This will write a file e.g.

results

```file

Result from pynamer PyPI utility 2023-05-02

test 1 - Basic url lookup on PyPI test 2 - Search of PyPIs simple index test 3 - Search using an request to PyPIs search 'API'.

Project name Test1 Test2 Test 3 Conclusion

ersa Found Found Found Not Available pandia Not Found Not Found Found Not Available leda Not Found Not Found Not Found Available ```

Again you can use a combination of names from the command line and input file.

Display GitHub statistics

You can optionally display some of the most pertinent GitHub statistics if available by using the -s argument. The statistics will be displayed in the the details section of test 1. e.g.

bash ~ $ pynamer black -s

Register the package name with PyPI

You can optionally 'register' the name on PyPI by using the -r argument. If the project name is found to be available and you have a valid 'pypirc' file is found, a minimalistic project will be built and uploaded to PyPI.

The first time you use the 'registration' procedure you will be prompted to enter your name and email address. These are required. You can also optionally choose to change the version and description.

This information will be retained and you will not be prompted to enter this information again. However, you can regenerate this meta data by using the -m argument along with the -r argument. You can just enter on the options you dont want to change.

bash ~ $ pynamer agrajag -r

Verbose output

With the -v argument you can display the first page of all other project matched by PyPIs search API - ordered by relevance. The algorithm that PyPI uses to select these in unknown but seems to be a mixture of names and other projects written by the same author.

bash ~ $ pynamer pynamer -v

Regenerate the PyPI simple Repository Index

As one of its tests Pynamer makes use of a list of package names scraped from its simple index site.

The PyPI Simple Index is a plain text file that lists the names of all the packages available on PyPI.

It is a simplified version of the PyPI index that makes it easier for users to browse and download packages.

The PyPI Simple Index is used by a variety of tools and libraries to download and install packages from PyPI. For example, the pip package manager, which is used to install and manage Python packages, uses the PyPI Simple Index to find packages. The Index is updated every few hours.

Using the -g argument can be used to regenerate the local file contents.

bash ~ $ pynamer -g

See planned future improvements

⁉️ The Oddities

The reason I wrote this application in the first place...

bash ~ $ pynamer zaphod

Even worse ...

bash ~ $ pynamer zem

You may ask .. Why not just use the PyPI simple search index, that seems to be a pretty good indicator? Well that is because it isn't...

bash ~ $ pynamer gitmon

⚠️ Limitations

There will be occasions where all the tests pass, the name appears to be available but the upload to PyPI still fails. This can be several reasons for this:

  • You are trying to use an internally "reserved" keyword for PyPI.
  • The name you are using is too similar to an existing project name and you get the following error message:

bash ... Error during upload. Retry with the --verbose option for more details. HTTPError: 400 Bad Request from https://test.pypi.org/legacy/ The name 'yourpackage' is too similar to an existing project. See https://test.pypi.org/help/#project-name for more information-

Using a name similar to to an existing package name is a security issue.

Malicious players will try to create project names that are frequently mistyped for large popular projects, thereby facilitating installation of a malicious project. e.g. replacing "L" / "l" with the number 1 or "o" / "O" with 0. The Software utilized by PyPI can be found on GitHub: warehouse.

🐳 Using the Docker Image

Pull the latest image from the Hub. bash ~ $ docker pull sraking/pynamer Run the image. bash ~ $ docker run -it sraking/pynamer /bin/bash Use the command line as normal in the container.

```bash root@4d315992ca28:/app# pynamer usage: pynamer [-h] [-r] [-v] [-g] [-m] [-s] [-w] [-f FILENAME] [-o FILENAME] [--version] [projects ...]

Determine if project name is available on pypi with the option to 'register' it for future use if available ... ```

📚 Documentation


Read the Docs

Wiki

📆 Planned Future improvements


  • Improve performance of the regeneration of the PyPI simple Repository Index, so this can be run in the background automatically.

📊 Package Statistics


📜 License

Distributed under the MIT license. See for more information.

<ℹ️> Meta


Linkedin PyPI repository Docker

Author: Stephen King (sking.github@gmail.com)

Created with Cookiecutter template: pydough version 1.2.2

Digital object identifier: DOI

DOI

Owner

  • Name: Stephen King
  • Login: Stephen-RA-King
  • Kind: user
  • Location: Exeter, Devon, England

Software Engineer / Python Developer

Citation (CITATION.cff)

cff-version: 1.2.0
title: pynamer
message: >-
    If you use this software, please cite it using the
    metadata from this file.
type: software
authors:
    - given-names: Stephen
      family-names: King
      email: sking.github@gmail.com
      orcid: "https://orcid.org/0009-0001-1939-6012"
identifiers:
    - type: doi
      value: 10.5281/zenodo.7957181

GitHub Events

Total
  • Issues event: 2
  • Watch event: 1
  • Push event: 302
Last Year
  • Issues event: 2
  • Watch event: 1
  • Push event: 302

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 1,046
  • Total Committers: 4
  • Avg Commits per committer: 261.5
  • Development Distribution Score (DDS): 0.32
Past Year
  • Commits: 368
  • Committers: 2
  • Avg Commits per committer: 184.0
  • Development Distribution Score (DDS): 0.008
Top Committers
Name Email Commits
Jinja Genie J****e@g****m 711
Stephen-RA-King 3****g 325
dependabot[bot] 4****] 6
pre-commit-ci[bot] 6****] 4
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 1
  • Total pull requests: 50
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: 19 days
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 1.0
  • Average comments per pull request: 1.38
  • Merged pull requests: 11
  • Bot issues: 0
  • Bot pull requests: 49
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: about 4 hours
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Stephen-RA-King (1)
Pull Request Authors
  • dependabot[bot] (42)
  • pre-commit-ci[bot] (17)
  • Stephen-RA-King (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (42) python (25)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 46 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 34
  • Total maintainers: 1
pypi.org: pynamer

Utility to find an available package name in the PyPI repository and register it

  • Versions: 34
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 46 Last month
Rankings
Dependent packages count: 7.1%
Average: 19.1%
Dependent repos count: 31.2%
Maintainers (1)
Last synced: 4 months ago

Dependencies

.github/workflows/codeql.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/docker-image.yml actions
  • actions/checkout v3 composite
.github/workflows/scorecard.yml actions
  • actions/checkout 93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 composite
  • actions/upload-artifact 0b7f8abb1508181956e8e162db84b466c27e18ce composite
  • github/codeql-action/upload-sarif 17573ee1cc1b9d061760f3a006fc4aac4f944fd5 composite
  • ossf/scorecard-action 08b4669551908b1024bb425080c797723083c031 composite
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • codecov/codecov-action v3 composite
Dockerfile docker
  • python 3.11-slim build
docs/requirements.txt pypi
  • myst-nb *
  • sphinx-autoapi *
  • sphinx-rtd-theme *
requirements/development.in pypi
  • bandit * development
  • black * development
  • build * development
  • colorama * development
  • commitizen * development
  • coverage * development
  • coverage-conditional-plugin * development
  • flake8 * development
  • flake8-bandit * development
  • flake8-comprehensions * development
  • flake8-html * development
  • flake8-pytest-style * development
  • flake8-simplify * development
  • invoke * development
  • isort * development
  • jupyter * development
  • keyring * development
  • lxml * development
  • mypy * development
  • myst-nb * development
  • pep8-naming * development
  • pre-commit * development
  • pynacl * development
  • pytest * development
  • pytest-cov * development
  • pytest-html * development
  • pytest-metadata * development
  • pytest-mock * development
  • pytest-randomly * development
  • pytest-repeat * development
  • pytest-timeout * development
  • python-semantic-release * development
  • pyyaml * development
  • requests * development
  • sphinx * development
  • sphinx-autoapi * development
  • sphinx-rtd-theme * development
  • tox * development
  • twine * development
  • types-PyYAML * development
  • types-beautifulsoup4 * development
  • types-click * development
  • types-html5lib * development
  • types-python-dateutil * development
  • types-requests * development
  • types-urllib3 * development
  • watchdog * development
requirements/development.txt pypi
  • 205 dependencies
requirements/test.in pypi
  • bandit * test
  • black * test
  • commitizen * test
  • coverage * test
  • coverage-conditional-plugin * test
  • flake8 * test
  • flake8-bandit * test
  • flake8-comprehensions * test
  • flake8-html * test
  • flake8-pytest-style * test
  • flake8-simplify * test
  • invoke * test
  • isort * test
  • lxml * test
  • mypy * test
  • pre-commit * test
  • pytest * test
  • pytest-cov * test
  • pytest-html * test
  • pytest-metadata * test
  • pytest-mock * test
  • pytest-randomly * test
  • pytest-repeat * test
  • pytest-timeout * test
  • python-semantic-release * test
  • pyyaml * test
  • tox * test
  • types-PyYAML * test
  • types-beautifulsoup4 * test
  • types-click * test
  • types-html5lib * test
  • types-python-dateutil * test
  • types-requests * test
  • types-urllib3 * test
requirements/test.txt pypi
  • argcomplete ==3.0.8 test
  • astor ==0.8.1 test
  • bandit ==1.7.5 test
  • black ==23.3.0 test
  • bleach ==6.0.0 test
  • cachetools ==5.3.1 test
  • certifi ==2023.5.7 test
  • cfgv ==3.3.1 test
  • chardet ==5.1.0 test
  • charset-normalizer ==3.1.0 test
  • click ==8.1.3 test
  • click-log ==0.4.0 test
  • colorama ==0.4.6 test
  • commitizen ==3.3.0 test
  • coverage ==7.2.5 test
  • coverage-conditional-plugin ==0.9.0 test
  • decli ==0.6.1 test
  • distlib ==0.3.6 test
  • docutils ==0.20.1 test
  • dotty-dict ==1.3.1 test
  • exceptiongroup ==1.1.1 test
  • filelock ==3.12.2 test
  • flake8 ==6.0.0 test
  • flake8-bandit ==4.1.1 test
  • flake8-comprehensions ==3.12.0 test
  • flake8-html ==0.4.3 test
  • flake8-plugin-utils ==1.3.2 test
  • flake8-pytest-style ==1.7.2 test
  • flake8-simplify ==0.20.0 test
  • gitdb ==4.0.10 test
  • gitpython ==3.1.31 test
  • identify ==2.5.24 test
  • idna ==3.4 test
  • importlib-metadata ==6.6.0 test
  • iniconfig ==2.0.0 test
  • invoke ==1.7.3 test
  • isort ==5.12.0 test
  • jaraco-classes ==3.2.3 test
  • jinja2 ==3.1.2 test
  • keyring ==23.13.1 test
  • lxml ==4.9.2 test
  • markdown-it-py ==2.2.0 test
  • markupsafe ==2.1.2 test
  • mccabe ==0.7.0 test
  • mdurl ==0.1.2 test
  • more-itertools ==9.1.0 test
  • mypy ==1.3.0 test
  • mypy-extensions ==1.0.0 test
  • nodeenv ==1.8.0 test
  • packaging ==23.1 test
  • pathspec ==0.11.1 test
  • pbr ==5.11.1 test
  • pkginfo ==1.9.6 test
  • platformdirs ==3.5.1 test
  • pluggy ==1.0.0 test
  • pre-commit ==3.3.3 test
  • prompt-toolkit ==3.0.38 test
  • py ==1.11.0 test
  • pycodestyle ==2.10.0 test
  • pyflakes ==3.0.1 test
  • pygments ==2.15.1 test
  • pyproject-api ==1.5.2 test
  • pytest ==7.3.1 test
  • pytest-cov ==4.0.0 test
  • pytest-html ==3.2.0 test
  • pytest-metadata ==2.0.4 test
  • pytest-mock ==3.10.0 test
  • pytest-randomly ==3.12.0 test
  • pytest-repeat ==0.9.1 test
  • pytest-timeout ==2.1.0 test
  • python-gitlab ==3.15.0 test
  • python-semantic-release ==7.34.4 test
  • pywin32-ctypes ==0.2.0 test
  • pyyaml ==6.0 test
  • questionary ==1.10.0 test
  • readme-renderer ==37.3 test
  • requests ==2.31.0 test
  • requests-toolbelt ==1.0.0 test
  • rfc3986 ==2.0.0 test
  • rich ==13.3.5 test
  • semver ==2.13.0 test
  • six ==1.16.0 test
  • smmap ==5.0.0 test
  • stevedore ==5.1.0 test
  • termcolor ==2.3.0 test
  • tomli ==2.0.1 test
  • tomlkit ==0.11.8 test
  • tox ==4.6.0 test
  • tqdm ==4.65.0 test
  • twine ==3.8.0 test
  • types-beautifulsoup4 ==4.12.0.5 test
  • types-click ==7.1.8 test
  • types-html5lib ==1.1.11.14 test
  • types-python-dateutil ==2.8.19.13 test
  • types-pyyaml ==6.0.12.10 test
  • types-requests ==2.31.0.0 test
  • types-urllib3 ==1.26.25.13 test
  • typing-extensions ==4.6.1 test
  • urllib3 ==2.0.3 test
  • virtualenv ==20.23.0 test
  • wcwidth ==0.2.6 test
  • webencodings ==0.5.1 test
  • wheel ==0.40.0 test
  • zipp ==3.15.0 test
.github/workflows/jinja-genie.yaml actions
  • EndBug/add-and-commit v9 composite
  • actions/checkout v3 composite
  • stephen-ra-king/jinja-genie main composite
pyproject.toml pypi
requirements/base.in pypi
requirements/base.txt pypi
requirements/production.in pypi
requirements/production.txt pypi
requirements.txt pypi
  • beautifulsoup4 ==4.12.2
  • requests ==2.31.0
setup.py pypi