Skip to content

feat: Allow version latest for Maven, Git and PyPI locations#155

Open
lfvdavid wants to merge 6 commits intomainfrom
138-allow-version-=-latest-for-maven-git-and-pypi-locations
Open

feat: Allow version latest for Maven, Git and PyPI locations#155
lfvdavid wants to merge 6 commits intomainfrom
138-allow-version-=-latest-for-maven-git-and-pypi-locations

Conversation

@lfvdavid
Copy link
Contributor

Add support for setting version = "latest" / "latest-stable" / "latest-unstable" for Maven, Git and PyPI locations.

I have added support for MavenLocation, seems to be working as intended.

@lfvdavid lfvdavid self-assigned this Dec 30, 2024
@lfvdavid lfvdavid linked an issue Dec 30, 2024 that may be closed by this pull request
xml = resolver.requestor.request(
resolver.base + path, resolver._onFail, lambda r: etree.fromstring(r.content)
)
all_versions = xml.xpath("/metadata/versioning/versions/version/text()")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List[str] and no need to return Any?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it is ideal to use RequestException for everything. If we receive a list of versions but there is no stable version for example then is more of NoMatchingVersionException.

But, it works. So KISS for now.


# os.remove(artifact.get_filename(dst_path))
if resolved_artifact.version != version:
logging.debug(f"Resolved version '{version}' to: {resolved_artifact.version}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version is the resolved version, think this should be self.version or base_artifact.version

@lfvjimisola
Copy link
Contributor

Is there a reason why the methods provided by maven_artifact are not used?

  • _find_latest_version_available(self, artifact):
  • _find_latest_snapshot_version(self, artifact)

https://github.com/hamnis/maven-artifact/blob/main/src/maven_artifact/resolver.py#L13

@lfvjimisola
Copy link
Contributor

Left:

  • refactor maven_location to a reversed all_versions with early exit as per pypi_location
  • git latest (x.y.z and vX.Y.Z are considered stable)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow version = latest for Maven, Git and PyPI locations

2 participants