alexmojaki / outdated

Check if a version of a PyPI package is outdated
MIT License
27 stars 7 forks source link

Allow user to specify pypi repo (for testing). #5

Closed chr15m closed 4 years ago

chr15m commented 4 years ago

Hi @alexmojaki, I needed to test this against a package that was on test.pypi.org and this little modification allows that. Please let me know if you want any changes to this PR. Thanks for writing this module!

coveralls commented 4 years ago

Pull Request Test Coverage Report for Build 40


Totals Coverage Status
Change from base Build 36: 0%
Covered Lines: 94
Relevant Lines: 95

💛 - Coveralls
chr15m commented 4 years ago

@alexmojaki I updated this to let the user pass in the full format string because they may want a completely custom URL for testing purposes (e.g. point it at their own API which has a different path not ending in /json). Let me know what you think.

alexmojaki commented 4 years ago

Please document the parameter in the docstring and the README.

Can you show exactly how you're using this with code? I don't quite get the use case. I'm wondering if it makes sense to also add this to warn_if_outdated.

chr15m commented 4 years ago

@alexmojaki it's being used in a CLI tool. In order to test the prompt-user-to-download we need to push packages to test.pypi.org and use that repo for the check as well. So in test mode we set an environment variable like PYPI_DEBUG=1 which is picked up by the Makefile that publishes the package and it changes the publishing repo to test.pypi.org. Then when we run the script itself we check the environment variable os.environ.get("PYPI_DEBUG") and set repository_url to https://test.pypi.org/pypi/%s/json instead of the default. That means we an publish new test versions and ensure the tool correctly prompts the user, without ever having to publish a live package update.

If somebody wanted to do this same testing flow with warn_if_outdated then I think it would make sense to have the same option there too.

chr15m commented 4 years ago

@alexmojaki also I pushed the documentation you requested. Let me know if it needs any changes etc.

alexmojaki commented 4 years ago

Thanks for your contribution!

I suppose you'd like me to release this? The curse of using this library (in this case on itself) is that I hesitate to release new versions because a bunch of people (probably mostly birdseye users) will get a warning they don't need.

chr15m commented 4 years ago

@alexmojaki that's cool, no pressure to release it, I can pin to a commit id in requirements.txt during dev. Just wanted to make sure this change was available for others to use in future. Thanks for merging.