-
Notifications
You must be signed in to change notification settings - Fork 58
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
Migrate to pyproject.toml #653
base: master
Are you sure you want to change the base?
Conversation
- Updated `pyproject.toml` with the same project description, classifiers, and authors as in `setup.py`. - Removed `setup.py` from the root directory to avoid conflicts with `pyproject.toml`. - The package version is dynamically determined using Git tags. - Optional dependencies are explicitly defined in the `[project.optional-dependencies]` section. (pyproject.toml does not support directly reading dependencies from a .txt file) - Removed `requirements-dev.txt` as it is no longer needed. - Updated `README` to include instructions for installing optional dependencies using `pip install .[dev]`.
Migrate project metadata to pyproject.toml - Updated `pyproject.toml` with the same project description, classifiers, and authors as in `setup.py`. - Removed `setup.py` from the root directory to avoid conflicts with `pyproject.toml`. - The package version is now dynamically determined using Git tags. - Optional dependencies are explicitly defined in the `[project.optional-dependencies]` section. - Removed `requirements-dev.txt` as it is no longer needed. - Updated `README` to include instructions for installing optional dependencies using `pip install .[dev]`.
Either re-create |
Keep the requirements-dev.txt file so it is possible to run pip install -r requirements-dev.txt and install dependencies alone
After thinking about it, I believe the best option is to keep the requirements-dev.txt file so that it is possible to run pip install -r requirements-dev.txt and install the dependencies individually. |
Thanks a lot @Sand-jrd. |
And regarding requirements-dev.txt, I think it is indeed safer to keep it. It is currently used when building an environment to run the test suite which is defined in the tests folder and triggered at each new push to VIP (see .github/workflows/ci.yml). |
Okay, I’ll do that. Yes, |
pyproject.toml
Outdated
'Operating System :: MacOS :: MacOS X', | ||
'Operating System :: POSIX :: Linux', | ||
'Natural Language :: English', | ||
'Programming Language :: Python :: 3.6', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't these versions be compatible with the python version requirement above (and the versions also listed in the readme)?
'Intended Audience :: Science/Research', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: MacOS :: MacOS X', | ||
'Operating System :: POSIX :: Linux', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also be compatible with Windows
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um I blindly copied the description classifiers from the previous setup; I guess it’s a good time to update them indeed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve just updated them—both the Windows classifier and the Python version, as you pointed out.
pyproject.toml
Outdated
|
||
[tool.setuptools_scm] | ||
version_scheme = "guess-next-dev" | ||
local_scheme = "no-local-version" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this means no more manual definition of the version in a file is needed, could you also remove this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth adding this line to have it automatically written somewhere:
version_file = "vip_hci/_version.py"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, "guess-next-dev" uses previously released tags from github so there is no need for version_file = "vip_hci/_version.py"
. If you don’t like this to be automatic and prefer to use version_file = "vip_hci/_version.py"
, we can also do that, but in that case, we need to leave the version line in the __init__.py
file.
So it's one of the two options, not both. I don't understand which option you prefer ?
I really believe automatic versioning is better, but that’s up to you. In this case, I’ll remove the line from the init.py file that I forgot to delete.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preference is also for automatic versioning, but from quickly skimming the pypi page of setuptools-scm I had the impression one could also have the version (automatically) written in a file with the version_file line. But if I misunderstood, and this means instead that it's read from a manually edited file, then the version_file line can be removed indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay. I thought you wanted the version to be written (by hand) somewhere and then read. I've just made the two-lines changes you asked for.
Also : - add _version.py to .gitignore. - Remove 'Programming Language :: Python :: 3.7', from classifiers
I followed the instructions from ‘version at runtime - Section Python package metadata - version at runtime’. However, with this fix, there might not always be a version argument, and I couldn't find a clean workaround for this. Let me know your thoughts |
The workaround (the strongly discouraged option from the user guide)
or
I see three possibilities : 1 - We keep automatic versioning and the version argument, but that means we have to add the library to the requirements. There is a thread about this topic |
I think it'd be good to keep a
I guess you mean the |
So you mean solution 1? Adding I've committed the solution. |
pyproject.toml
with the same project description, classifiers, and authors as insetup.py
.setup.py
from the root directory to avoid conflicts withpyproject.toml
.[project.optional-dependencies]
section. (pyproject.toml does not support directly reading dependencies from a .txt file)requirements-dev.txt
as it is no longer needed.README
to include instructions for installing optional dependencies usingpip install .[dev]
.