Skip to content

Commit

Permalink
Add Notes for Windows/macOS Targeted Development
Browse files Browse the repository at this point in the history
  • Loading branch information
derks committed Nov 10, 2024
1 parent 82848ee commit 44f2d17
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 33 deletions.
95 changes: 65 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ Cement is an advanced Application Framework for Python, with a primary focus on

The first commit to Git was on Dec 4, 2009. Since then, the framework has seen several iterations in design, and has continued to grow and improve since it's inception. Cement is the most stable, and complete framework for command line and backend application development.

## Installation

```
pip install cement
```

Optional CLI Extras (for development):

```
pip install cement[cli]
```


## Core Features

Cement core features include (but are not limited to):
Expand All @@ -26,10 +39,12 @@ Cement core features include (but are not limited to):
- Hook support adds a bit of magic to apps and also ties into framework
- Zero external dependencies* (not including optional extensions)
- 100% test coverage (`pytest`, `coverage`)
- 100% PEP8 compliant (`ruff`)
- 100% PEP8 compliance (`ruff`)
- Type annotation compliance (`mypy`)
- Extensive API Reference (`sphinx`)
- Tested on Python 3.8+


## Optional Extensions

Some extensions that are shipped with the mainline Cement source do require external dependencies. It is the responsibility of the application developer to include these dependencies along with their application, as Cement explicitly does not include them. Dependencies can be installed via each extensions optional package (ex: `cement[colorlog]`, `cement[redis]`, etc).
Expand All @@ -50,11 +65,12 @@ See: [https://docs.builtoncement.com/extensions](https://docs.builtoncement.com/

The Cement CLI Application Framework is Open Source and is distributed under the BSD License (three clause). Please see the LICENSE file included with this software.


## Development

### Docker

This project includes a `docker-compose` configuration that sets up all required services, and dependencies for development and testing. This is the recommended path for local development, and is the only fully supported option.
This project includes a Docker Compose configuration that sets up all required services, and dependencies for development and testing. This is the recommended path for local development, and is the only fully supported option.

The following creates all required docker containers, and launches an BASH shell within the `cement` dev container for development.
```
Expand All @@ -66,9 +82,9 @@ $ make dev
The above is the equivalent of running:

```
$ docker-compose up -d
$ docker compose up -d
$ docker-compose exec cement /bin/bash
$ docker compose exec cement /bin/bash
```

All execution is done *inside the docker containers*.
Expand Down Expand Up @@ -98,62 +114,81 @@ $ docker-compose exec cement-py39 /bin/bash
```


### Vagrant
### Windows Targeted Development

*Windows development and support is not 100% complete. Applications Built on Cement is known to run and work on Windows well, however it is not a primary target for development and as such the setup is not as streamlined and currently has several known issues.*

If you are developing on Windows, the recommended path is still Docker. However if you are specifically targeting development *for* Windows you will want to run Python/Cement natively which will require setting up a development environment on the Windows host.

This is very rough (future doc coming), however the following will be required:

An alternative option is included to run Vagrant for development. This is partially supported, primarily for the purpose of developing/testing on Windows as well as testing specific issues on target operating systems.
- Python 3.x (latest stable preferred)
- pip
- pipx
- pdm
- Visual C++ 14.0 or Greater Build Tools
- Including: CMake

To see a list of configured systems:
Assuming Python/PIP are installed, the following will install PDM:

```
$ vagrant status
pip install pipx
pipx install pdm
```

#### Linux
C++ Build Tools are install, the following will create a development virtual env:

```
$ vagrant up linux
pdm venv create
$ vagrant ssh linux
pdm install --without memcached
```

vagrant@linux $ cd /vagrant
You can then run the core tests:

vagrant@linux $ bash scripts/vagrant/bootstrap.sh
```
pdm run pytest --cov=cement.core tests/core
```

vagrant@linux $ make virtualenv
*Note that only the core library is fully tested on Windows.*

vagrant@linux $ pdm venv activate
Please explore the Makefile for helpers that may or may not work. Example, the following will run the same as the above `pdm run pytest` command:

|> cement >| $
```
make test-core
```

#### Windows
And, you can run Cement CLI via:

*Windows development and support is not 100% complete. Cement is known to run and work on Windows, however it is not a primary target for development and as such the setup is not as streamlined and currently has several known errors.*
```
pdm run cement --help
```

The following assumes you're running these two initial commands from a unix based system:

```
$ make clean
### macOS Targeted Development

$ vagrant up windows
```
Similar to the above... if you are developing on macOS, the recommended path is still Docker. However if you are specifically targeting development *for* macOS you will want to run Python/Cement natively which will require setting up a development environment on the macOS host.

RDP or Login to Desktop/Console, and open a PowerShell terminal:
This is less nuanced than Windows, however still required some dependencies that will not be fully covered here (example: memcached). The following will get you setup to run the core library tests.

```
C:\> cd C:\Vagrant
pip install pipx
C:\Vagrant> powershell.exe scripts\vagrant\bootstrap.ps1
pipx install pdm
C:\Vagrant> make virtualenv
pdm venv create
C:\Vagrant> pdm venv activate
pdm install --without memcached
C:\Vagrant> make test-core
make test-core
```

*Note that only the core library is fully tested on Windows.*
And, you can run Cement CLI via:

```
pdm run cement --help
```

### Running Tests and Compliance

Expand Down
11 changes: 9 additions & 2 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/core/test_foundation.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_basic():


def test_loaded_extensions():
if platform.system().lower() in ['windows']:
if platform.system().lower() in ['windows', 'darwin']:
ext_list = [
'colorlog',
'dummy',
Expand Down

0 comments on commit 44f2d17

Please sign in to comment.