From 4338fa23fa7d15f7fd62bf044dfc5dbde9046a9a Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Wed, 27 Nov 2024 16:39:46 +0100 Subject: [PATCH] pythonlib docs: remove ExampleCrossModulePython and snippet comments --- example/package.mill | 36 +------------------ example/pythonlib/basic/1-simple/build.mill | 3 -- .../basic/2-custom-build-logic/build.mill | 1 - .../pythonlib/basic/3-multi-module/build.mill | 2 -- .../dependencies/1-pip-deps/build.mill | 4 --- .../2-pip-requirements/build.mill | 2 -- .../3-unmanaged-wheels/build.mill | 3 -- .../4-downloading-unmanaged-wheels/build.mill | 3 -- .../5-repository-config/build.mill | 3 -- .../dependencies/6-debugging/build.mill | 3 -- 10 files changed, 1 insertion(+), 59 deletions(-) diff --git a/example/package.mill b/example/package.mill index b6639f072b3..7b43280b76f 100644 --- a/example/package.mill +++ b/example/package.mill @@ -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")) } @@ -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 { diff --git a/example/pythonlib/basic/1-simple/build.mill b/example/pythonlib/basic/1-simple/build.mill index 1e31652fe86..1c2fc082fe4 100644 --- a/example/pythonlib/basic/1-simple/build.mill +++ b/example/pythonlib/basic/1-simple/build.mill @@ -1,4 +1,3 @@ -//// SNIPPET:BUILD package build import mill._, pythonlib._ @@ -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 @@ -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. diff --git a/example/pythonlib/basic/2-custom-build-logic/build.mill b/example/pythonlib/basic/2-custom-build-logic/build.mill index d8610e9d75c..f66d20d98a0 100644 --- a/example/pythonlib/basic/2-custom-build-logic/build.mill +++ b/example/pythonlib/basic/2-custom-build-logic/build.mill @@ -1,4 +1,3 @@ -//// SNIPPET:BUILD package build import mill._, pythonlib._ diff --git a/example/pythonlib/basic/3-multi-module/build.mill b/example/pythonlib/basic/3-multi-module/build.mill index 79ac2acd941..ac08fe51f32 100644 --- a/example/pythonlib/basic/3-multi-module/build.mill +++ b/example/pythonlib/basic/3-multi-module/build.mill @@ -1,4 +1,3 @@ -//// SNIPPET:BUILD package build import mill._, pythonlib._ @@ -16,7 +15,6 @@ object bar extends MyModule { def pythonDeps = Seq("Jinja2==3.1.4") } // -//// SNIPPET:TREE // ---- // build.mill // foo/ diff --git a/example/pythonlib/dependencies/1-pip-deps/build.mill b/example/pythonlib/dependencies/1-pip-deps/build.mill index 39d0b2d0e08..368c1f72743 100644 --- a/example/pythonlib/dependencies/1-pip-deps/build.mill +++ b/example/pythonlib/dependencies/1-pip-deps/build.mill @@ -1,4 +1,3 @@ -//// SNIPPET:BUILD package build import mill._, pythonlib._ @@ -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 `==` // constraints, or even direct references to wheels. -//// SNIPPET:USAGE - /** Usage > ./mill run diff --git a/example/pythonlib/dependencies/2-pip-requirements/build.mill b/example/pythonlib/dependencies/2-pip-requirements/build.mill index 35d4be78546..21c313ccaea 100644 --- a/example/pythonlib/dependencies/2-pip-requirements/build.mill +++ b/example/pythonlib/dependencies/2-pip-requirements/build.mill @@ -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._ @@ -10,7 +9,6 @@ object `package` extends RootModule with PythonModule { millSourcePath / "requirements.txt" } } -//// SNIPPET:END /** Usage diff --git a/example/pythonlib/dependencies/3-unmanaged-wheels/build.mill b/example/pythonlib/dependencies/3-unmanaged-wheels/build.mill index 8f86312605f..62366cd7b55 100644 --- a/example/pythonlib/dependencies/3-unmanaged-wheels/build.mill +++ b/example/pythonlib/dependencies/3-unmanaged-wheels/build.mill @@ -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._ @@ -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 diff --git a/example/pythonlib/dependencies/4-downloading-unmanaged-wheels/build.mill b/example/pythonlib/dependencies/4-downloading-unmanaged-wheels/build.mill index cf4f10f0aea..5eb12d24ad0 100644 --- a/example/pythonlib/dependencies/4-downloading-unmanaged-wheels/build.mill +++ b/example/pythonlib/dependencies/4-downloading-unmanaged-wheels/build.mill @@ -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._ @@ -16,8 +15,6 @@ object `package` extends RootModule with PythonModule { } } -//// SNIPPET:END - /** Usage > ./mill run diff --git a/example/pythonlib/dependencies/5-repository-config/build.mill b/example/pythonlib/dependencies/5-repository-config/build.mill index eb529f94389..bd3771bd315 100644 --- a/example/pythonlib/dependencies/5-repository-config/build.mill +++ b/example/pythonlib/dependencies/5-repository-config/build.mill @@ -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._ @@ -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 diff --git a/example/pythonlib/dependencies/6-debugging/build.mill b/example/pythonlib/dependencies/6-debugging/build.mill index 520ef65ca05..b70c66e1c68 100644 --- a/example/pythonlib/dependencies/6-debugging/build.mill +++ b/example/pythonlib/dependencies/6-debugging/build.mill @@ -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._ @@ -16,8 +15,6 @@ object `package` extends RootModule with PythonModule { def indexes = Seq("invalid_index") } -//// SNIPPET:END - /** Usage > ./mill show pipInstallArgs