Code Monkey home page Code Monkey logo

poetry-codeartifact-plugin's Introduction

poetry-codeartifact-plugin

This Poetry plugin automatically refreshes your authorization token when working with CodeArtifact repositories.

Installation

Run this to install the plugin: poetry self add poetry-codeartifact-plugin

And to remove: poetry self remove poetry-codeartifact-plugin

Usage

No configuration or workflow changes are needed. If the plugin detects a HTTP 401 or 403 from a CodeArtifact URL, it will refresh your authorization token and retry the request.

This assumes that your local AWS creds are up-to-date -- if not, your command will still fail.

Adding a CodeArtifact repository

Add this snippet to your project's pyproject.toml:

[[tool.poetry.source]]
name = "codeartifact-pypi"  # arbitrary, just don't reuse repository names between CodeArtifact repos
url = "https://DOMAIN-123412341234.d.codeartifact.us-west-2.amazonaws.com/REPO/pypi/simple/"  # get this URL from your CodeArtifact dashboard or the GetRepositoryEndpoint API call

Learn more about Poetry repositories here: https://python-poetry.org/docs/repositories/

poetry-codeartifact-plugin's People

Contributors

tpetr avatar terrabitz avatar dependabot[bot] avatar tadejstajner avatar

Stargazers

Jeffrey.PYL avatar Stephan avatar  avatar xiasongh avatar Drew McArthur avatar Radek Tomšej avatar Mark Southern avatar Douglas Holman avatar Stephen Johnson avatar

Watchers

Jonathan Werrett avatar Isaac Evans avatar Luke O'Malley avatar Drew Dennison avatar  avatar

poetry-codeartifact-plugin's Issues

poetry publish

This plugin doesn't seem to work with poetry publish, only poetry install

401 Client Error: Unauthorized for url:

Every since poetry updated from poetry 1.7.9, we have a few instances of this:

- Updating xxx-foundation (0.0.0 /Users/andreoji/src/xxx-foundation -> 0.0.6): Failed

  HTTPError

  401 Client Error: Unauthorized for url: https://xxx-xxxx.d.codeartifact.eu-west-1.amazonaws.com/pypi/python-packages/simple/xxx-foundation/0.0.6/xxx_foundation-0.0.6-py3-none-any.whl#sha256=b15ef6873853b0b432b9fa7a86a8f44567f86728451640d5c4a974e89c73b613

  at /usr/local/Cellar/poetry/1.8.2/libexec/lib/python3.12/site-packages/requests/models.py:1021 in raise_for_status
      1017│                 f"{self.status_code} Server Error: {reason} for url: {self.url}"
      1018│             )
      1019│ 
      1020│         if http_error_msg:
    → 1021│             raise HTTPError(http_error_msg, response=self)
      1022│ 
      1023│     def close(self):
      1024│         """Releases the connection back to the pool. Once this method has been
      1025│         called the underlying ``raw`` object must not be accessed again.

Cannot install xxx-foundation.

(bridgeu-foundation-py3.12) xxx@xxx-MacBook-Pro bridgeu % poetry --version
Poetry (version 1.8.2)

(bridgeu-foundation-py3.12) xxx@xxx-MacBook-Pro bridgeu % poetry install
Updating dependencies
Resolving dependencies... (9.4s)

Package operations: 0 installs, 8 updates, 0 removals

  - Updating packaging (23.2 -> 24.0)
  - Updating setuptools (69.1.0 -> 69.2.0)
  - Updating coverage (7.4.2 -> 7.4.4)
  - Updating pytest (8.0.1 -> 8.1.1)
  - Updating virtualenv (20.25.0 -> 20.25.1)
  - Updating black (24.2.0 -> 24.3.0)
  - Updating mypy (1.8.0 -> 1.9.0)
  - Updating xxx-foundation (0.0.0 /Users/andreoji/src/xxx-foundation -> 0.0.6): Failed

  HTTPError

  401 Client Error: Unauthorized for url: https://xxx-xxxxxx.d.codeartifact.eu-west-1.amazonaws.com/pypi/python-packages/simple/bridgeu-foundation/0.0.6/xxx_foundation-0.0.6-py3-none-any.whl#sha256=b15ef6873853b0b432b9fa7a86a8f44567f86728451640d5c4a974e89c73b613

  at /usr/local/Cellar/poetry/1.8.2/libexec/lib/python3.12/site-packages/requests/models.py:1021 in raise_for_status
      1017│                 f"{self.status_code} Server Error: {reason} for url: {self.url}"
      1018│             )
      1019│ 
      1020│         if http_error_msg:
    → 1021│             raise HTTPError(http_error_msg, response=self)
      1022│ 
      1023│     def close(self):
      1024│         """Releases the connection back to the pool. Once this method has been
      1025│         called the underlying ``raw`` object must not be accessed again.

Cannot install xxx-foundation.

We didn't have this at all before poetry 1.8.2 also it seems to "fix" itself. Just wondering if you can do anything to aid debugging @tpetr . What's strange is that it's getting the dependencies from the repo and then failing to download the actual package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.