Welcome to this Python coding test. This test is designed to assess your ability to write clean, well-structured, and maintainable code. You will be tasked with adding some functionality to this codebase.
We will be looking for the following aspects:
- The readability and clarity of your code; including aspects such as:
- Naming conventions
- Code structure
- Comments
- Documentation
- The correctness of your code; including aspects such as:
- Handling of edge cases
- Error handling
- Testing
- The maintainability of your code; including aspects such as:
- Modularity
- Extensibility
- Reusability
- Your familiarity with standard development tools and practices; including
aspects such as:
- Version control
- Creating and using virtual environments
- Documenting PRs and commits
Please fork this repository and submit your solution as a pull request. Your solution should pass the existing CI checks, and you should ensure that your code is tested. This project uses the pytest testing framework.
This project uses Hatch for managing the development environment. The code is split across three packages:
pypacter
: The core logicpypacter-api
: API wrapperpypacter-cli
: CLI to interact with the API
The structure of the project is as follows:
pypacter/
├── pypacter-api/ <== API wrapper
│ ├── src/pypacter_api/
│ ├── tests/
│ ├── pyproject.toml
│ └── README.md
├── pypacter-cli/ <== CLI to interact with API
│ ├── src/pypacter_cli/
│ ├── tests/
│ ├── pyproject.toml
│ └── README.md
├── notebooks/ <== Jupyter notebooks (if any)
├── src/
│ └── pypacter/ <== Core logic
├── tests/
├── mkdocs.yml
├── pyproject.toml
└── README.md
The following tasks purposefully leave out some specificity to allow you to demonstrate your problem-solving skills, and give you the opportunity to make decisions about the implementation.
Each task should only take about 30 minutes to complete, and you should also allow 30 minutes to familiarize yourself with the codebase. If you find yourself spending more time on a task, submit what you have and document in the PR what you would have done if you had more time.
Add a new function to the core package to:
- Ingest a snippet of code
- Output the most likely programming language
Ideally, this function should make use of a large language model (LLM) to detect the language, but you can use any method you prefer.
Clients will be submitting code snippets to the API, and in order to improve the customer experience, we want to automatically detect the programming language instead of requiring the client to specify it.
Add a new API endpoint for the language detection function.
Another team is building a feature that requires the language detection functionality, and instead of duplicating the work, they have asked us to expose the functionality via a new API endpoint.
Add a new CLI command for the language detection function. The CLI should accept the code snippet either as a file path, or through standard input.
The CLI is the primary way that developers interact with the API, and we want to make sure that the new functionality is easily accessible.
Show-case your skills by adding a new feature of your choice to the core package. Ideally, this feature should make use of an LLM.