Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt dynamic versioning and pyproject.toml for package setup #19

Closed
wants to merge 3 commits into from

Conversation

EwoutH
Copy link
Contributor

@EwoutH EwoutH commented Mar 1, 2024

This commit transitions the package setup process from a traditional setup.py-based approach to a modern pyproject.toml configuration. It introduces dynamic versioning to automatically determine the package version from uxsim/__init__.py, eliminating the need for direct imports in the setup phase. This change resolves the import issue encountered during installation and aligns with best practices for Python packaging.

  • Added pyproject.toml with build system requirements, project metadata, dependencies, and dynamic versioning configuration.
  • Removed direct import of uxsim in setup.py to avoid installation errors.
  • Ensured uxsim/__init__.py defines __version__ for dynamic versioning compatibility.

This also fixes local installations failing and adds instruction to the Readme how to install from a git branch.

This commit transitions the package setup process from a traditional setup.py-based approach to a modern pyproject.toml configuration. It introduces dynamic versioning to automatically determine the package version from uxsim/__init__.py, eliminating the need for direct imports in the setup phase. This change resolves the import issue encountered during installation and aligns with best practices for Python packaging.

- Added pyproject.toml with build system requirements, project metadata, dependencies, and dynamic versioning configuration.
- Removed direct import of uxsim in setup.py to avoid installation errors.
- Ensured uxsim/__init__.py defines __version__ for dynamic versioning compatibility.
This commit addresses an issue encountered during the package build process where setuptools identified multiple top-level packages in a flat-layout project structure. To resolve this, the commit explicitly defines package discovery rules in pyproject.toml, using the `find` directive. The configuration now includes only the intended `uxsim` package (and its subpackages) while excluding other directories such as `dat` and `demos_and_examples` from the packaging process. This change ensures that setuptools correctly identifies and includes only the relevant Python package components in the distribution, preventing the accidental inclusion of unrelated directories.
Update the installation instructions to include how to install git branches.
@toruseo
Copy link
Owner

toruseo commented Mar 1, 2024

Thanks for this, but sorry, I am not familiar with modern packaging practice. Please give me some time to update my knowledge. After that I will do it by my own.

@toruseo toruseo closed this Mar 1, 2024
@EwoutH
Copy link
Contributor Author

EwoutH commented Mar 1, 2024

Okay, that sounds smart!

This is a good read: https://packaging.python.org/en/latest/guides/writing-pyproject-toml/

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.

2 participants