cloudsmith-cli icon indicating copy to clipboard operation
cloudsmith-cli copied to clipboard

Python 3.12 Escapue Sequence Error

Open fennewald opened this issue 1 year ago • 2 comments

When using cloudsmit-cli on Python 3.12+, startup begins with a wall of warnings:

λ cloudsmith
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/cran_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/cran_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/cran_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/dart_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/dart_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/dart_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/deb_upstream.py:527: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/deb_upstream_request.py:489: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/deb_upstream_request_patch.py:488: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/docker_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/docker_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/docker_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/helm_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/helm_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/helm_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/maven_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/maven_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/maven_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/npm_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/npm_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/npm_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/nuget_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/nuget_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/nuget_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/python_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/python_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/python_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/repository.py:831: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/repository_create.py:831: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/repository_create_request.py:592: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/repository_request_patch.py:586: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/rpm_upstream.py:488: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/rpm_upstream_request.py:450: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/rpm_upstream_request_patch.py:449: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/ruby_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/ruby_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/ruby_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/swift_upstream.py:431: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/swift_upstream_request.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
/home/c/.rye/tools/cloudsmith-cli/lib/python3.12/site-packages/cloudsmith_api/models/swift_upstream_request_patch.py:393: SyntaxWarning: invalid escape sequence '\/'
  name is not None and not re.search('^\\w[\\w \\-\'\\.\/()]+$', name)):  # noqa: E501
Usage: cloudsmith [OPTIONS] COMMAND [ARGS]...

     ________                __               _ __  __       ________    ____
    / ____/ /___  __  ______/ /________ ___  (_) /_/ /_     / ____/ /   /  _/
   / /   / / __ \/ / / / __  / ___/ __ `__ \/ / __/ __ \   / /   / /    / /
  / /___/ / /_/ / /_/ / /_/ (__  ) / / / / / / /_/ / / /  / /___/ /____/ /
  \____/_/\____/\__,_/\__,_/____/_/ /_/ /_/_/\__/_/ /_/   \____/_____/___/

  The Cloudsmith Command-Line Interface - Be Awesome. Automate Everything.

Options:
  -V, --version            Show the version numbers for the API and CLI.
  -C, --config-file PATH   The path to your config.ini file.
  --credentials-file PATH  The path to your credentials.ini file.
  -P, --profile TEXT       The name of the profile to use for configuration.
  -h, --help               Show this message and exit.

Commands:
  check               Check rate limits and service status.
  copy|cp             Copy a package to another repository.
  delete|rm           Delete a package from a repository.
  dependencies|deps   List direct (non-transitive) dependencies for a...
  docs                Launch the help website in your browser.
  entitlements|ents   Manage the entitlements for a repository.
  help                Show this delightful help message and exit.
  list|ls             List distros, packages, repos and entitlements.
  login|token         Retrieve your API authentication token/key via login.
  metrics             Retrieve Metrics.
  move|mv|promote     Move (promote) a package to another repo.
  policy              Manage policies for an organization.
  push|upload|deploy  Push (upload) a new package to a repository.
  quarantine|block    Manage quarantined packages in a repository.
  quota               Display Quota limits and history for an organisation.
  repositories|repos  Manage Repositories.
  resync              Resynchronise a package in a repository.
  status              Get the synchronisation status for a package.
  tags|tag            Manage the tags for a package in a repository.
  upstream            Manage upstreams for a repository.
  whoami              Retrieve your current authentication status.

  For more help, see the docs: https://help.cloudsmith.io/docs/cli/

  For issues/contributing: https://github.com/cloudsmith-io/cloudsmith-cli

It looks like this regex pattern, which has been copied to several locations, uses a now-invalid escape sequence. These should probably all be raw strings.

fennewald avatar Aug 21 '24 17:08 fennewald

Was just going to fix this, but it looks like it's inside autogenerated API code? Unsure where exactly to find the actual contents

fennewald avatar Aug 21 '24 17:08 fennewald

Thanks for raising @fennewald ! We'll take a look

nickxn avatar Sep 17 '24 11:09 nickxn

I'm getting the same error on the first run after uv pip install cloudsmith-cli. The syntax warning is only raised when there was no bytecode compilation yet, so it isn't showing with pip or after the first run.

konstin avatar Oct 16 '24 13:10 konstin

@fennewald @konstin This is resolved as of release 1.4.1

chrisimcevoy avatar Nov 26 '24 13:11 chrisimcevoy