enough-analyst-5443401/14/2021, 8:49 PM
declaration for my
to work. Whether the - what looks like a no-op -
pex_binary(...actual metadata I wrote down...)
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
the word means.
hundreds-father-40401/14/2021, 8:53 PM
enough-analyst-5443401/14/2021, 8:54 PM
jolly-midnight-7275901/14/2021, 8:55 PM
uses packages to name the code that is around the file and not explicitly named within the file.
hundreds-father-40401/14/2021, 8:55 PM
enough-analyst-5443401/14/2021, 8:55 PM
jolly-midnight-7275901/14/2021, 8:56 PM
enough-analyst-5443401/14/2021, 8:56 PM
enough-analyst-5443401/14/2021, 8:57 PM
jolly-midnight-7275901/14/2021, 8:57 PM
enough-analyst-5443401/14/2021, 8:57 PM
jolly-midnight-7275901/14/2021, 8:59 PM
but the latter has a macro namespace collision that makes it not work in pants-land.
hundreds-father-40401/14/2021, 9:00 PM
. 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-5443401/14/2021, 9:01 PM
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-7275901/14/2021, 9:02 PM
, a module directory, etc. Letting a particular
define all its dependencies independent of the monorepo would make refactoring some of our over entangled projects easier to upgrade.
high-egg-215301/15/2021, 12:55 AM
echoing-lock-1881301/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-1881301/15/2021, 4:59 AM
rapid-mouse-7997501/17/2021, 11:26 AM
rapid-mouse-7997501/17/2021, 11:28 AM
target to build the frontend application and see that it's built and the build directory is in the
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-7997501/17/2021, 11:30 AM
This is the build file for the python app. This is the BUILD.py file for react app
python37_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/**/*", ] )
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-5805501/18/2021, 3:51 PM
which needs to be mapped using
. 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-7209501/18/2021, 8:03 PM
. Probably I’m using the wrong Python distribution or?
env: python3.8: No such file or directory
enough-analyst-5443401/18/2021, 9:46 PM
enough-analyst-5443401/18/2021, 9:48 PM
enough-analyst-5443401/18/2021, 9:49 PM
narrow-activity-1740501/19/2021, 9:02 AM
using a macro? The thing is... In each package within my monorepo, I'm defining two exactly the same resources, like this:
It would be nice if I can simplify this to something like this:
resources( name = "py.typed", sources = ["py.typed"], ) resources( name = "VERSION", sources = ["VERSION"], )
echoing-nightfall-7209501/19/2021, 6:09 PM
. But when I try to
./pants run apps/app_a
I get this error:
./pants package apps/a
I’ve not been able to understand what I’m doing wrong.
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(\"-\")\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")
enough-analyst-5443401/19/2021, 6:12 PM
enough-analyst-5443401/19/2021, 6:19 PM
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:
Under the first two you have the same Python package `bob`:
a/root1 a/root2 a/root3
a/root1/bob/ __init__.py jake.py a/root2/bob/ __init__py jane.py
have different contents and Pants is complaining (rightly) about that.