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

Migrating from setup.py to pyproject.toml #149

Merged

Conversation

wiseaidev
Copy link
Contributor

Fixed #148.

Signed-off-by: wiseaidev <business@wiseai.dev>
@marshalmiller marshalmiller self-assigned this Oct 2, 2022
@marshalmiller marshalmiller added enhancement New feature or request hacktoberfest Issues for the HacktoberFest event. python labels Oct 2, 2022
@marshalmiller marshalmiller changed the base branch from main to pyproject October 2, 2022 17:13
@marshalmiller marshalmiller merged commit 9df77ff into rottingresearch:pyproject Oct 2, 2022
@marshalmiller marshalmiller added the hacktoberfest-accepted HacktoberFest Pull Request that is accepted. label Oct 2, 2022
@marshalmiller
Copy link
Collaborator

@wiseaidev I have one question. How do I define the version file in this new format? I used to update it in setup.py. I see dynamic = ["version"]. How do I use that? Everything else looks good.

@wiseaidev
Copy link
Contributor Author

wiseaidev commented Oct 2, 2022

Hey @marshalmiller, as the name suggests, the version will be assigned dynamically during the build process to the value of the __version__ variable in linkrot/__init__.py:

https://github.com/marshalmiller/linkrot/blob/e0ee66070134f5ab5206e4210bbe9a89f080d967/linkrot/__init__.py#L35

The version is now in a central location. You can run the following command to see it in action:

python -m build

* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatchling>=1.8.0)
* Getting dependencies for sdist...
* Building sdist...
* Building wheel from sdist
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (hatchling>=1.8.0)
* Getting dependencies for wheel...
* Building wheel...
Successfully built linkrot-1.2.tar.gz and linkrot-1.2-py3-none-any.whl

Notice the version is set to 1.2.

Note: Besides, I forget about the cli entry point, just add the following at the bottom of the pyproject.toml file:

[project.scripts]
linkrot= "linkrot.cli:main"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest Issues for the HacktoberFest event. hacktoberfest-accepted HacktoberFest Pull Request that is accepted. python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move from requirements.txt, requirements_dev.txt, setup.cfg, and setup.py to pyproject.toml.
2 participants