coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
518 stars 92 forks source link

Use setuptools_scm to determine the version #151

Closed lpsinger closed 3 years ago

lpsinger commented 3 years ago

This fixes an issue where cffi was required to build a wheel:

$ python setup.py bdist_wheel
Traceback (most recent call last):
  File "setup.py", line 6, in <module>
    exec(open("mip/constants.py").read(), version_dict)
  File "<string>", line 4, in <module>
ModuleNotFoundError: No module named 'cffi'

It should also streamline the process of making a release a tiny bit.

h-g-s commented 3 years ago

Hi @lpsinger , sorry my ignorance, how do I inform the version with setuptools_scm , i.e., before releasing a new version ?

lpsinger commented 3 years ago

Just create a git tag. When you build your release (with python setup.py bdist_wheel, pip wheel, or whatever you do), setuptools_scm will detect the tag and use that as the version.

lpsinger commented 3 years ago

Any update on this? The false cffi build-time dependency is causing some installation issues with certain virtual environment tools (e.g. poetry).

lpsinger commented 3 years ago

Thank you!

h-g-s commented 3 years ago

Hi @lpsinger , just tagged version 1.13.0 , the version appears as

1.13.1.dev0+gc7c8d6b.d20201122

Could this string be trimmed ? Or it is a good practice to include these additional details ? (for me they do not seem to be relevant)

Cheers

h-g-s commented 3 years ago

Ops, the problem is bigger than I thought, the string is not accepted as a valid version

HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/ '1.13.1.dev0+gc7c8d6b.d20201122' is an invalid value for Version. Error: Can't use PEP 440 local versions. See https://packaging.python.org/specifications/core-metadata for more information.

lpsinger commented 3 years ago

1.13.1.dev0+gc7c8d6b.d20201122

It looks like you made a tarball before tagging.

h-g-s commented 3 years ago

worked, thanks !