Giter Site home page Giter Site logo

pantsbuild / pants Goto Github PK

View Code? Open in Web Editor NEW
3.1K 65.0 598.0 156.72 MB

The Pants Build System

Home Page: https://www.pantsbuild.org

License: Apache License 2.0

Python 77.95% Shell 0.24% Rust 19.02% Starlark 0.88% Go 0.67% C 0.01% Java 0.82% Scala 0.18% Kotlin 0.05% Dockerfile 0.02% JavaScript 0.16% Nix 0.01% TypeScript 0.01%
build-tool build-tools build-system monorepo python java scala golang javascript rust

pants's Introduction

Pants Build System

Pants is a scalable build system for monorepos: codebases containing multiple projects, often using multiple programming languages and frameworks, in a single unified code repository.

Some noteworthy features include:

  • Explicit dependency modeling.
  • Fine-grained invalidation.
  • Shared result caching.
  • Concurrent execution.
  • Remote execution.
  • Unified interface for multiple tools and languages.
  • Extensibility and customizability via a plugin API.

Documentation: www.pantsbuild.org.

Getting started

See the getting started documentation.

Credits

Linux ARM64 CI resources provided by Works on ARM.

macOS CI resources provided by MacStadium.

pants's People

Contributors

alextereshenkov avatar alonsodomin avatar asherf avatar baroquebobcat avatar benjyw avatar blorente avatar cheister avatar cosmicexplorer avatar dependabot[bot] avatar digwanderlust avatar dt avatar dturner-tw avatar eric-arellano avatar ericzundel avatar gmalmquist avatar gshuflin avatar huonw avatar illicitonion avatar jsirois avatar kaos avatar kwlzn avatar lahosken avatar mateor avatar peiyuwang avatar pvlugter avatar ryan-williams avatar stuhood avatar tdyas avatar thejcannon avatar wisechengyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pants's Issues

Support nested Source roots

Currently pants fails with mysterious error when it encounters targets with overlapping source root. It does not fail fast.

But discussions has led to the idea of supporting overlapping source root. The concept of SourceRoot seems applicable to IDEs and build system should be oblivious to it. Support of overlapping sourceroot would help. Even failing fast with correct error message would be helpful to the user before the support of overlapping source root lands.

Remove java_sources attribute and replace it with possiblly source target.

There were a lot of issues discussed

This is not a final doc..

Background: We currently support this using the java_sources attribute on scala_library.

This has a few issues:

  1. It requires a lot of special-casing.
  2. Unintuitively, java_sources=, despite the name, actually points to java_library targets. It's not a glob of sources.
  3. Confusingly, the java_library targets attached as java sources are "broken": They don't build standalone, like any other java_library would.

Proposal:

  • Introduce a source_library() target type. source_library has sources= and deps= as usual. A source_library is just an alias for a bunch of sources. The intention is that tasks don't act on them directly.
  • Introduce a source_libraries=[] attribute on any target (or any WithSources target, in the current world).
  • Add a method get_actionable_sources() (less janky name TBD) to Target (WithSources today). This method will return all the sources you need to act on, your own and those of the source_libraries in your source_libraries attribute.
  • Make all tasks use this method when deciding what sources to act on. We only need to change JvmCompile right now though.
  • Make pointing to a source_library in your dependencies to throw an error. This helps avoid subtle BUILD file mistakes.

Some points from email thread

How to make sure, there is 1:1 correspondence between source_libraries and libraries?
This only affects publishing.
Is it pants which should not allow same sources to be part of different libs or the consumers to write good/clean  build files?

  •  Note that we have the same problem today: nothing prevents two different scala_library targets from referencing the same java_library in their java_sources. Also, the java_library itself might be publishable independently - we don't verify that java_sources only references targets that themselves have scala dependencies...
    So I guess we should add this to the list of things we want a future 'BUILD graph validator' to deal with...

scala compile sad: NoClassDefFoundError: scala/ScalaObject

(various cleaning operations that escalated in levels of desperation culminating in a clean.sh and a 'git clean -fdx')
./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

results in

14:28:39 00:00 [compile]
14:28:39 00:00 [zinc]
java.lang.NoClassDefFoundError: scala/ScalaObject
at java.lang.ClassLoader.defineClass1(Native Method)

This reminds me of something that happened in Twitter-internal a few weeks back. The (workaround? fix?) for that was to edit pants.ini to add 3rdparty:scala-library to some 'deps'

Full majestic stack trace follows:

$ ./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

14:35:48 00:00 [main](To run a reporting server: ./pants server)
14:35:48 00:00 [setup]
14:35:48 00:00 [bootstrap]
14:35:48 00:00 [parse]
14:35:48 00:00 [bootstrap]
14:35:48 00:00 [bootstrap-jvm-tools]
14:35:48 00:00 [gen]
14:35:48 00:00 [thrift]
14:35:48 00:00 [scrooge]
14:35:48 00:00 [protoc]
14:35:48 00:00 [antlr]
14:35:48 00:00 [check-exclusives]
14:35:48 00:00 [check-exclusives]
14:35:48 00:00 [resolve]
14:35:48 00:00 [ivy]
14:35:48 00:00 [compile]
14:35:48 00:00 [jvm]
14:35:48 00:00 [scala]
Invalidated 1 target containing 1 source file.
14:35:48 00:00 [find-deleted-sources]
Compiling a partition containing 1 source in 1 target.
14:35:48 00:00 [compile]
14:35:48 00:00 [zinc]
java.lang.NoClassDefFoundError: scala/ScalaObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at sbt.compiler.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:117)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:99)
at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:57)
at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:52)
at sbt.compiler.CompilerCache$$anon$2.apply(CompilerCache.scala:50)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:39)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159)
at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:39)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:37)
at sbt.inc.IncrementalCommon.cycle(Incremental.scala:93)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:37)
at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:58)
at sbt.inc.Incremental$.compile(Incremental.scala:37)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:27)
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150)
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
at com.typesafe.zinc.Compiler.compile(Compiler.scala:184)
at com.typesafe.zinc.Main$.run(Main.scala:98)
at com.typesafe.zinc.Main$.main(Main.scala:15)
at com.typesafe.zinc.Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280)
Caused by: java.lang.ClassNotFoundException: scala.ScalaObject
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 45 more
[info] Compiling 1 Scala source to /Users/lhosken/workspace/pants/.pants.d/scalac/classes...

FAILURE: Zinc compile failed.

           Waiting for background workers to finish.
           FAILURE

Ivy resolves for goals other than compile are inefficient

Today the ivy resolve task hacks in a secondary means of resolving and mapping artifacts for use by goals like idea, eclipse, binary and bundle. Ideally we could hook the resolver in such a way that a normal resolve nets us a full artifact mapping efficiently.

./pants tests/python/pants_test/tasks:jar_create fails on master

$ ./pants tests/python/pants_test/tasks:jar_create

got a couple of failures, both of the form "TypeError: init() got an unexpected keyword argument 'jar_javadoc'"

...
tests/python/pants_test/tasks/test_jar_create.py:153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pants_test.tasks.test_jar_create.JarCreateExecuteTest testMethod=test_javadoc_jar_constructor_required>
context = <pants.goal.context.Context object at 0x102e4ea10>, empty = False
kwargs = {'jar_javadoc': True}

    def assert_javadoc_jar_contents(self, context, empty=False, **kwargs):
      with self.add_products(context, 'javadoc', self.jl, 'a.html', 'b.html'):
        with self.add_products(context, 'scaladoc', self.sl, 'c.html'):
>         JarCreate(context, **kwargs).execute(context.targets())
E         TypeError: __init__() got an unexpected keyword argument 'jar_javadoc'

tests/python/pants_test/tasks/test_jar_create.py:228: TypeError

and

tests/python/pants_test/tasks/test_jar_create.py:153: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pants_test.tasks.test_jar_create.JarCreateExecuteTest testMethod=test_javadoc_jar_not_required>
context = <pants.goal.context.Context object at 0x102f14550>, empty = True
kwargs = {'jar_javadoc': False}

    def assert_javadoc_jar_contents(self, context, empty=False, **kwargs):
      with self.add_products(context, 'javadoc', self.jl, 'a.html', 'b.html'):
        with self.add_products(context, 'scaladoc', self.sl, 'c.html'):
>         JarCreate(context, **kwargs).execute(context.targets())
E         TypeError: __init__() got an unexpected keyword argument 'jar_javadoc'

tests/python/pants_test/tasks/test_jar_create.py:228: TypeError

"examples" or "dogfood" repo for sample code, ad-hoc experimenting

We have sample code to demonstrate how to set up a source tree for Pants, yay. The sample code sits uneasily in the same source tree as Pants itself. We'd like to migrate the sample code out to another repo. We want to preserve ease of:

  • testing local pants hacks on sample code
  • ci.sh ?
  • docs "include" sample code

See the discussion: https://groups.google.com/forum/#!searchin/pants-devel/commons-ish/pants-devel/-AWR8Apifwo/gOkHDNz4eKwJ

Some excerpts from that discussion:

Travis Crawford:

...a repo we use to test pants, and that could also be our example repo. ... we could use this pants testing repo for...

  • Does bundle produce the expected output?
  • Does jar produce a jar that looks like the intended one?
  • Did publish to a local directory do things correctly?

...black-box testing...compare what it actually produced against what's expected...supplement the unit tests. It could also be used in our docs as our examples repo.

Benjy Weinberger:

I like the dogfood repo idea, rather than cluttering pantsbuild/pants up with java/scala source, even frivolous example source.

Also, it's a more realistic example because it's a separate repo. pantsbuild/pants is special in all sorts of ways (e.g., you can run pants from source).

docs: JVMProjects docs: s/ pingpong / hello /

pingpong was a fine example for twitter/commons, since it uses code from twitter/commons. Now that we're not in twitter/commons, it's a strange example: all of its deps are 3rdparty.

Get rid of Missing dependency warnings in java/scala compile.

./pants goal compile on a scala_library which includes java_sources spits this warning.

The below mentioned dependencies are actually provided by java_sources.

                       Missing BUILD dependency finagle/finagle-thrift/src/main/scala -> finagle/finagle-thrift/src/main/java because:
                           finagle/finagle-thrift/src/main/scala/com/twitter/finagle/thrift/ThriftClientBufferedCodec.scala uses finagle/finagle-thrift/src/main/java/com/twitter/finagle/thrift/ThriftClientRequest.java
                       Missing BUILD dependency finagle/finagle-zipkin/src/main/scala -> finagle/finagle-thrift/src/main/java because:
                           finagle/finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/Endpoint.scala uses finagle/finagle-thrift/src/main/java/com/twitter/finagle/thrift/thrift/Endpoint.java
                           finagle/finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/Span.scala uses finagle/finagle-thrift/src/main/java/com/twitter/finagle/thrift/thrift/Annotation.java
                           finagle/finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/Span.scala uses finagle/finagle-thrift/src/main/java/com/twitter/finagle/thrift/thrift/BinaryAnnotation.java
                           finagle/finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/Span.scala uses finagle/finagle-thrift/src/main/java/com/twitter/finagle/thrift/thrift/Endpoint.java
                           finagle/finagle-zipkin/src/main/scala/com/twitter/finagle/zipkin/thrift/Span.scala uses finagle/finagle-thrift/src/main/java/com/twitter/finagle/thrift/thrift/Span.java

pants.pex not found

Using OS X. After executing ./pants:

Traceback (most recent call last):
  File "src/python/pants/bin/pants_exe.py", line 19, in <module>
    from pants.commands.register import register_commands
  File "~/Desktop/GitStuff/pants/src/python/pants/commands/register.py", line 8, in <module>
    from pants.commands.goal import Goal
  File "~/Desktop/GitStuff/pants/src/python/pants/commands/goal.py", line 36, in <module>
    from pants.engine.engine import Engine
ImportError: No module named engine
./pants: line 90: ~/Desktop/GitStuff/pants/pants.pex: No such file or directory
./pants: line 90: exec: ~/Desktop/GitStuff/pants/pants.pex: cannot execute: No such file or directory

Make it straightforward to bring in multiple jars with same name

Currently in pants, doing something straightforward like this:

    jar_library(name = 'stanford-corenlp',
      dependencies = [
        jar(org = 'edu.stanford.nlp', name = 'stanford-corenlp', rev = '3.3.1').with_sources(),
        jar(org = 'edu.stanford.nlp', name = 'stanford-corenlp', rev = '3.3.1', classifier='models')
      ]
    )

Doesn't actually work. It would be nice if we changed pants to work this way. This can be made to work by using multiple .with_artifact() clauses, but we could change the user-facing bit so that the obvious thing works, and the target merging still happens behind the scenes.

Inconsistent python style across files

There are style inconsistencies across the codebase, probably reflecting different original authors. Obviously this is not a priority, but something that we may want to slowly fix (yes I know it interferes with git blame info).

docs: first_tutorial s/ pingpong / hello /

pingpong was a fine example for twitter/commons, since it uses code from twitter/commons. Now that we're not in twitter/commons, it's a strange example: all of its deps are 3rdparty.

doc += how to ask for help

There was some back-and-forth in a recent issue: User reported a problem. Pants guru asked for branch+sha. User replied with other stuff. Pants guru asked for branch+sha again. User replied: dunno how to get current branch+sha. This is totally reasonable; nobody's born knowing this.

Mmmaybe we should have a checklist of info to include with a question/bug report/whatever. Maybe it starts with

If you can repro this in the pantsbuild/pants repo, please include

  • git branch, output of git branch
  • git sha, output of git log -1

tshoot might be a good place for this.

Pants should take over ivysettings.xml generation

There are many reasons for this, including uniformity of pants interfaces to end users and implementation hiding (this is a bit of a pipe dream - but we conceivably could replace ivy). The pressing reason though is cache control. We have pants code that needs to know the location of the artifact and resolution caches and we can only know these properly by interposing on their configuration.

docs: early docs mention a basic thing: hashed file contents

question and answer from a mail thread

What happens when i change branch? Does pants see my source tree has changed and it rebuilds? or do i have to do
./pants goal clean-all everytime?

Pants - for the most part - does not care about version control. It just looks at the sha1 of a target's sources (and deps) when deciding whether its latest work for the target can be re-used.
So switching branches should be detected by pants in-so-far as a file's content changes between branches - it often does not.

That's pretty fundamental to how Pants works. So far, the docs don't explain it, tho.

./pants tests/python/pants_test/tasks:ivy_utils fails on master

In test_force_override:

...
        dep1 = dependencies[0]
        self.assert_attributes(dep1, org='org1', name='name1', rev='rev1')
        conf = self.find_single(dep1, 'conf')
>       self.assert_attributes(conf, name='default', mapped='default')

tests/python/pants_test/tasks/test_ivy_utils.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <pants_test.tasks.test_ivy_utils.IvyUtilsGenerateIvyTest testMethod=test_force_override>
elem = <Element conf at 10d119d40>
kwargs = {'mapped': 'default', 'name': 'default'}

    def assert_attributes(self, elem, **kwargs):
>     self.assertEqual(dict(**kwargs), dict(elem.attrib))
E     AssertionError: {'name': u'default', 'mapped': u'default'} != {'name': 'default'}

Wickman's proposal for pants reorg

This was originally filed here

When pants moves to its own repository, I'd like to take the opportunity to do a code reorg in order to make it easier for other projects / repositories / organizations to use pants.

current layout

Backends (java, scala, python, etc) consist of tasks and targets, and basic wiring into phases. Right now the code org is something like this:

  • pants.bin
  • pants.base
  • pants.commands
  • pants.doc
  • pants.goal
  • pants.java
  • pants.python
  • pants.pants_doc
  • pants.python
  • pants.targets
  • pants.tasks

Bolded is what I consider to be "pants core" – as in pants simply can't operate without code in there. Specifically this is the execution engine and ancillary stuff like base classes for everything else (Task, Goal, Target.) Currently the Task/TaskError base classes are in pants.tasks.init but should be moved into pants.base.

While pants/init.py contains some code necessary for pants to run (get_buildroot), most of it should be moved out to the leaves (is_* e.g. is_java, is_scala) and 'from twitter.pants.targets import *' should go away entirely.

new backend layout

I propose that everything in pants.java, pants.python, pants.targets and pants.tasks be reorganized (temporarily) into a new toplevel directory:

  • pants.backend

With the following layout:

  • pants.backend.{language}.init
  • pants.backend.{language}.base
  • pants.backend.{language}.targets
  • pants.backend.{language}.tasks

Each backend is treated as a namespace package so that they can more easily be developed by third parties. This model works naturally with the python.new backend, and for the most part with the Java and Scala backends.

One case where this is more challenging is IDL backends. My proposal for handling this is by making the CodeGen(Task) base class in pants.base the canonical base class for code generation, and specific pants.backend.thrift and pants.backend.protobuf IDL backends that other backends can then depend upon. For example, pants.backend.python would depend upon pants.backend.thrift, and subclass the ThriftGen base from pants.backend.thrift.base to create a Python-specific codegen target. (I've already done the refactor in the python.new branch to make this more straightforward through language-specific createtarget abstract base classes.) So rather than the 'gen' phase with 'gen:thrift' and 'gen:protobuf' goals, you'd have the 'gen' phase with 'gen:thrift-python', 'gen:thrift-java', 'gen:protobuf-go' etc.

bootstrapping

To bootstrap a repository to use pants, you would do the following:

  1. copy the bootstrap_pants.py script into your repository and name it 'pants', chmod +x
  2. add a root BUILD file which sets up your source root and defines which plugins you'd like

The pants bootstrap script currently bootstraps itself from PyPI, though some of the dependent source dists have not yet been published (specifically twitter.pants, twitter.common-core, twitter.common.python) but we can do that when we're ready – especially since twitter.pants could be 'pb' or 'pantsbuild' or something else. If you don't have external network access, you'd add a field in pants.ini that specifies where the bootstrapper should be looking for artifacts and you'd cache them locally. Similarly, by default the bootstrap script bootstraps the latest version of pants, but you could address specific versions in the pants.ini using the existing Requirement format (e.g. 'pb==0.3.2' or 'pb>0.3,<1').

The bootstrapper script would write pants.pex and on subsequent runs 1) check the pants.pex version to make sure it's compatible with the one defined in pants.ini and if so 2) os.execv.

repository BUILD

The root BUILD would look like:

require('pants.backend.java==0.2.3')
require('pants.backend.python')
require_path('plugins/foursquare')
# [any extra project specific methods or variables defined here]

Each backend would be a PythonLibrary with a corresponding SetupPy artifact, which can have install_requires in order to dictate dependencies (e.g. pystache, boto, pants.backend.thrift, whatever.) The upside being that 1) this is all already implemented and 2) they could write a backend as a standard setup.py project outside of pants.

require_path would simply look for an init.py in that directory and install everything there into the root namespace.

Currently for BUILD files to be usable, we autoinject 'from pants.targets import *' and 'from twitter.common.quantity import Amount, Time' in every single one. Instead, we'd deposit the union of the namespaces created by the buildroot BUILD, and the init.py of each registered backend into all down-tree BUILDs. The backend _init_s would also be responsible for wiring tasks into phases.

Java "hello world" += dep (and use) 3rdparty:util-core

In the discussion over https://rbcommons.com/s/twitter/r/191/ , in which docs started moving away from "pingpong" java example a darned good idea emerged:

Do you plan to delete pingpong entirely? If so, let's add a third-party jar dep to hello, so we can demo that?

Yeah. [but the test depends on 3rdparty:junit so we can demo it]

I'd rather have another example, in src/, so we can use it to test things like bundling.

Maybe 3rdparty:util-core, and find some basic code in there to call?

add Scala "hello world" example

we have a one-file scala example, which is lovely. someday I dream of something that illustrates a library, a binary, a test, a 3rdparty dep.

ImportError: No module named confluence

Sphinx's autodoc feature warns about a broken import in... a task we use for documentation. I wonder if this means I get to play in the cheese shop.

/Users/lhosken/workspace/pants/src/python/pants/docs/tasks.rst:93: WARNING: autodoc: failed to import module u'pants.tasks.confluence_publish'; the following exception was raised:
Traceback (most recent call last):
File "/opt/twitter/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Sphinx-1.2-py2.7.egg/sphinx/ext/autodoc.py", line 335, in import_object
import(self.modname)
File "/Users/lhosken/workspace/pants/src/python/pants/tasks/confluence_publish.py", line 10, in
from twitter.common.confluence import Confluence, ConfluenceError
ImportError: No module named confluence

pants command fails if there is no top level BUILD file present

Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/runpy.py", line 122, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/runpy.py", line 34, in _run_code
    exec code in run_globals
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/__main__.py", line 24, in <module>
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.bootstrap/_twitter_common_python/pex_bootstrapper.py", line 65, in bootstrap_pex
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.bootstrap/_twitter_common_python/pex.py", line 201, in execute
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.bootstrap/_twitter_common_python/pex.py", line 237, in execute_entry
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.bootstrap/_twitter_common_python/pex.py", line 260, in execute_pkg_resources
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/bin/pants_exe.py", line 184, in main
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/bin/pants_exe.py", line 167, in _run
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/commands/goal.py", line 436, in run
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/commands/goal.py", line 227, in _execute
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/engine/engine.py", line 182, in execute
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/engine/group_engine.py", line 281, in attempt
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/engine/group_engine.py", line 172, in attempt
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/engine/group_engine.py", line 143, in execute_task
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/twitter/pants_internal/tasks/idl_resolve.py", line 36, in execute
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/tasks/nailgun_task.py", line 69, in create_java_executor
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/tasks/jvm_tool_bootstrapper.py", line 19, in get_jvm_tool_classpath
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/tasks/jvm_tool_bootstrapper.py", line 30, in <lambda>
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/tasks/bootstrap_jvm_tools.py", line 62, in bootstrap_classpath
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/tasks/bootstrap_jvm_tools.py", line 43, in resolve_tool_targets
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/goal/context.py", line 282, in resolve
  File "/Users/tdesai/.pants.d/bin/pants.pex/pants-0.0.5-testing-py26.pex/.deps/pantsbuild.pants-0.0.17-py2.6.egg/pants/targets/pants_target.py", line 43, in __init__
pants.base.target.TargetDefinitionException: Error with BUILD.temp: An invalid pants pointer has been specified. Please identify this reference and correct the issue: BUILD file does not exist at: /Users/tdesai/projects/aviary/BUILD

After adding this BUILD fixes it.

Support publishing java and scala sources combined in one jar.

Moving this from twitter-commons project to here.
twitter-archive/commons#242

For any case where pants finds: scala_library(... java_sources=...) we should publish the targets pointed to in java_sources in the scala_library jar. This leaves the classes that cycle self-contained in 1 artifact.

This means:

  1. for a scala_library with provides=, fail fast if associated java_sources targets also provide - this ensure scala_library.provides uniquely defines the artifact
    
  2. Modify the jar phase to handle the jaring logic?
  3. Modify the publish phase to export this validator logic

server stops refreshing after a successful pants run

Environment: ubuntu linux: Linux vir 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
python 2.7.3
gcc 4.6.3
java version 1.6.0_30 (openjdk icetea6 1.13.1)

pants at sha 6e535bf

I can start the pants server (./pants goal server) and then run CI (./build-support/bin/ci.sh) successfully, however, at some point chrome stops getting data from the pants server. Indeed, if I try to connect to the server with curl, I see the following errors coming from what I can only assume is the pants server running in the background (the curl request returns "empty reply from server")

Exception happened during processing of request from ('127.0.0.1', 53142)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/jioannidis/workspace/pants/pants.pex/pants/reporting/reporting_server.py", line 341, in init
File "/home/jioannidis/workspace/pants/pants.pex/pants/reporting/reporting_server.py", line 50, in init
File "/usr/lib/python2.7/SocketServer.py", line 638, in init
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/home/jioannidis/workspace/pants/pants.pex/pants/reporting/reporting_server.py", line 66, in do_GET
File "/home/jioannidis/workspace/pants/pants.pex/pants/reporting/reporting_server.py", line 79, in _handle_runs
File "/home/jioannidis/workspace/pants/pants.pex/pants/base/mustache.py", line 59, in render_name
File "/usr/lib/python2.7/pkgutil.py", line 591, in get_data
return loader.get_data(resource_name)

ZipImportError: bad local file header in /home/jioannidis/workspace/pants/pants.pex

add Python sample code

A python "hello world" example would be lovely: a library, a binary, a test, a 3rdparty dep.

add README.md, maybe CONTRIBUTING.md

Most folks, in the absence of a README, don't think "Maybe I should check for src/python/twitter/pants/docs/index.rst instead". Probably a stub README (short blurb with a link to http://pantsbuild.github.io/) would be helpful.

Back in 2013, I asked about good starter doc files to have in a repo. Chris Aniszczyk mentioned LICENSE, which we have, yay. He also mentioned README.md and CONTRIBUTING.md which we don't, argh. (CONTRIBUTING could be a short blurb w/a link to http://pantsbuild.github.io/dev.html)

publish python commons eggs

This step will allow slicing the pants code out of twitter-commons into the pantsbuild repo. Changes to python commons will go through twitter-commons and be picked up with requirement upgrades.

Need a solution for flaky pypi fetches under travis-ci

The incidence of sdist fetch failures on travis-ci is high enough that it disrupts reasonable efforts to keep the build green. Twitter uses an internal pypi mirror exclusively and Foursquare uses one in preference to pypi which it falls back to. Both companies have success using this strategy under ci. Consider doing something similar using the binary hosting options discussed here: https://rbcommons.com/s/twitter/r/22/

docs: web docs show 'pants goal help' CLI flag doc

'./pants goal help' is lovely, but Google doesn't index the contents so well. We should capture them on a web page.

(these days, the flags show up in the Goals Reference via the janky "got it working one time in a branch" approach. But something, y'know, maintainable would be better)

Incorrect command ./pants server printed in console log.

Currently the

[tw-mbp13-tdesai pants]$ git grep 'reporting server'
src/python/pants/bin/pants_exe.py:    run_tracker.log(Report.INFO, '(To run a reporting server: ./pants server)')

however, if you run ./pants server it gives the following error

[tw-mbp13-tdesai pants]$ ./pants server
Failed to execute pants build: Traceback (most recent call last):
  File "/Users/tdesai/projects/pants/pants.pex/pants/bin/pants_exe.py", line 89, in _synthesize_command
    Address.parse(root_dir, command)
  File "/Users/tdesai/projects/pants/pants.pex/pants/base/address.py", line 57, in parse
    buildfile = BuildFile(root_dir, path)
  File "/Users/tdesai/projects/pants/pants.pex/pants/base/build_file.py", line 54, in __init__
    raise IOError("BUILD file does not exist at: %s" % buildfile)
IOError: BUILD file does not exist at: /Users/tdesai/projects/pants/server

[tw-mbp13-tdesai pants]$ 

Fix this to ./pants goal server

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.