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

Add poetry entrypoint for running sydent #502

Merged
merged 2 commits into from Feb 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/502.misc
@@ -0,0 +1 @@
Add poetry entrypoint for running sydent.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pedantry time...

Suggested change
Add poetry entrypoint for running sydent.
Add poetry entrypoint for running Sydent.

Q for curiosity more than anything else: Is this really just a poetry-specific entrypoint? If I install this into a venv as usual, can I not refer to it by name alone (sydent as was possible with setuptools)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is meant to replicate setuptools' entrypoints, but let me double check that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poetry's venv contains sydent and others as executables:

$ ls $(poetry env info --path)/bin
activate           black          dmypy                   mypyc       pkginfo      python3       rst2odt_prepstyles.py  stubgen              trial       wheel3.10
activate.csh       blackd         flake8                  netaddr     __pycache__  python3.10    rst2odt.py             stubtest             twine
activate.fish      black-primer   isort                   normalizer  pycodestyle  rst2html4.py  rst2pseudoxml.py       sydent               twist
activate.nu        cftp           isort-identify-imports  pip         pyflakes     rst2html5.py  rst2s5.py              sydent-casefold-db   twistd
activate.ps1       ckeygen        keyring                 pip3        pygmentize   rst2html.py   rst2xetex.py           sydent-generate-key  wheel
activate_this.py   conch          mailmail                pip-3.10    pyhtmlizer   rst2latex.py  rst2xml.py             tkconch              wheel3
automat-visualize  deactivate.nu  mypy                    pip3.10     python       rst2man.py    rstpep2html.py         tqdm                 wheel-3.10

I'm pretty sure that if you install the wheel this will end up creating a bin script too.

3 changes: 3 additions & 0 deletions pyproject.toml
Expand Up @@ -128,6 +128,9 @@ types-PyOpenSSL = "21.0.3"
types-PyYAML = "6.0.3"


[tool.poetry.scripts]
sydent = "sydent.sydent:main"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
6 changes: 5 additions & 1 deletion sydent/sydent.py
Expand Up @@ -359,10 +359,14 @@ def setup_logging(config: SydentConfig) -> None:
observer.start()


if __name__ == "__main__":
def main() -> None:
sydent_config = SydentConfig()
sydent_config.parse_config_file(get_config_file_path())
setup_logging(sydent_config)

syd = Sydent(sydent_config)
syd.run()


if __name__ == "__main__":
main()