hallowed-dream-58085
06/01/2023, 10:03 AM~/libraries/projectA/
which contains pyproject.toml
, tests
, docs
, examples
, and source code
in a folder with the same name as the projectA
.
I am a bit confused of where the requirements/dependencies go. I moved the dependencies from .toml
to a requirements.txt
and put them at root. But I also tried to keep them in the .toml
.
In the docs I see that requirements go inside a BUILD
file, but I am not sure which one.
Inside the BUILD
file at the projectA, I created the python_distribution
to build the project given the dependencies inside toml but it wont take them. After running pants package
it also seems that it just stores the wheel and not rebuild it? Just wondering as I am trying to test constantly if its building correctly.broad-processor-92400
06/01/2023, 11:04 AMpants package
, pants will cache tasks like building a wheel, and only rerun them if the inputs have changed. If they haven’t changed, pants will just copy the wheel from its cache storage, rather than rerun the whole process. There’s a few ways to force it to rerun, but I suspect they won’t necessarily help with the task you’re trying to solve.
For the requirements, I think any BUILD file is fine. To start with, I might recommend keeping the project structure as similar to your existing one as possible (to get something going with minimal changes). This might mean next to the toml.
Pants has support for reading requirements from toml files too; what format are they in?
Also, taking a step back to confirm the bigger picture, is your goal to build a wheel for publishing somewhere?hallowed-dream-58085
06/01/2023, 11:11 AMpython_distribution()
it wont allow me to have a python_requirements()
.
My .toml
has a dependencies
key under `[project]`and I have additional optional dependencies for testings and docs under [project.optional-dependencies]
. But when there, It didnt seem pants would detect them as testing would say different modules are not found.hallowed-dream-58085
06/01/2023, 11:21 AMpants package
is this error which i cant really see to find why its thrown inside pants.
11:20:28.61 [ERROR] 1 Exception encountered:
Engine traceback:
in `package` goal
ProcessExecutionFailure: Process 'Run setuptools.build_meta for libraries/projectA:dist' failed with exit code 1.
stdout:
stderr:
/root/.cache/pants/named_caches/pex_root/venvs/s/14a914f5/venv/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:66: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
config = read_configuration(filepath, True, ignore_option_errors, dist)
usage: backend_shim.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: backend_shim.py --help [cmd1 cmd2 ...]
or: backend_shim.py --help-commands
or: backend_shim.py cmd --help
error: invalid command 'bdist_wheel'
hallowed-dream-58085
06/01/2023, 11:36 AMwheel
in the requires for pyproject.toml
. Using the following now works:
[build-system]
requires = ['setuptools','wheel']
build-backend = 'setuptools.build_meta'
curved-television-6568
06/01/2023, 1:53 PMI was trying to add the requirements.txt into the BUILD at the root of the projectA next to toml but because the build already had athis is likely due to not being explicitly named. Only one target in any directory may use the default name otherwise there would be name conflicts, which ought to have been the error message you observed. relevant section of the docs: https://www.pantsbuild.org/docs/targets#target-addressesit wont allow me to have apython_distribution()
.python_requirements()