diff --git a/.gitignore b/.gitignore index 7233b37..c0a9743 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ __pycache__/ **/.DS_Store **/_build - +**/examplePy/_version_generated.py # Distribution / packaging diff --git a/example1b_build_setuptools_scm/README.md b/example1b_build_setuptools_scm/README.md index c371fe6..68e7e1c 100644 --- a/example1b_build_setuptools_scm/README.md +++ b/example1b_build_setuptools_scm/README.md @@ -1,8 +1,11 @@ # examplePy - setuptools example -This directory illustrates how to create a Python package using setuptools. +This directory illustrates how to create a Python package using the +`Build` front end and `setuptools` back-end. -Optionally you can use `setuptools_scm` for versioning which is also shown here. +### Dynamic versioning + +Here you also use `setuptools_scm` for versioning. Your build requirements for this setup should include: @@ -13,8 +16,8 @@ build twine ``` -Because setuptools is listed in your pyproject.toml file it will be installed -when your package is build. It will also install Wheel for you which you need +Because `setuptools` is listed in your **pyproject.toml** file it will be installed +when your package is build. It will also install `Wheel` for you which you need to create your package's wheel. ## Src Layout @@ -26,8 +29,10 @@ about why, here . ### Build System specs -The build system here is setuptools which is your build backend. Because setuptools -does not have a default front end, you will use the [Build frontend](https://pypa-build.readthedocs.io/en/stable/) to build your package in this example. +The build system here is + +- **Front end:** [Build frontend](https://pypa-build.readthedocs.io/en/stable/). `Build` is a simple front end that just runs setuptools on the back end to create your SDist and Wheel files. +- **Back end:** `setuptools` is your backend. ``` [build-system] diff --git a/example1b_build_setuptools_scm/pyproject.toml b/example1b_build_setuptools_scm/pyproject.toml index 8eeb786..958be15 100644 --- a/example1b_build_setuptools_scm/pyproject.toml +++ b/example1b_build_setuptools_scm/pyproject.toml @@ -2,20 +2,21 @@ requires = ["setuptools>=61.0.0", "setuptools_scm[toml]>=6.2"] build-backend = "setuptools.build_meta" - -# LookupError: setuptools-scm was unable to detect version for - # To adopt the src/ layout you'll need the following section # If you are using a flat layout you can likely remove this! [tool.setuptools.packages.find] where = ["src"] +# How do i specify the root correctly to help setuptools find the version? +# LookupError: setuptools-scm was unable to detect version for # This is optional if you wish to use scm for versioning [tool.setuptools_scm] +# This root setting allows it to find the root where the .git file is root = "../" version_scheme = "post-release" local_scheme = "node-and-date" # what does this do? -write_to = "src/examplePy/_version_generated.py" +# FileNotFoundError: [Errno 2] No such file or directory: '../examplePy/_version_generated.py' +write_to = "example1b_build_setuptools_scm/src/examplePy/_version_generated.py" # https://packaging.python.org/en/latest/tutorials/packaging-projects/#configuring-metadata # How do we know how much metadata to include?