Skip to content

Commit

Permalink
pythonlib docs: remove ExampleCrossModulePython and snippet comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jodersky committed Nov 27, 2024
1 parent c05f252 commit 4338fa2
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 59 deletions.
36 changes: 1 addition & 35 deletions example/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object `package` extends RootModule with Module {
object basic extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "basic"))
}
object pythonlib extends Module {
object basic extends Cross[ExampleCrossModulePython](build.listIn(millSourcePath / "basic"))
object basic extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "basic"))
object dependencies extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "dependencies"))
}

Expand Down Expand Up @@ -100,40 +100,6 @@ object `package` extends RootModule with Module {
object typescript extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "typescript"))
}

trait ExampleCrossModulePython extends ExampleCrossModuleJava {
override def lineTransform(line: String) ={
this.millModuleSegments.parts.last match {
case "1-simple" =>
val updatedLine = line
.replace("xref:{language-small}lib/web-examples.adoc", "link:") // Need updated link
.replace("xref:{language-small}lib/build-examples.adoc", "link:") // Need updated link
.replace("compile", "typeCheck")
.replace("Scala console", "Python console")
.replace("Ammonite Scala", "Python")
.replace("assembly", "typeCheck")
.replace(s"// $$ mill jar # bundle the classfiles into a jar suitable for publishing", "")
.replace("foo.scalaVersion", "foo.typeCheck")
updatedLine
case "2-custom-build-logic" =>
val updatedLine = line
.replace("17", "10") // it's just the change for page count
.replace("`allSourceFiles` (an existing task)", "`allSourceFiles`")
updatedLine

case "3-multi-module" =>
val updatedLine = line
.replace("compiled", "typeChecked")
.replace("compile", "typeCheck")
.replace("...bar.BarTests...simple...", "test_escaping (...test.TestScript...) ... ok")
.replace("...bar.BarTests...escaping...", "test_simple (...test.TestScript...) ... ok")
updatedLine

case _ => line

}
}
}

trait ExampleCrossModuleKotlin extends ExampleCrossModuleJava {

override def lineTransform(line: String) = this.millModuleSegments.parts.last match {
Expand Down
3 changes: 0 additions & 3 deletions example/pythonlib/basic/1-simple/build.mill
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//// SNIPPET:BUILD
package build
import mill._, pythonlib._

Expand All @@ -14,7 +13,6 @@ object foo extends PythonModule {

// This is a basic Mill build for a single `PythonModule`, with one
// dependency and a test suite using the `Unittest` Library.
//// SNIPPET:TREE
//
// ----
// build.mill
Expand All @@ -35,7 +33,6 @@ object foo extends PythonModule {
// run.dest/
// ...
// ----
//// SNIPPET:DEPENDENCIES
//
// This example project uses one dependency - https://pypi.org/project/Jinja2/[Jinja2]
// for HTML rendering and uses it to wrap a given input string in HTML templates with proper escaping.
Expand Down
1 change: 0 additions & 1 deletion example/pythonlib/basic/2-custom-build-logic/build.mill
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//// SNIPPET:BUILD
package build
import mill._, pythonlib._

Expand Down
2 changes: 0 additions & 2 deletions example/pythonlib/basic/3-multi-module/build.mill
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//// SNIPPET:BUILD
package build
import mill._, pythonlib._

Expand All @@ -16,7 +15,6 @@ object bar extends MyModule {
def pythonDeps = Seq("Jinja2==3.1.4")
}
//
//// SNIPPET:TREE
// ----
// build.mill
// foo/
Expand Down
4 changes: 0 additions & 4 deletions example/pythonlib/dependencies/1-pip-deps/build.mill
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//// SNIPPET:BUILD
package build
import mill._, pythonlib._

Expand All @@ -9,15 +8,12 @@ object `package` extends RootModule with PythonModule {
"jinja2 @ https://github.com/pallets/jinja/releases/download/3.1.4/jinja2-3.1.4-py3-none-any.whl"
)
}
//// SNIPPET:END

// You can define the `pythonDeps` field to add dependencies to your module, which will be installed
// via https://pip.pypa.io/en/stable/[pip]. Dependencies can include
// https://peps.python.org/pep-0440/[anything that pip understands], such as `<package>==<version>`
// constraints, or even direct references to wheels.

//// SNIPPET:USAGE

/** Usage

> ./mill run
Expand Down
2 changes: 0 additions & 2 deletions example/pythonlib/dependencies/2-pip-requirements/build.mill
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// You can also read dependencies from `requirements.txt` files. This can be
// useful if you're migrating an existing project to mill.

//// SNIPPET:BUILD
package build
import mill._, pythonlib._

Expand All @@ -10,7 +9,6 @@ object `package` extends RootModule with PythonModule {
millSourcePath / "requirements.txt"
}
}
//// SNIPPET:END

/** Usage

Expand Down
3 changes: 0 additions & 3 deletions example/pythonlib/dependencies/3-unmanaged-wheels/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// you receive a wheel or folder-full-of-wheels from somewhere and need to
// include it in your project, `unmanagedWheels` is the way to do it.

//// SNIPPET:BUILD
package build
import mill._, pythonlib._

Expand All @@ -13,8 +12,6 @@ object `package` extends RootModule with PythonModule {
}
}

//// SNIPPET:END

// You can override `unmanagedWheels` to point it at a wheel (.whl file) or
// source distribution (.tar.gz with a pyproject.toml file) you place on the
// filesystem, e.g. in the above snippet any files that happen to live in the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// `requests.get` comes from the https://github.com/com-lihaoyi/requests-scala[Requests-Scala]
// library, one of Mill's xref:fundamentals/bundled-libraries.adoc[Bundled Libraries].
//
//// SNIPPET:BUILD
package build
import mill._, pythonlib._

Expand All @@ -16,8 +15,6 @@ object `package` extends RootModule with PythonModule {
}
}

//// SNIPPET:END

/** Usage

> ./mill run
Expand Down
3 changes: 0 additions & 3 deletions example/pythonlib/dependencies/5-repository-config/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// can also add your own package indexes by overriding the `indexes` task in
// the module:

//// SNIPPET:BUILD1
package build
import mill._, pythonlib._

Expand All @@ -17,8 +16,6 @@ object foo extends PythonModule {
def indexes = super.indexes() ++ Seq("https://test.pypi.org/simple/")
}

//// SNIPPET:END

// Mill uses https://pip.pypa.io/en/stable/[pip] to find and install dependencies.
//
// You can configure pip through its
Expand Down
3 changes: 0 additions & 3 deletions example/pythonlib/dependencies/6-debugging/build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// arguments mill passes to `pip install` by looking at the output of the
// `pipInstallArgs` task.

//// SNIPPET:BUILD1
package build
import mill._, pythonlib._

Expand All @@ -16,8 +15,6 @@ object `package` extends RootModule with PythonModule {
def indexes = Seq("invalid_index")
}

//// SNIPPET:END

/** Usage

> ./mill show pipInstallArgs
Expand Down

0 comments on commit 4338fa2

Please sign in to comment.