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

If pyproject.toml does not have a project attribute, an error will be reported #31

Closed
leeqvip opened this issue Oct 25, 2023 · 6 comments

Comments

@leeqvip
Copy link

leeqvip commented Oct 25, 2023

Traceback (most recent call last):
  File "/opt/hostedtoolcache/node/18.18.2/x64/lib/node_modules/semantic-release-pypi/dist/py/set_version.py", line 24, in <module>
    toml['project']['version'] = args.version
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/tomlkit/container.py", line 613, in __getitem__
    raise NonExistentKey(key)
tomlkit.exceptions.NonExistentKey: 'Key "project" does not exist.'
leeqvip added a commit to leeqvip/semantic-release-pypi that referenced this issue Oct 25, 2023
Add the ability to determine whether the project attribute exists. fix abichinger#31
@abichinger
Copy link
Owner

Hey @leeqvip

semantic-release-pypi needs a project or a tool.poetry section to set the version.
If you have neither in your pyproject.toml file, this is the expected error.

Your PR #32 would get rid of the error, but the version would no longer be updated.

Please explain to me why you need this?

@leeqvip
Copy link
Author

leeqvip commented Oct 25, 2023

Hi @abichinger
In my project, pyproject.toml is only used for lint checking, and the version is still configured in setup.cfg

@abichinger
Copy link
Owner

I see. I can think of two solutions

  1. add a new option, which allows the user to force set the build interface (pyproject.toml or setup.py)
  2. use semantic-release-pypi@2.5.2 - this version will always set the version in setup.cfg

@abichinger
Copy link
Owner

I'm happy to make a PR on pycasbin to fix the release workflow if you'd like.

@abichinger
Copy link
Owner

  1. Migrate metadata to pyproject.toml

@leeqvip
Copy link
Author

leeqvip commented Oct 26, 2023

I'm happy to make a PR on pycasbin to fix the release workflow if you'd like.

Thanks !

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 a pull request may close this issue.

2 participants