Skip to content

chore: Remove setup.py#1218

Open
Dor-bl wants to merge 9 commits intoappium:masterfrom
Dor-bl:remove-setup-py-bump-major-version-15520390993002351116
Open

chore: Remove setup.py#1218
Dor-bl wants to merge 9 commits intoappium:masterfrom
Dor-bl:remove-setup-py-bump-major-version-15520390993002351116

Conversation

@Dor-bl
Copy link
Copy Markdown
Contributor

@Dor-bl Dor-bl commented Apr 17, 2026

This pull request updates the versioning and packaging process for the project, primarily by removing the legacy setup.py file and improving how version information is managed and retrieved. The changes ensure better compatibility with modern Python packaging standards and make the version retrieval more robust.

Packaging and Versioning Updates:

  • Removed the obsolete setup.py file, fully transitioning the project to use pyproject.toml for packaging configuration. This simplifies the build process and aligns with current Python packaging best practices.
  • Updated the [tool.semantic_release] configuration in pyproject.toml to synchronize the version between pyproject.toml and the version variable in appium/version.py, ensuring consistent versioning across the project.
  • Removed the [tool.hatch.version] section from pyproject.toml, as version management is now handled by semantic-release and the new version synchronization setup.

Version Retrieval Robustness:

  • Improved the _get_version() function in appium/version.py to handle the case where the package metadata is not found, returning 'unknown' instead of raising an exception. This makes version retrieval more reliable in edge cases.

Dor-bl and others added 4 commits April 7, 2026 05:00
- Completely remove setup.py.
- Bump major version of the package to 6.0.0.
- Update appium/version.py with a static version string for consistency.
- Sync pyproject.toml and appium/version.py via semantic-release configuration.
- Update CHANGELOG.md.
@Dor-bl Dor-bl changed the title Remove setup.py and release version 6.0.0 with updates Chore: Remove setup.py and release version 6.0.0 with updates Apr 17, 2026
@Dor-bl Dor-bl changed the title Chore: Remove setup.py and release version 6.0.0 with updates chore: Remove setup.py and release version 6.0.0 with updates Apr 17, 2026
Comment thread pyproject.toml Outdated
name = "Appium-Python-Client"
description = "Python client for Appium"
version = "5.3.0"
version = "6.0.0"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please don't bump the version by manual.

Instead, commit message must have BREAKING CHANGE: prefix to bump major version

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@Dor-bl Dor-bl changed the title chore: Remove setup.py and release version 6.0.0 with updates chore: Remove setup.py Apr 18, 2026
Comment thread appium/version.py Outdated
try:
return metadata.version('Appium-Python-Client')
except metadata.PackageNotFoundError:
return 'unknown'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this is a good idea. If version is unset an exception must be thrown, not muted

Copy link
Copy Markdown
Contributor Author

@Dor-bl Dor-bl Apr 18, 2026

Choose a reason for hiding this comment

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

Fixed.

@mykola-mokhnach
Copy link
Copy Markdown
Contributor

Some more AI findings:

py.typed: The shim explicitly ships package_data={'appium': ['py.typed']}. Hatch does not repeat that in TOML; in practice Hatchling usually includes non-Python files under an explicitly listed package directory, but this is worth one verification (inspect a built wheel for appium/py.typed) if you rely on PEP 561 at install time.

Docs / muscle memory: [README.md](README.md) still mentions python setup.py install; removing setup.py means those instructions should point to pip install / uv pip install instead.

@Dor-bl
Copy link
Copy Markdown
Contributor Author

Dor-bl commented Apr 18, 2026

Some more AI findings:

py.typed: The shim explicitly ships package_data={'appium': ['py.typed']}. Hatch does not repeat that in TOML; in practice Hatchling usually includes non-Python files under an explicitly listed package directory, but this is worth one verification (inspect a built wheel for appium/py.typed) if you rely on PEP 561 at install time.

Docs / muscle memory: [README.md](README.md) still mentions python setup.py install; removing setup.py means those instructions should point to pip install / uv pip install instead.

py.typed: Confirmed it's included in the built wheel. Hatchling automatically picks up all files under the appium package directory, so no extra config is needed.
README.md: Replaced both python setup.py install references with pip install . in the source install instructions (lines 29 and 37).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the project’s packaging/versioning by removing the legacy setup.py flow and shifting installation guidance to pip install ., while attempting to align version management with pyproject.toml and semantic-release.

Changes:

  • Removed setup.py to fully rely on pyproject.toml/PEP 517 builds.
  • Updated pyproject.toml semantic-release settings and removed Hatch’s version config.
  • Changed runtime version retrieval in appium/version.py and updated README install commands.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
setup.py Removed legacy setuptools entrypoint.
pyproject.toml Removes Hatch version config; updates semantic-release version sync settings.
appium/version.py Changes how the package version is resolved at runtime.
README.md Replaces python setup.py install with pip install ..

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread appium/version.py
Comment on lines +15 to +17
from importlib.metadata import version as _metadata_version


def _get_version():
return metadata.version('Appium-Python-Client')


version = _get_version()
version = _metadata_version('Appium-Python-Client')
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

version = _metadata_version('Appium-Python-Client') will raise importlib.metadata.PackageNotFoundError when the distribution metadata is not available (e.g., running from a source checkout without an installed wheel/sdist), which makes importing appium.version fail. Wrap the metadata lookup in a try/except and fall back to a safe value (the PR description mentions returning 'unknown').

Copilot uses AI. Check for mistakes.
Comment thread appium/version.py
Comment on lines +15 to +17
from importlib.metadata import version as _metadata_version


def _get_version():
return metadata.version('Appium-Python-Client')


version = _get_version()
version = _metadata_version('Appium-Python-Client')
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

The PR description says _get_version() was improved to handle missing package metadata and return 'unknown', but _get_version() was removed and the module now unconditionally queries metadata at import time. Either reintroduce a helper with the documented fallback behavior or adjust the PR description to match the implemented behavior.

Copilot uses AI. Check for mistakes.
Comment thread pyproject.toml
no_git_verify = false
tag_format = "v{version}"
version_toml = ["pyproject.toml:project.version"]
version_toml = ["pyproject.toml:project.version", "appium/version.py:version"]
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

version_toml is configured to update appium/version.py:version, but version_toml entries are typically TOML key paths (and appium/version.py is not a TOML file). If the intent is to have python-semantic-release bump a Python variable, use the configuration option intended for Python version variables (and ensure appium/version.py contains a literal version string assignment that the tool can rewrite). Otherwise the release process may fail when trying to parse/update this entry.

Suggested change
version_toml = ["pyproject.toml:project.version", "appium/version.py:version"]
version_toml = ["pyproject.toml:project.version"]
version_variables = ["appium/version.py:version"]

Copilot uses AI. Check for mistakes.
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.

4 participants