Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

PyPI Travis AppVeyor Codecov

Pyler is a lib that helps tackling Project Euler problems using Python

How ?

$ pip install pyler

Generate a file

# generates the file for problem 1
$ pyler gen 1
# generates the file for problems 1 to 10, 14 and 17 to 24
$ pyler gen 1-10,14,17-24
# generates the first not-yet-generated problem
$ pyler gen next
# generates all available problems
$ pyler gen all

You get the idea !

This will generate a file that has more or less everything for beginning the real work. Just fill the variables and code your solution into solver.

from pyler import EulerProblem


class Problem0001(EulerProblem):
    """
    If we list all the natural numbers below 10 that are multiples of 3 or 5, we
    get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the
    multiples of 3 or 5 below 1000.
    """
    problem_id = 1
    simple_input = 0
    simple_output = 1
    real_input = 0

    def solver(self, input_val):
        return 0

if __name__ == '__main__':
    import unittest
    unittest.main()

You can change the path where the files are being generated using --path and the template used with --template=path/to/template.py, the template file must be compatible with Python’s [.format](https://pyformat.info/) function and will recieve 2 variables : doc and problem_id

BTW : yes, the docstring is scraped from the website.

Test your solution

# Tests the implementation of the first problem
$ pyler test 1
# Well I'm sure you know what this does
$ pyler test 1-10,14,17-24
# Tests the last problem
$ pyler test last

You may also use unittest or the testing tool of your choice that accept unittest TestCases. Calling Python on the problem file directly will also launch the tests.

Launching the tests on your solution module will test your solution for :

  • The simple test case (the one that’s given in the statement)

  • The real test case (it will check on the real website to do so). The first time, it will ask for your credentials (stored in a local file .pyler.conf) and now and then, it will ask you to solve the captchas. If you have already validated the problem, it will check the solution from the page. Otherwise, it will submit the solution for you.

  • A test ensuring that your implementation takes less than 1 minute. If you’re not using Windows, it will stop at 1 minute. Otherwise, it will fail when the computation is over.

You can use any number of --only=x and --skip=x flags with x being simple, real, time.

Metadata

Release files for pyler 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyler 0.2.0
File Size Uploaded
pyler-0.2.0.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyler 0.2.0
File Interpreter ABI Platform
pyler-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / pyler-0.2.0.tar.gz

Download URL pyler-0.2.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f4c5a99ef2b5ca3db4371c8107f66ba9985d0089fb94b17f652ca87b5a26f24d
BLAKE2b-256 checksum
How to use checksums
74d55b85750f13e45aea2881fb839e09d449c80c5115358410b7239b9578e5cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pyler-0.2.0-py3-none-any.whl

Download URL pyler-0.2.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b2e2eb2c1ae0b9d16c6c2fda9b166f63514ac0be2696e355e473f951bda3463
BLAKE2b-256 checksum
How to use checksums
f84b56b17bea4c62784bd96c3fa87301d1d0eddac0ba7eb34a5cdcbe71d1fbd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page