ansys / ansys-templates

A tool for creating new projects according to Ansys guidelines
https://templates.ansys.com
MIT License
11 stars 4 forks source link

Remove comments and blank lines in pyproject.toml to improve dependency locations when using poetry add #467

Open anscfrisson opened 3 months ago

anscfrisson commented 3 months ago

🔍 Before submitting the issue

🐞 Description of the bug

Running poetry add tzdata --group doc on a repository freshly generated yields these modifications in pyproject.toml:

# Optional documentation dependencies
[tool.poetry.group.doc]
optional = true

[tool.poetry.group.doc.dependencies]
Sphinx = "^5.3.0"
numpydoc = "^1.5.0"
ansys-sphinx-theme = "^0.9.7"
sphinx-copybutton = "^0.5.1"

# Optional testing dependencies
+ tzdata = "^2024.1"
[tool.poetry.group.tests]
optional = true
[tool.poetry.group.tests.dependencies]
pytest = "^7.3.0"
pytest-cov = "^4.0.0"

The location of tzdata = "^2024.1" would be more accurate if pyproject.toml did not have comments before group blocks and blank lines between group blocks and their dependencies:

[tool.poetry.group.doc]
optional = true
[tool.poetry.group.doc.dependencies]
Sphinx = "^5.3.0"
numpydoc = "^1.5.0"
ansys-sphinx-theme = "^0.9.7"
sphinx-copybutton = "^0.5.1"
tzdata = "^2024.1"

[tool.poetry.group.tests]
optional = true
[tool.poetry.group.tests.dependencies]
pytest = "^7.3.0"
pytest-cov = "^4.0.0"

The solution is to remove comments before blocks and to remove blank lines between group blocks and their dependencies in https://github.com/ansys/ansys-templates/blob/main/src/ansys/templates/python/common/%7B%7Bcookiecutter.__project_name_slug%7D%7D/pyproject.toml

📝 Steps to reproduce

For Windows and Git Bash.

Create a test repository with ansys-templates new pyansys-advanced:

product_name [product]:
library_name [library]:
version [0.1.dev0]:
short_description [A Python wrapper for Ansys product library]:
repository_url [https://github.com/ansys/pyproduct-library]:
Select requires_python:
1 - 3.8
2 - 3.9
3 - 3.10
4 - 3.11
5 - 3.12
Choose from 1, 2, 3, 4, 5 [1]: 3
Select build_system:
1 - flit
2 - poetry
3 - setuptools
Choose from 1, 2, 3 [1]: 2
max_linelength [100]:
Fixing ...\pyproduct-library\doc\source\conf.py
(venv-ansys-templates)

In pyproduct-library:

💻 Which operating system are you using?

Windows

🐍 Which Python version are you using?

3.10

📦 Installed packages

build==1.2.1
CacheControl==0.14.0
cachetools==5.3.3
certifi==2024.2.2
chardet==5.2.0
charset-normalizer==3.3.2
cleo==2.1.0
colorama==0.4.6
crashtest==0.4.1
distlib==0.3.8
dulwich==0.21.7
fastjsonschema==2.19.1
filelock==3.13.4
idna==3.7
importlib_metadata==7.1.0
installer==0.7.0
jaraco.classes==3.4.0
keyring==24.3.1
more-itertools==10.2.0
msgpack==1.0.8
packaging==24.0
pexpect==4.9.0
pkginfo==1.10.0
platformdirs==4.2.0
pluggy==1.4.0
poetry==1.8.2
poetry-core==1.9.0
poetry-plugin-export==1.7.1
ptyprocess==0.7.0
pyproject-api==1.6.1
pyproject_hooks==1.0.0
pywin32-ctypes==0.2.2
rapidfuzz==3.8.1
requests==2.31.0
requests-toolbelt==1.0.0
shellingham==1.5.4
tomli==2.0.1
tomlkit==0.12.4
tox==4.14.2
trove-classifiers==2024.4.10
urllib3==2.2.1
virtualenv==20.25.1
zipp==3.18.1