Skip to content

Suggestion for project structure/setup improvements #355

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

Open
sisp opened this issue Jun 8, 2021 · 1 comment
Open

Suggestion for project structure/setup improvements #355

sisp opened this issue Jun 8, 2021 · 1 comment

Comments

@sisp
Copy link
Contributor

sisp commented Jun 8, 2021

I'd like to suggest an (in my opinion) improvement of the project structure/setup and the involved tooling to ease contributions and maintenance.

  1. Use Poetry for dependency management and packaging. Poetry has a number of advantages over plain pip including proper dependency resolution, built-in dependency locking, specification of dev-dependencies, a unified CLI for dependency and package management, virtual env management, etc. Poetry is used in some popular projects including, e.g., isort, diagrams, Rasa among others. I've been using Poetry since v0.12 and believe that it's the best tool available at this point for managing Python projects.
  2. Use code formatters: Black for most of the code and isort for imports. Those two are the de-facto standard code formatters for Python.
  3. Use Tox for test automation, e.g. for running the test suite against all officially supported Python versions (and if applicable against different versions of specific dependencies).
  4. Use pre-commit to run code formatters and linters before a commit to avoid erroneous commits.
  5. Optionally replace Flake8 by Pylint for more sophisticated linting. This is a matter of taste, I personally like Pylint a lot.
  6. Write a contribution guide on how to set up a development environment, how to run the test suite (against multiple Python versions), etc.

If done well, this setup has a single source of truth for all (dev-)dependencies and tool configurations for local development environments, IDEs, pre-commit hooks and CI jobs, integrates with common IDEs like VS Code out of the box (e.g. formatters can be applied when saving a file), and offers reproducible environments and builds for all contributors. I have numerous private projects set up this way, the DX is very smooth.

What do you think? I'd be happy to send a PR.

@p1c2u
Copy link
Collaborator

p1c2u commented Jun 9, 2021

Hi @sisp

Most of your points I have in my plans.

  1. Use Poetry for dependency management and packaging.

I want to move to Poetry, but first I need to migrate to pyproject.toml setup

  1. Use code formatters: Black for most of the code and isort for imports.

That's in high priority list also connected to pyproject.toml

  1. Use Tox for test automation

Would be nice to have it.

  1. Use pre-commit

Definitely want to use it

  1. Optionally replace Flake8 by Pylint

Would be nice to have it also.

  1. Write a contribution guide on how to set up a development environment

Good idea.

Thanks for your suggestions. I really appreciate it. Of course PRs are always welcome.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants