Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory when initialising a project #41

Closed
edurdevic opened this issue Feb 7, 2024 · 0 comments · Fixed by #65
Closed

No such file or directory when initialising a project #41

edurdevic opened this issue Feb 7, 2024 · 0 comments · Fixed by #65

Comments

@edurdevic
Copy link

After running databricks labs blueprint init-project --target discoverx I get the following error

> 
> Name of the project (default: discoverx): 
> 11:59:55 ERROR [d.l.blueprint.init-project] FileNotFoundError: [Errno 2] No such file or directory: '.databricks/labs/blueprint/lib'
> User@C02FR21BML85 discoverx % databricks labs blueprint init-project --target discoverx --debug
> 12:00:05  INFO start pid=15666 version=0.212.1 args="databricks, labs, blueprint, init-project, --target, discoverx, --debug"
> 12:00:05 DEBUG Loading installed version info from: /Users/User/.databricks/labs/blueprint/state/version.json pid=15666
> 12:00:05 DEBUG Passing down environment variables:  pid=15666
> 12:00:05 DEBUG Forwarding subprocess: /Users/User/.databricks/labs/blueprint/state/venv/bin/python3 /Users/User/.databricks/labs/blueprint/lib/src/databricks/labs/blueprint/__main__.py {"command":"init-project","flags":{"log_level":"debug","target":"discoverx"},"output_type":""} pid=15666
> 12:00:05 DEBUG starting: /Users/User/.databricks/labs/blueprint/state/venv/bin/python3 /Users/User/.databricks/labs/blueprint/lib/src/databricks/labs/blueprint/__main__.py {"command":"init-project","flags":{"log_level":"debug","target":"discoverx"},"output_type":""} pid=15666
> Name of the project (default: discoverx): 
> 12:00:09 ERROR [d.l.blueprint.init-project] Failed to call init-project: Traceback (most recent call last):
>   File "/Users/User/.databricks/labs/blueprint/lib/src/databricks/labs/blueprint/cli.py", line 74, in _route
>     self._mapping[command].fn(**kwargs)
>   File "/Users/User/.databricks/labs/blueprint/lib/src/databricks/labs/blueprint/__main__.py", line 101, in init_project
>     for file in current.iterdir():
>   File "/usr/local/Cellar/python@3.10/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/pathlib.py", line 1017, in iterdir
>     for name in self._accessor.listdir(self):
> FileNotFoundError: [Errno 2] No such file or directory: '.databricks/labs/blueprint/lib'
nfx added a commit that referenced this issue Mar 9, 2024
@nfx nfx closed this as completed in #65 Mar 9, 2024
nfx added a commit that referenced this issue Mar 9, 2024
nfx added a commit that referenced this issue Mar 9, 2024
* Added commands with interactive prompts ([#66](#66)). This commit introduces a new feature in the Databricks Labs project to support interactive prompts in the command-line interface (CLI) for enhanced user interactivity. The `Prompts` argument, imported from `databricks.labs.blueprint.tui`, is now integrated into the `@app.command` decorator, enabling the creation of commands with user interaction like confirmation prompts. An example of this is the `me` command, which confirms whether the user wants to proceed before displaying the current username. The commit also refactored the code to make it more efficient and maintainable, removing redundancy in creating client instances. The `AccountClient` and `WorkspaceClient` instances can now be provided automatically with the product name and version. These changes improve the CLI by making it more interactive, user-friendly, and adaptable to various use cases while also optimizing the codebase for better efficiency and maintainability.
* Added more code documentation ([#64](#64)). This release introduces new features and updates to various files in the open-source library. The `cli.py` file in the `src/databricks/labs/blueprint` directory has been updated with a new decorator, `command`, which registers a function as a command. The `entrypoint.py` file in the `databricks.labs.blueprint` module now includes a module-level docstring describing its purpose, as well as documentation for the various standard libraries it imports. The `Installation` class in the `installers.py` file has new methods for handling files, such as `load`, `load_or_default`, `upload`, `load_local`, and `files`. The `installers.py` file also includes a new `InstallationState` dataclass, which is used to track installations. The `limiter.py` file now includes code documentation for the `RateLimiter` class and the `rate_limited` decorator, which are used to limit the rate of requests. The `logger.py` file includes a new `NiceFormatter` class, which provides a nicer format for logging messages with colors and bold text if the console supports it. The `parallel.py` file has been updated with new methods for running tasks in parallel and returning results and errors. The `TUI.py` file has been documented, and includes imports for logging, regular expressions, and collections abstract base class. Lastly, the `upgrades.py` file has been updated with additional code documentation and new methods for loading and applying upgrade scripts. Overall, these changes improve the functionality, maintainability, and usability of the open-source library.
* Fixed init-project command ([#65](#65)). In this release, the `init-project` command has been improved with several bug fixes and new functionalities. A new import statement for the `sys` module has been added, and a `docs` directory is now included in the copied directories and files during initialization. The `init_project` function has been updated to open files using the default system encoding, ensuring proper reading and writing of file contents. The `relative_paths` function in the `entrypoint.py` file now returns absolute paths if the common path is the root directory, addressing issue [#41](#41). Additionally, several test functions have been added to `tests/unit/test_entrypoint.py`, enhancing the reliability and robustness of the `init-project` command by providing comprehensive tests for supporting functions. Overall, these changes significantly improve the functionality and reliability of the `init-project` command, ensuring a more consistent and accurate project initialization process.
* Using `ProductInfo` with integration tests ([#63](#63)). In this update, the `ProductInfo` class has been enhanced with a new class method `for_testing(klass)` to facilitate effective integration testing. This method generates a new `ProductInfo` object with a random `product_name`, enabling the creation of distinct installation directories for each test execution. Prior to this change, conflicts and issues could arise when multiple test executions shared the same integration test folder. With the introduction of this new method, developers can now ensure that their integration tests run with unique product names and separate installation directories, enhancing testing isolation and accuracy. This update is demonstrated in the provided code snippet and includes a new test case to confirm the generation of unique product names. Furthermore, a pre-existing test case has been modified to provide a more specific error message related to the `SingleSourceVersionError`. This enhancement aims to improve the integration testing capabilities of the codebase and is designed to be easily adopted by other software engineers utilizing this project.
@nfx nfx mentioned this issue Mar 9, 2024
nfx added a commit that referenced this issue Mar 9, 2024
* Added commands with interactive prompts
([#66](#66)). This
commit introduces a new feature in the Databricks Labs project to
support interactive prompts in the command-line interface (CLI) for
enhanced user interactivity. The `Prompts` argument, imported from
`databricks.labs.blueprint.tui`, is now integrated into the
`@app.command` decorator, enabling the creation of commands with user
interaction like confirmation prompts. An example of this is the `me`
command, which confirms whether the user wants to proceed before
displaying the current username. The commit also refactored the code to
make it more efficient and maintainable, removing redundancy in creating
client instances. The `AccountClient` and `WorkspaceClient` instances
can now be provided automatically with the product name and version.
These changes improve the CLI by making it more interactive,
user-friendly, and adaptable to various use cases while also optimizing
the codebase for better efficiency and maintainability.
* Added more code documentation
([#64](#64)). This
release introduces new features and updates to various files in the
open-source library. The `cli.py` file in the
`src/databricks/labs/blueprint` directory has been updated with a new
decorator, `command`, which registers a function as a command. The
`entrypoint.py` file in the `databricks.labs.blueprint` module now
includes a module-level docstring describing its purpose, as well as
documentation for the various standard libraries it imports. The
`Installation` class in the `installers.py` file has new methods for
handling files, such as `load`, `load_or_default`, `upload`,
`load_local`, and `files`. The `installers.py` file also includes a new
`InstallationState` dataclass, which is used to track installations. The
`limiter.py` file now includes code documentation for the `RateLimiter`
class and the `rate_limited` decorator, which are used to limit the rate
of requests. The `logger.py` file includes a new `NiceFormatter` class,
which provides a nicer format for logging messages with colors and bold
text if the console supports it. The `parallel.py` file has been updated
with new methods for running tasks in parallel and returning results and
errors. The `TUI.py` file has been documented, and includes imports for
logging, regular expressions, and collections abstract base class.
Lastly, the `upgrades.py` file has been updated with additional code
documentation and new methods for loading and applying upgrade scripts.
Overall, these changes improve the functionality, maintainability, and
usability of the open-source library.
* Fixed init-project command
([#65](#65)). In this
release, the `init-project` command has been improved with several bug
fixes and new functionalities. A new import statement for the `sys`
module has been added, and a `docs` directory is now included in the
copied directories and files during initialization. The `init_project`
function has been updated to open files using the default system
encoding, ensuring proper reading and writing of file contents. The
`relative_paths` function in the `entrypoint.py` file now returns
absolute paths if the common path is the root directory, addressing
issue [#41](#41).
Additionally, several test functions have been added to
`tests/unit/test_entrypoint.py`, enhancing the reliability and
robustness of the `init-project` command by providing comprehensive
tests for supporting functions. Overall, these changes significantly
improve the functionality and reliability of the `init-project` command,
ensuring a more consistent and accurate project initialization process.
* Using `ProductInfo` with integration tests
([#63](#63)). In this
update, the `ProductInfo` class has been enhanced with a new class
method `for_testing(klass)` to facilitate effective integration testing.
This method generates a new `ProductInfo` object with a random
`product_name`, enabling the creation of distinct installation
directories for each test execution. Prior to this change, conflicts and
issues could arise when multiple test executions shared the same
integration test folder. With the introduction of this new method,
developers can now ensure that their integration tests run with unique
product names and separate installation directories, enhancing testing
isolation and accuracy. This update is demonstrated in the provided code
snippet and includes a new test case to confirm the generation of unique
product names. Furthermore, a pre-existing test case has been modified
to provide a more specific error message related to the
`SingleSourceVersionError`. This enhancement aims to improve the
integration testing capabilities of the codebase and is designed to be
easily adopted by other software engineers utilizing this project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant