Skip to content

Instantly share code, notes, and snippets.

@hotohoto
Last active May 17, 2024 02:04
Show Gist options
  • Save hotohoto/4c2e34d62528cdf495df8044bfd48f39 to your computer and use it in GitHub Desktop.
Save hotohoto/4c2e34d62528cdf495df8044bfd48f39 to your computer and use it in GitHub Desktop.
A minimum python project setting to support for src layout without considering distribution.
# Add this file into the root folder of your project
# Specify dependencies in requirements.txt and install dependencies with `pip install -e .`
# Then, you don't need to specify the `src` directory within PYTHONPATH when you run a python module in your project.
# This is an exeperimental/opinionated setting. So any comments are welcome.
# references:
# - https://stackoverflow.com/a/73600610/1874690
# - https://packaging.python.org/en/latest/guides/writing-pyproject-toml/
[project]
name = "my-project-name"
dynamic = ["dependencies"]
version = "0.1.0"
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment