Skip to content

Commit

Permalink
Replace Pipenv with Poetry
Browse files Browse the repository at this point in the history
I used to use and like Pipenv but no longer think it’s viable - the
project is in maintenance mode and has some serious unfixed issues
([link](pypa/pipenv#2665),
[link](pypa/pipenv#2412))
which have been “fixed” by removing fundamental features since the dev
team was [unable to figure out](pypa/pipenv#4988)
what was going on in the codebase. Other dev teams are also
[abandoning](log2timeline/dftimewolf#636)
this package manager.

Poetry offers some significant advantages such as compatibility with
the pyproject.toml standard, the ability to upgrade a single
dependency, and the ability to publish packages.
  • Loading branch information
syntaxaire committed Jul 30, 2022
1 parent 94dd6af commit baf335e
Show file tree
Hide file tree
Showing 7 changed files with 423 additions and 670 deletions.
5 changes: 2 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[flake8]
max-line-length=100
exclude=__pycache__, venv, .venv
import-order-style=pycharm
max-line-length = 100
extend-ignore = E203
72 changes: 43 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,59 @@
# Welcome!
This project is spearheaded by the Trash Monks wiki editing team for the Caves of Qud community. We coordinate in the [official Caves of Qud Discord server](https://discordapp.com/invite/cavesofqud) (invite link).
# Contributing

Contributions from the community in the form of issues or pull requests are welcomed. The Trash Monks team is also available to join on the Discord server by asking any of the Mayors there.
This project is spearheaded by the Trash Monks wiki editing team for the Caves of Qud community. We coordinate in the
[official Caves of Qud Discord server](https://discordapp.com/invite/cavesofqud)
(invite link).

This project uses the Code of Conduct available from that Discord server, in the `#code-of-conduct` channel.
Contributions from the community in the form of issues or pull requests are welcomed. The Trash Monks team is also
available to join on the Discord server by asking any of the Mayors there.

This project uses the Code of Conduct available in the file `CODE_OF_CONDUCT.md`.

## Environment setup

To develop on this project, have Python 3.10 installed on your system, then `git clone`
the repo to your hard drive and set up a virtual environment from the repo directory:

# Environment setup
To develop on this project, have Python 3.7 installed on your system, then `git clone` the repo to your hard drive and set up a virtual environment by running `pipenv` in the repo directory:
```bash
python -m pip install --user pipenv # install pipenv on your system
cd repo-folder # insert your repo directory
python -m pipenv install --dev # create a virtual environment for the current directory
# and install requirements from Pipfile,
# including development dependencies
python -m pip install --user poetry
poetry install --dev
```

# Using a local Hagadias in a pipenv
By default, projects that include hagadias in their pipfile will use the hagadias hosted on git, but these are the steps to take to make the pipenv read your local hagadias folder instead. Testing out local changes on Hagadias to for other connected Trash Monk projects is recommended to make sure the outcomes for those projects are correct. This assumes that the pipfile already has hagadias.
## Using a local hagadias in a virtual environment

Look up how to change your system environment variables. For Windows, this can be done by searching "System environment" and select "Edit System environment variables" and then select the "Environment Variables..." in the Advanced Tab.
By default, projects that include hagadias in their dependencies will use the hagadias hosted on git, but these are the
steps to take to make the virtual environment use your local hagadias folder instead. Testing out local changes on
Hagadias to for other connected Trash Monk projects is recommended to make sure the outcomes for those projects are
correct. This assumes that the virtual environment already has hagadias.

Create a new system variable (or user variable if installed locally) called `PYTHONPATH` and set the value to your hagadias directory (Ex. `C:\Users\(you)\Documents\github\hagadias\`). This must end in a backslash to read the whole folder instead of just the folder file itself!
Look up how to change your system environment variables. For Windows, this can be done by searching "System environment"
and select "Edit System environment variables" and then select the "Environment Variables..." in the Advanced Tab.

Start a new terminal and run your program of choice in the pipenv shell.
Create a new system variable (or user variable if installed locally) called `PYTHONPATH`
and set the value to your hagadias directory (Ex.
`C:\Users\(you)\Documents\github\hagadias\`). This must end in a backslash to read the whole folder instead of just the
folder itself!

This makes python read the hagadias folder every time you run something. This may cause issues if you are working on unrelated projects that use py files that share the same name as some in hagadias. If this is of concern, be sure to remove the PYTHONPATH variable once you're done with hagadias development.
Start a new terminal, enter the virtual environment from the project directory by running `poetry shell`, and run your
program of choice.

# Running tests
In order to run the test suite, create a file in your `hagadias` project development directory called
`game_location_for_tests`. The only contents of this file should be a path to the installation directory of
Caves of Qud, with no other characters.
This makes python read the hagadias folder every time you run something. This may cause issues if you are working on
unrelated projects that use .py files that share the same name as some in hagadias. If this is of concern, be sure to
remove the PYTHONPATH variable once you're done with hagadias development.

## Running tests

In order to run the test suite, create a file in your `hagadias` project development directory
called `game_location_for_tests`. The only contents of this file should be a path to the installation directory of Caves
of Qud, with no other characters.

Run the tests with:

Activate the venv with:
```
pipenv shell
```
and then run:
```
python -m pytest
poetry run python -m pytest
```


# Pull requests
Pull requests are welcome. Please run `flake8` and `pytest` to ensure that your code will pass the automatic test first.

Pull requests are welcome. Please run `black --line-length 100`, `flake8` and `pytest` to ensure that your code will
pass the automatic tests first.
24 changes: 0 additions & 24 deletions Pipfile

This file was deleted.

Loading

0 comments on commit baf335e

Please sign in to comment.