enough-analyst-54434
01/14/2021, 8:49 PMpython_library()
declaration for my pex_binary(...actual metadata I wrote down...)
to work. Whether the - what looks like a no-op - python_library()
was a foo()
or a bar()
I'd still be mystified by the need. I can go read excellent docs that explain this to me, but at that point the newbie game is up and I can learn what python_library()
the word means.hundreds-father-404
01/14/2021, 8:53 PMenough-analyst-54434
01/14/2021, 8:54 PMjolly-midnight-72759
01/14/2021, 8:55 PMinstall_requires: <https://python-packaging.readthedocs.io/en/latest/dependencies.html|https://python-packaging.readthedocs.io/en/latest/dependencies.html>
setup.py
uses packages to name the code that is around the file and not explicitly named within the file.hundreds-father-404
01/14/2021, 8:55 PMenough-analyst-54434
01/14/2021, 8:55 PMjolly-midnight-72759
01/14/2021, 8:56 PMenough-analyst-54434
01/14/2021, 8:56 PMenough-analyst-54434
01/14/2021, 8:57 PMjolly-midnight-72759
01/14/2021, 8:57 PMenough-analyst-54434
01/14/2021, 8:57 PMjolly-midnight-72759
01/14/2021, 8:59 PMpython_packages
or python_requirements
but the latter has a macro namespace collision that makes it not work in pants-land.hundreds-father-404
01/14/2021, 9:00 PMpython_library
. We've had 4 users the past few months be tripped up by this iirc, I do think it's a real problem.
But the better solution is to fix targets for first party code, so this rename introduces possibly unnecessary churn.enough-analyst-54434
01/14/2021, 9:01 PMpython_requirements
were changed to a target a rule could take empty python_requirements and slurp in a sibling requirementstx, it could take, otherwise, either a file= or *reqs args.jolly-midnight-72759
01/14/2021, 9:02 PMsdist
, a module directory, etc. Letting a particular BUILD
define all its dependencies independent of the monorepo would make refactoring some of our over entangled projects easier to upgrade.high-egg-2153
01/15/2021, 12:55 AMechoing-lock-18813
01/15/2021, 4:57 AM./pants build rapidfire::
/Users/aminghadersohi/.cache/pants/setup/bootstrap-Darwin-x86_64/1.10.0/lib/python2.7/site-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
from cryptography import x509
timestamp: 2021-01-14T20:56:24.152463
Exception caught: (exceptions.UnicodeDecodeError) (backtrace omitted)
Exception message: 'ascii' codec can't decode byte 0xe2 in position 4: ordinal not in range(128)
echoing-lock-18813
01/15/2021, 4:59 AMrapid-mouse-79975
01/17/2021, 11:26 AMrapid-mouse-79975
01/17/2021, 11:28 AMnode_module
target to build the frontend application and see that it's built and the build directory is in the .pants.d
directory, however I would like to embed what's built into a Python application and the produced build is not getting included. I'm new to Pants, I feel like I might be missing something.rapid-mouse-79975
01/17/2021, 11:30 AMpython37_binary(
name = "testing_foo",
source = "hello_world.py",
dependencies = [
":testing_lib",
],
)
python3_library(
name = "testing_lib",
sources = [
"!hello_world.py",
],
dependencies = [
":resources",
"src/frontend"
],
)
resources(
name = "resources",
sources = [
"resources/**/*.yml",
"web/templates/**/*",
]
)
This is the build file for the python app.
This is the BUILD.py file for react app
node_module(
name = "frontend",
sources = [
"package.json",
"yarn.lock",
".npmrc",
".prettierrc",
".eslintrc.json",
"tsconfig.json",
"public/**/*",
"src/**/*",
"scripts/**/*",
"config/**/*"
],
build_script = "build",
output_dir = "build",
package_manager = "yarn",
)
adamant-carpenter-58055
01/18/2021, 3:51 PMh2o_pysparkling_2.4
which needs to be mapped using module_mapping
. However, the .
in the package name seems to prevent pants to understand how to do the mapping. Is this intended behaviour? If not, any idea how to get around this?echoing-nightfall-72095
01/18/2021, 8:03 PMenv: python3.8: No such file or directory
. Probably I’m using the wrong Python distribution or?enough-analyst-54434
01/18/2021, 9:46 PMenough-analyst-54434
01/18/2021, 9:48 PM/usr/bin/env python3
here: https://www.pantsbuild.org/docs/python-target-types#pex_binaryenough-analyst-54434
01/18/2021, 9:49 PMnarrow-activity-17405
01/19/2021, 9:02 AMresources
using a macro? The thing is... In each package within my monorepo, I'm defining two exactly the same resources, like this:
resources(
name = "py.typed",
sources = ["py.typed"],
)
resources(
name = "VERSION",
sources = ["VERSION"],
)
It would be nice if I can simplify this to something like this:
my_standard_resources()
echoing-nightfall-72095
01/19/2021, 6:09 PM./pants run apps/app_a
. But when I try to ./pants package apps/a
I get this error:
Exception: String("Can only merge Directories with no duplicates, but found 3 duplicate entries in :\n\n`__init__.py`: 1.) file digest=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 size=0:\n\n\n\n`__init__.py`: 2.) file digest=c4f92a69e828f5701ffebac2959f704f9fe06ef3d559e146663cb14d44866416 size=1674:\n\n\"\"\"Helper classes for configuration management.\"\"\"\nimport os\n\n\nclass ModelConfig:\n \"\"\"Model configuration class.\"\"\"\n\n def __init__(\n self, name: str, link: str, checksum: str, language_code=\"en\"\n ):\n self.fullname = name\n self.link = link\n self.language_code = language_code\n self.checksum = checksum\n\n def get_fullname(self):\n \"\"\"\n\n Returns\n -------\n Model fullname, i.e. \'<name_of_model>-<version>\'\n \"\"\"\n return self.fullname\n\n def get_name(self):\n \"\"\"\n\n Returns\n -------\n model name without version\n\n \"\"\"\n return self.fullname.split(\"-\")[0]\n\n def get_link(self):\n \"\"\"\n\n Returns\n -------\n model link\n \"\"\"\n return self.link\n\n def get_language_code(self):\n \"\"\"\n\n Returns\n -------\n model language code\n \"\"\"\n return self.language_code\n\n def get_version(self):\n \"\"\"\n\n Returns\n --\n... TRUNCATED contents from 1674B to 1024B (Pass -ldebug to see full contents).\n\n`__init__.py`: 3.) file digest=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 size=0:\n\n")
I’ve not been able to understand what I’m doing wrong.enough-analyst-54434
01/19/2021, 6:12 PMenough-analyst-54434
01/19/2021, 6:19 PM__init__.py
contents in different source roots. That is not good from a Python perspective - nothing to do with Pants. I can explain why its not good if that's not clear - just speak up. To be more concrete though, an example:
Say you have these source roots:
a/root1
a/root2
a/root3
Under the first two you have the same Python package `bob`:
a/root1/bob/
__init__.py
jake.py
a/root2/bob/
__init__py
jane.py
I'm claiming a/root1/bob/__init__.py
and a/root2/bob/__init__.py
have different contents and Pants is complaining (rightly) about that.